Search code examples
c++sdldev-c++mpegsdl-1.2

SDL 1.2 and SMPEG: Black and white video output only


When trying to port SMPEG to SDL 1.2, I used SDL_CreateRGBSurface instead of SDL_UpdateTexture. In the end, however, I came up with this:

front=SDL_CreateRGBSurfaceFrom(context.frame->image,context.frame->w, context.frame->h,8,context.frame->w,0xff,0xff,0xff,0);

And this worked, but I got a black and white image instead of a coloured one. Any tinkering of the bpp had some crazy results. Could I have a tip or some sample code for this?


Solution

  • So, apparently you have to use an SDL_YUVOverlay. Memcpy the frame's pixel data (double the number of pixels for the amount of bytes) into the overlay and then update the surface.

    I think I got SMPEG in the bag now.