From 0a1999130de1c26e8cb1eb065a41ab647fb8cdb7 Mon Sep 17 00:00:00 2001 From: "benjamin.drung@gmail.com" Date: Sun, 25 May 2014 21:08:58 +0000 Subject: [PATCH] Drop compatibility for libav/FFmpeg < 0.7. --- src/FFmpeg.h | 19 ------------------- src/export/ExportFFmpeg.cpp | 2 +- src/export/ExportFFmpegDialogs.cpp | 8 ++++---- src/import/ImportFFmpeg.cpp | 2 +- src/ondemand/ODDecodeFFmpegTask.cpp | 4 ++-- 5 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/FFmpeg.h b/src/FFmpeg.h index 96426940c..f295615f4 100644 --- a/src/FFmpeg.h +++ b/src/FFmpeg.h @@ -41,25 +41,6 @@ extern "C" { #include #include - #if LIBAVFORMAT_VERSION_INT < AV_VERSION_INT(52, 102, 0) - #define AVIOContext ByteIOContext - #endif - - #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(52, 94, 1) - #define AVSampleFormat SampleFormat - #endif - - #if LIBAVCODEC_VERSION_INT > AV_VERSION_INT(52, 120, 0) - #define CodecType AVMediaType - #define CODEC_TYPE_UNKNOWN AVMEDIA_TYPE_UNKNOWN - #define CODEC_TYPE_VIDEO AVMEDIA_TYPE_VIDEO - #define CODEC_TYPE_AUDIO AVMEDIA_TYPE_AUDIO - #define CODEC_TYPE_DATA AVMEDIA_TYPE_DATA - #define CODEC_TYPE_SUBTITLE AVMEDIA_TYPE_SUBTITLE - #define CODEC_TYPE_ATTACHMENT AVMEDIA_TYPE_ATTACHMENT - #define CODEC_TYPE_NB AVMEDIA_TYPE_NB - #endif - #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 45, 101) #define av_frame_alloc avcodec_alloc_frame #define av_frame_free avcodec_free_frame diff --git a/src/export/ExportFFmpeg.cpp b/src/export/ExportFFmpeg.cpp index 089f4bc89..8d22536e5 100644 --- a/src/export/ExportFFmpeg.cpp +++ b/src/export/ExportFFmpeg.cpp @@ -357,7 +357,7 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project) mEncAudioCodecCtx = mEncAudioStream->codec; mEncAudioCodecCtx->codec_id = ExportFFmpegOptions::fmts[mSubFormat].codecid; - mEncAudioCodecCtx->codec_type = CODEC_TYPE_AUDIO; + mEncAudioCodecCtx->codec_type = AVMEDIA_TYPE_AUDIO; mEncAudioCodecCtx->codec_tag = av_codec_get_tag((const AVCodecTag **)mEncFormatCtx->oformat->codec_tag,mEncAudioCodecCtx->codec_id); mSampleRate = (int)project->GetRate(); mEncAudioCodecCtx->global_quality = -99999; //quality mode is off by default; diff --git a/src/export/ExportFFmpegDialogs.cpp b/src/export/ExportFFmpegDialogs.cpp index 0c8024d48..2ebda99b7 100644 --- a/src/export/ExportFFmpegDialogs.cpp +++ b/src/export/ExportFFmpegDialogs.cpp @@ -1298,7 +1298,7 @@ void ExportFFmpegOptions::FetchCodecList() while ((codec = av_codec_next(codec))) { // We're only interested in audio and only in encoders - if (codec->type == CODEC_TYPE_AUDIO && av_codec_is_encoder(codec)) + if (codec->type == AVMEDIA_TYPE_AUDIO && av_codec_is_encoder(codec)) { mCodecNames.Add(wxString::FromUTF8(codec->name)); mCodecLongNames.Add(wxString::Format(wxT("%s - %s"),mCodecNames.Last().c_str(),wxString::FromUTF8(codec->long_name).c_str())); @@ -1543,7 +1543,7 @@ int ExportFFmpegOptions::FetchCompatibleCodecList(const wxChar *fmt, AVCodecID i // Find the codec, that is claimed to be compatible AVCodec *codec = avcodec_find_encoder(CompatibilityList[i].codec); // If it exists, is audio and has encoder - if (codec != NULL && (codec->type == CODEC_TYPE_AUDIO) && av_codec_is_encoder(codec)) + if (codec != NULL && (codec->type == AVMEDIA_TYPE_AUDIO) && av_codec_is_encoder(codec)) { // If it was selected - remember it's new index if ((id >= 0) && codec->id == id) index = mShownCodecNames.GetCount(); @@ -1558,7 +1558,7 @@ int ExportFFmpegOptions::FetchCompatibleCodecList(const wxChar *fmt, AVCodecID i AVCodec *codec = NULL; while ((codec = av_codec_next(codec))) { - if (codec->type == CODEC_TYPE_AUDIO && av_codec_is_encoder(codec)) + if (codec->type == AVMEDIA_TYPE_AUDIO && av_codec_is_encoder(codec)) { if (mShownCodecNames.Index(wxString::FromUTF8(codec->name)) < 0) { @@ -1578,7 +1578,7 @@ int ExportFFmpegOptions::FetchCompatibleCodecList(const wxChar *fmt, AVCodecID i if (format != NULL) { AVCodec *codec = avcodec_find_encoder(format->audio_codec); - if (codec != NULL && (codec->type == CODEC_TYPE_AUDIO) && av_codec_is_encoder(codec)) + if (codec != NULL && (codec->type == AVMEDIA_TYPE_AUDIO) && av_codec_is_encoder(codec)) { if ((id >= 0) && codec->id == id) index = mShownCodecNames.GetCount(); mShownCodecNames.Add(wxString::FromUTF8(codec->name)); diff --git a/src/import/ImportFFmpeg.cpp b/src/import/ImportFFmpeg.cpp index a737c9955..2a96945be 100644 --- a/src/import/ImportFFmpeg.cpp +++ b/src/import/ImportFFmpeg.cpp @@ -392,7 +392,7 @@ bool FFmpegImportFileHandle::InitCodecs() // Fill the stream contexts for (unsigned int i = 0; i < mFormatContext->nb_streams; i++) { - if (mFormatContext->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) + if (mFormatContext->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { //Create a context streamContext *sc = new streamContext; diff --git a/src/ondemand/ODDecodeFFmpegTask.cpp b/src/ondemand/ODDecodeFFmpegTask.cpp index 2e63afb25..e6197918c 100644 --- a/src/ondemand/ODDecodeFFmpegTask.cpp +++ b/src/ondemand/ODDecodeFFmpegTask.cpp @@ -44,7 +44,7 @@ typedef struct _FFmpegDecodeCache sampleCount start; sampleCount len; int numChannels; - SampleFormat samplefmt; // input (from libav) sample format + AVSampleFormat samplefmt; // input (from libav) sample format } FFMpegDecodeCache; @@ -167,7 +167,7 @@ bool ODFFmpegDecoder::SeekingAllowed() //test the audio stream(s) for (unsigned int i = 0; i < ic->nb_streams; i++) { - if (ic->streams[i]->codec->codec_type == CODEC_TYPE_AUDIO) + if (ic->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO) { audioStreamExists = true; st = ic->streams[i];