所以我一直在尝试通过以下关于ffmpeg:
http://dranger.com/ffmpeg/tutorial02.html的教程
但是,当我尝试使用gcc编译时,我得到以下输出:
root:/Users/mbrodeur/Downloads/HACKATHON CONTENT/Tutorials-> gcc -o tutorial02 tutorial02.c -lavutil -lavformat -lavcodec -lz -lavutil -lm -lswscale -D_THREAD_SAFE -lSDL2 tutorial02.c: In function ‘main’: tutorial02.c:41: error: ‘SDL_Overlay’ undeclared (first use in this function) tutorial02.c:41: error: (Each undeclared identifier is reported only once tutorial02.c:41: error: for each function it appears in.) tutorial02.c:41: error: ‘bmp’ undeclared (first use in this function) tutorial02.c:98: warning: assignment makes pointer from integer without a cast tutorial02.c:110: error: ‘SDL_YV12_OVERLAY’ undeclared (first use in this function)
现在,我读到SDL_Overlay不再在SDL2中使用,所以在这里是问题.我一直在戳,但似乎找不到任何帮助.是否替代SDL_Overlay?有必要吗?
SDL_Overlay用于以下上下文:
SDL_Overlay *bmp; bmp = SDL_CreateYUVOverlay(pCodecCtx->width,pCodecCtx->height,SDL_YV12_OVERLAY,screen);
解决方法
尝试使用符合解码帧布局和平面度的YUV像素格式的
SDL_CreateTexture()
.
或者使用libswscale将ffmpeg的YUV缓冲区转换为RGB.
编辑:SDL2> = 2.0.1具有更新平面YUV纹理的SDL_UpdateYUVTexture()
,因此您不必再手动合并libav的缓冲区.