Skip to main content
gamedev.net
🔒 Locked

SDL video

Started by mourya Feb 20, 2007 at 1:52 AM 2 replies 1k views
Original Post
mourya
mourya
hi, i have a problem is SDL, i am decoding the video using avcodec_decode_video(videoCodec,prevFrame,&gotpics,pkt.data,pkt.size); then i heard that i have to copy the data into buffers so that i can lock, unlock and display the YUVoverlay. i dont know how to copy the data to the buffer. you guys have any idea about that
sevensevens
sevensevens
you should be able to copy them using memcpy (just remember to check the 'pitch' of the surfaces, and copy one line at a time). Could you please clarify your post?
HolyGrail
HolyGrail
This an example taken from testwin.c given with SDL files:

SDL_Surface *screen

if ( SDL_LockSurface(screen) == 0 )
{
Uint32 black;
Uint8 *pixels;

black = SDL_MapRGB(screen->format, 0, 0, 0);
pixels = (Uint8 *)screen->pixels;
for ( i=0; ih; ++i ) {
memset(pixels, black,
screen->w*screen->format->BytesPerPixel);
pixels += screen->pitch;
}
SDL_UnlockSurface(screen);
sevensevens
sevensevens
try replacing memset with memcpy (be sure to check 'black' to point to your video frame).

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.