In that last question, I realized I cannot use both SDL
and SDL2
. Definitely I choose SDL2
over its precedent.
I had written the following code to capture screen and convert it to an AVFrame
for video creation:
AVFrame *frame = av_frame_alloc();
...
SDL_Surface *screen = SDL_SetVideoMode(width,height, 0, 0);
SDL_Overlay *bmp = SDL_CreateYUVOverlay(width,height, SDL_YV12_OVERLAY, screen);
if(av_frame_make_writable(frame) < 0)
exit(1);
SDL_LockYUVOverlay(bmp);
memcpy(frame->data[0], bmp->pixels[0], bmp->pitches[0]);
memcpy(frame->data[1], bmp->pixels[1], bmp->pitches[1]);
memcpy(frame->data[2], bmp->pixels[2], bmp->pitches[2]);
SDL_UnlockYUVOverlay(bmp);
The problem is that SDL2
does not support SDL_Overlay
. The alternative methods are good for playing a video not capturing it. How should I modify this code to replace SDL_Overlay
and make it suitable for SDL2
?