[SDL] quartz YUV overlays window/fullscreen
Jean-Charles BERTIN
jc.bertin at free.fr
Sun Sep 10 02:45:24 PDT 2006
Peter Mulholland <darkmatter <at> freeuk.com> writes:
>
> Hello Gregory,
>
> Tuesday, September 5, 2006, 11:25:45 PM, you wrote:
>
> > I noticed that YUV overlays don't work in OS X in a window (there's just
> > a black screen), but they do work fullscreen. Is this intentional?
>
> > I'm trying to use SMPEG to play back cutscenes. Everything works fine in
> > Linux/Windows both windowed and fullscreen.
>
> I doubt it's intentional. There are some bugs in the OS X YUV support
> (eg crashes on Intel Mac's - i've filed this in bugzilla). I'm not
> sure if it's issues with Quicktime (used to do the conversion) or how
> SDL is using it.
>
> A quick fix is to put SDL_putenv("SDL_VIDEO_YUV_HWACCEL=0"); at the
> start of your program - this forces SDL to use software YUV
> conversion.
>
The YUV 420 is buggy on MacOS X intel. Here is the patch:
--- SDL-1.2.9/src/video/quartz/SDL_QuartzYUV.m 2004-01-04 15:55:35 +0100
+++ SDL-1.2.9-jc/src/video/quartz/SDL_QuartzYUV.m 2006-09-10 11:37:41 +0200
@@ -273,6 +273,8 @@
return NULL;
}
+ /* Fix: jc.bertin at free.fr
+ PlanarPixmapInfoYUV420 is a big-endian struct */
yuv_pixmap = (PlanarPixmapInfoYUV420*)
malloc (sizeof(PlanarPixmapInfoYUV420) +
(width * height * 2));
@@ -290,20 +292,20 @@
/* CHECK_ALIGN(pixels[0]); */
pitches[0] = width;
- yuv_pixmap->componentInfoY.offset = offset;
- yuv_pixmap->componentInfoY.rowBytes = width;
+ yuv_pixmap->componentInfoY.offset = EndianS32_NtoB(offset);
+ yuv_pixmap->componentInfoY.rowBytes = EndianU32_NtoB(width);
offset += width * height;
pixels[plane2] = (Uint8*)yuv_pixmap + offset;
pitches[plane2] = width / 2;
- yuv_pixmap->componentInfoCb.offset = offset;
- yuv_pixmap->componentInfoCb.rowBytes = width / 2;
+ yuv_pixmap->componentInfoCb.offset = EndianS32_NtoB(offset);
+ yuv_pixmap->componentInfoCb.rowBytes = EndianU32_NtoB(width / 2);
offset += (width * height / 4);
pixels[plane3] = (Uint8*)yuv_pixmap + offset;
pitches[plane3] = width / 2;
- yuv_pixmap->componentInfoCr.offset = offset;
- yuv_pixmap->componentInfoCr.rowBytes = width / 2;
+ yuv_pixmap->componentInfoCr.offset = EndianS32_NtoB(offset);
+ yuv_pixmap->componentInfoCr.rowBytes = EndianU32_NtoB(width / 2);
overlay->pixels = pixels;
overlay->pitches = pitches;
More information about the SDL
mailing list