From b5fd9bc068d17e3460e3d556ce2db2549bd5c7c3 Mon Sep 17 00:00:00 2001 From: "benjamin.drung@gmail.com" Date: Thu, 29 May 2014 21:04:45 +0000 Subject: [PATCH] FFmpeg: Add support for libav 0.8. Thanks to Michael Niedermayer for the tips. --- src/FFmpeg.h | 6 ++++++ src/export/ExportFFmpeg.cpp | 2 ++ 2 files changed, 8 insertions(+) diff --git a/src/FFmpeg.h b/src/FFmpeg.h index 6fd9ebec7..4a33ef4a2 100644 --- a/src/FFmpeg.h +++ b/src/FFmpeg.h @@ -110,6 +110,12 @@ extern "C" { #define AV_CODEC_ID_WMAV2 CODEC_ID_WMAV2 #define AV_CODEC_ID_WMAVOICE CODEC_ID_WMAVOICE #endif + + #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(54, 8, 100) + inline bool av_codec_is_encoder(AVCodec *codec) { + return codec != NULL && (codec->encode != NULL || codec->encode2 != NULL); + } + #endif } #endif diff --git a/src/export/ExportFFmpeg.cpp b/src/export/ExportFFmpeg.cpp index 9b2ec5ba9..04fa520af 100644 --- a/src/export/ExportFFmpeg.cpp +++ b/src/export/ExportFFmpeg.cpp @@ -538,7 +538,9 @@ static int encode_audio(AVCodecContext *avctx, AVPacket *pkt, int16_t *audio_sam frame->nb_samples = nb_samples; frame->format = avctx->sample_fmt; +#if !defined(DISABLE_DYNAMIC_LOADING_FFMPEG) || (LIBAVCODEC_VERSION_INT >= AV_VERSION_INT(54, 13, 0)) frame->channel_layout = avctx->channel_layout; +#endif buffer_size = av_samples_get_buffer_size(NULL, avctx->channels, frame->nb_samples, avctx->sample_fmt, 0);