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.