From a7a51a11373f74f2e42f2c46441a34c993113dcc Mon Sep 17 00:00:00 2001 From: Vicki Pfau Date: Wed, 17 Jan 2018 22:53:26 -0800 Subject: [PATCH] FFmpeg: Fix build with newer lavc (fixes #966) --- src/feature/ffmpeg/ffmpeg-encoder.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/feature/ffmpeg/ffmpeg-encoder.c b/src/feature/ffmpeg/ffmpeg-encoder.c index a7a206788..2da3754f8 100644 --- a/src/feature/ffmpeg/ffmpeg-encoder.c +++ b/src/feature/ffmpeg/ffmpeg-encoder.c @@ -229,7 +229,11 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) { AVDictionary* opts = 0; av_dict_set(&opts, "strict", "-2", 0); if (encoder->context->oformat->flags & AVFMT_GLOBALHEADER) { +#ifdef AV_CODEC_FLAG_GLOBAL_HEADER + encoder->audio->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; +#else encoder->audio->flags |= CODEC_FLAG_GLOBAL_HEADER; +#endif } avcodec_open2(encoder->audio, acodec, &opts); av_dict_free(&opts); @@ -291,7 +295,11 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) { encoder->video->gop_size = 60; encoder->video->max_b_frames = 3; if (encoder->context->oformat->flags & AVFMT_GLOBALHEADER) { +#ifdef AV_CODEC_FLAG_GLOBAL_HEADER + encoder->video->flags |= AV_CODEC_FLAG_GLOBAL_HEADER; +#else encoder->video->flags |= CODEC_FLAG_GLOBAL_HEADER; +#endif } if (strcmp(vcodec->name, "libx264") == 0) { // Try to adaptively figure out when you can use a slower encoder