mirror of https://github.com/mgba-emu/mgba.git
FFmpeg: Fix build with newer lavc (fixes #966)
This commit is contained in:
parent
7f23c857ad
commit
a7a51a1137
|
@ -229,7 +229,11 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
|
||||||
AVDictionary* opts = 0;
|
AVDictionary* opts = 0;
|
||||||
av_dict_set(&opts, "strict", "-2", 0);
|
av_dict_set(&opts, "strict", "-2", 0);
|
||||||
if (encoder->context->oformat->flags & AVFMT_GLOBALHEADER) {
|
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;
|
encoder->audio->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
avcodec_open2(encoder->audio, acodec, &opts);
|
avcodec_open2(encoder->audio, acodec, &opts);
|
||||||
av_dict_free(&opts);
|
av_dict_free(&opts);
|
||||||
|
@ -291,7 +295,11 @@ bool FFmpegEncoderOpen(struct FFmpegEncoder* encoder, const char* outfile) {
|
||||||
encoder->video->gop_size = 60;
|
encoder->video->gop_size = 60;
|
||||||
encoder->video->max_b_frames = 3;
|
encoder->video->max_b_frames = 3;
|
||||||
if (encoder->context->oformat->flags & AVFMT_GLOBALHEADER) {
|
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;
|
encoder->video->flags |= CODEC_FLAG_GLOBAL_HEADER;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
if (strcmp(vcodec->name, "libx264") == 0) {
|
if (strcmp(vcodec->name, "libx264") == 0) {
|
||||||
// Try to adaptively figure out when you can use a slower encoder
|
// Try to adaptively figure out when you can use a slower encoder
|
||||||
|
|
Loading…
Reference in New Issue