SDL Overlay question

I’m trying to use SDL overlay for a frame grabbing program i’m writing. I
found some code online from the api docs which seems pretty useful. Here is
the link where i got it from http://sdl.beuc.net/sdl.wiki/SDL_Overlay
and Here is the part of it i am stuck on:

/* Display number of planes */
printf(“Planes: %d\n”, my_overlay->planes);

/* Fill in video data */
y_video_data = …
u_video_data = …
v_video_data = …

/* Fill in pixel data - the pitches array contains the length of a line in
each plane */
SDL_LockYUVOverlay(my_overlay);
memcpy(my_overlay->pixels[0], y_video_data, my_overlay->pitches[0]);
memcpy(my_overlay->pixels[1], u_video_data, my_overlay->pitches[1]);
memcpy(my_overlay->pixels[2], v_video_data, my_overlay->pitches[2]);

/* Draw a single pixel on (x, y) */
*(my_overlay->pixels[0] + y * my_overlay->pitches[0] + x) = 0x10;
*(my_overlay->pixels[1] + y/2 * my_overlay->pitches[1] + x/2) = 0x80;
*(my_overlay->pixels[2] + y/2 * my_overlay->pitches[2] + x/2) = 0x80;

SDL_UnlockYUVOverlay(my_overlay);

I can grab the frames i want in yuv format. but i’m not sure what to do to
fill in the y, u and v_video_data variables.

Thanks in advance for any help!–
View this message in context: http://www.nabble.com/SDL-Overlay-question-tp24151930p24151930.html
Sent from the SDL mailing list archive at Nabble.com.

Also, I didn’t find anything when looking online, but would it be possible to
use SDL overlay in an RGB format? this would make things easier and more
efficient for me.–
View this message in context: http://www.nabble.com/SDL-Overlay-question-tp24151930p24152002.html
Sent from the SDL mailing list archive at Nabble.com.

No, SDL (and many video APIs) don’t support RGB overlays. Also note that on
some platforms it’s not a true hardware overlay, it’s emulated by converting
YUV into RGB and copying it into the framebuffer.

Why do you need an overlay, if RGB would be more convenient?On Mon, Jun 22, 2009 at 10:36 AM, Mike M wrote:

Also, I didn’t find anything when looking online, but would it be possible
to
use SDL overlay in an RGB format? this would make things easier and more
efficient for me.

View this message in context:
http://www.nabble.com/SDL-Overlay-question-tp24151930p24152002.html
Sent from the SDL mailing list archive at Nabble.com.


SDL mailing list
SDL at lists.libsdl.org
http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org


-Sam Lantinga, Founder and President, Galaxy Gameworks LLC