Just a fix for compiling vba-m against newer ffmpeg

This commit is contained in:
11doctorwhocanada 2015-03-23 21:32:16 -05:00
parent 216e181740
commit 69c41f2c49
1 changed files with 13 additions and 0 deletions

View File

@ -178,17 +178,30 @@ MediaRet MediaRecorder::setup_video_stream(const char *fname, int w, int h, int
// make sure RGB is supported (mostly not)
if(codec->pix_fmts) {
const enum PixelFormat *p;
#if LIBAVCODEC_VERSION_MAJOR < 55
int64_t mask = 0;
#endif
for(p = codec->pix_fmts; *p != -1; p++) {
// may get complaints about 1LL; thus the cast
#if LIBAVCODEC_VERSION_MAJOR < 55
mask |= ((int64_t)1) << *p;
#endif
if(*p == pixfmt)
break;
}
if(*p == -1) {
// if not supported, use a converter to the next best format
// this is swscale, the converter used by the output demo
#if LIBAVCODEC_VERSION_MAJOR < 55
enum PixelFormat dp = (PixelFormat)avcodec_find_best_pix_fmt(mask, pixfmt, 0, NULL);
#if LIBAVCODEC_VERSION_MICRO >= 100
// FFmpeg
enum AVPixelFormat dp = avcodec_find_best_pix_fmt_of_list(codec->pix_fmts, pixfmt, 0, NULL);
#else
// Libav
enum AVPixelFormat dp = avcodec_find_best_pix_fmt2(codec->pix_fmts, pixfmt, 0, NULL);
#endif
#endif
if(dp == -1)
dp = codec->pix_fmts[0];
if(!(convpic = avcodec_alloc_frame()) ||