SDL 1.2.6 breaks SMPEG

Hey,

There’s really no smpeg list, but I figure the people that know the most
about it probably read this list. Changes made in SDL 1.2.6 cause SMPEG
to be useless when used with an OpenGL program. A quick way to prove
this to yourself is to try running glmovie from any SMPEG release with
SDL 1.2.6 or higher installed.

The reason this broke is that SDL_CreateYUVOverlay was changed to
disallow creation of an SDL_Overlay if SDL_OPENGL is set in the flags
for the main video surface. This is a necessary change in SDL I am
sure, but as a side effect SMPEG simply crashes when trying to play a
movie if SDL_OPENGL is set.

It’s pretty cut and dried, SMPEG tries to lock the SDL_Overlay, which is
NULL and you can probably guess what happens when you look at
SDL_LockYUVOverlay:

int SDL_LockYUVOverlay(SDL_Overlay *overlay)
{
return overlay->hwfuncs->Lock(current_video, overlay);
}

SMPEG_setdisplay doesn’t have any error checking to notify the user of
this, so the program using SMPEG just gets a rude segfault.

So anyway, SMPEG is now rendered (nearly) useless. This is not an SDL
problem, but if anyone knows or cares enough about SMPEG to try to fix
it, I’m sure it’d help out a few people.–
Dan Olson

There’s really no smpeg list, but I figure the people that know the most
about it probably read this list. Changes made in SDL 1.2.6 cause SMPEG
to be useless when used with an OpenGL program. A quick way to prove
this to yourself is to try running glmovie from any SMPEG release with
SDL 1.2.6 or higher installed.

(There is an smpeg list, just not much traffic:
smpeg-subscribe at icculus.org). We also have several bugfixes in our CVS
over the final lokigames version, but lots of people on this list point
to the lokigames.com URL when referring to smpeg.

http://icculus.org/smpeg/

Let me take a look at this crash.

–ryan.

Dan Olson wrote:

Hey,

There’s really no smpeg list, but I figure the people that know the most
about it probably read this list. Changes made in SDL 1.2.6 cause SMPEG
to be useless when used with an OpenGL program. A quick way to prove
this to yourself is to try running glmovie from any SMPEG release with
SDL 1.2.6 or higher installed.

The reason this broke is that SDL_CreateYUVOverlay was changed to
disallow creation of an SDL_Overlay if SDL_OPENGL is set in the flags
for the main video surface. This is a necessary change in SDL I am
sure, but as a side effect SMPEG simply crashes when trying to play a
movie if SDL_OPENGL is set.

This change was made because it’s not possible (ie not portable) to have
OpenGL and Overlays at the same time.
See Sam’s posting about the issue :
http://www.libsdl.org/pipermail/sdl/2003-July/055530.html

Stephane

This change was made because it’s not possible (ie not portable) to have
OpenGL and Overlays at the same time.
See Sam’s posting about the issue :
http://www.libsdl.org/pipermail/sdl/2003-July/055530.html

Apple has a GL extension (as of OSX 10.2) that allows the user to define
a YUV texture:

http://oss.sgi.com/projects/ogl-sample/registry/APPLE/ycbcr_422.txt

Everything else needs a software fallback, I guess.

At this time, this is best fixed/worked around in SMPEG, i guess.

–ryan.

Ryan C. Gordon wrote:

Apple has a GL extension (as of OSX 10.2) that allows the user to define
a YUV texture:

http://oss.sgi.com/projects/ogl-sample/registry/APPLE/ycbcr_422.txt

Everything else needs a software fallback, I guess.

Well, if you use OpenGL 1.2 there’s a trick. Depending on the YUV format
you’re working with, you can use the OpenGL color matrix to do the
conversion.
This site has the yuv->rgb color conversion matrix :
http://www.pmx.it/pmdn/colormatrix.html

However, I don’t think updating a texture at each frame is a good idea,
from a performance viewpoint (unless you plan to add some other effects
on top) : creating and sending a texture to the card is an expensive
operation compared to a software yuv->rgb converter.

Stephane

Oops, that is a simple fix. Check out the code in CVS.

Thanks!
-Sam Lantinga, Software Engineer, Blizzard Entertainment

Ah, I thought the problem was in trying to use an OpenGL surface in the
first place…well, okay, that’s STILL a problem, but that’s a problem
for some other time. :slight_smile:

I put a patch in icculus.org’s SMPEG repository to check for a failing
SDL_CreateYUVOverlay() call, too.

–ryan.On Tue, 2003-12-30 at 23:49, Sam Lantinga wrote:

Oops, that is a simple fix. Check out the code in CVS.

Cool, thanks!

See ya,
-Sam Lantinga, Software Engineer, Blizzard Entertainment> On Tue, 2003-12-30 at 23:49, Sam Lantinga wrote:

Oops, that is a simple fix. Check out the code in CVS.

Ah, I thought the problem was in trying to use an OpenGL surface in the
first place…well, okay, that’s STILL a problem, but that’s a problem
for some other time. :slight_smile:

I put a patch in icculus.org’s SMPEG repository to check for a failing
SDL_CreateYUVOverlay() call, too.