1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-02 17:09:26 +02:00

Drop compatibility for libav/FFmpeg < 0.7.

This commit is contained in:
benjamin.drung@gmail.com 2014-05-25 21:08:58 +00:00
parent 31f66d9cfa
commit 0a1999130d
5 changed files with 8 additions and 27 deletions

View File

@ -41,25 +41,6 @@ extern "C" {
#include <libavutil/fifo.h> #include <libavutil/fifo.h>
#include <libavutil/mathematics.h> #include <libavutil/mathematics.h>
#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) #if LIBAVCODEC_VERSION_INT < AV_VERSION_INT(55, 45, 101)
#define av_frame_alloc avcodec_alloc_frame #define av_frame_alloc avcodec_alloc_frame
#define av_frame_free avcodec_free_frame #define av_frame_free avcodec_free_frame

View File

@ -357,7 +357,7 @@ bool ExportFFmpeg::InitCodecs(AudacityProject *project)
mEncAudioCodecCtx = mEncAudioStream->codec; mEncAudioCodecCtx = mEncAudioStream->codec;
mEncAudioCodecCtx->codec_id = ExportFFmpegOptions::fmts[mSubFormat].codecid; 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); mEncAudioCodecCtx->codec_tag = av_codec_get_tag((const AVCodecTag **)mEncFormatCtx->oformat->codec_tag,mEncAudioCodecCtx->codec_id);
mSampleRate = (int)project->GetRate(); mSampleRate = (int)project->GetRate();
mEncAudioCodecCtx->global_quality = -99999; //quality mode is off by default; mEncAudioCodecCtx->global_quality = -99999; //quality mode is off by default;

View File

@ -1298,7 +1298,7 @@ void ExportFFmpegOptions::FetchCodecList()
while ((codec = av_codec_next(codec))) while ((codec = av_codec_next(codec)))
{ {
// We're only interested in audio and only in encoders // 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)); mCodecNames.Add(wxString::FromUTF8(codec->name));
mCodecLongNames.Add(wxString::Format(wxT("%s - %s"),mCodecNames.Last().c_str(),wxString::FromUTF8(codec->long_name).c_str())); 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 // Find the codec, that is claimed to be compatible
AVCodec *codec = avcodec_find_encoder(CompatibilityList[i].codec); AVCodec *codec = avcodec_find_encoder(CompatibilityList[i].codec);
// If it exists, is audio and has encoder // 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 it was selected - remember it's new index
if ((id >= 0) && codec->id == id) index = mShownCodecNames.GetCount(); if ((id >= 0) && codec->id == id) index = mShownCodecNames.GetCount();
@ -1558,7 +1558,7 @@ int ExportFFmpegOptions::FetchCompatibleCodecList(const wxChar *fmt, AVCodecID i
AVCodec *codec = NULL; AVCodec *codec = NULL;
while ((codec = av_codec_next(codec))) 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) if (mShownCodecNames.Index(wxString::FromUTF8(codec->name)) < 0)
{ {
@ -1578,7 +1578,7 @@ int ExportFFmpegOptions::FetchCompatibleCodecList(const wxChar *fmt, AVCodecID i
if (format != NULL) if (format != NULL)
{ {
AVCodec *codec = avcodec_find_encoder(format->audio_codec); 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(); if ((id >= 0) && codec->id == id) index = mShownCodecNames.GetCount();
mShownCodecNames.Add(wxString::FromUTF8(codec->name)); mShownCodecNames.Add(wxString::FromUTF8(codec->name));

View File

@ -392,7 +392,7 @@ bool FFmpegImportFileHandle::InitCodecs()
// Fill the stream contexts // Fill the stream contexts
for (unsigned int i = 0; i < mFormatContext->nb_streams; i++) 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 //Create a context
streamContext *sc = new streamContext; streamContext *sc = new streamContext;

View File

@ -44,7 +44,7 @@ typedef struct _FFmpegDecodeCache
sampleCount start; sampleCount start;
sampleCount len; sampleCount len;
int numChannels; int numChannels;
SampleFormat samplefmt; // input (from libav) sample format AVSampleFormat samplefmt; // input (from libav) sample format
} FFMpegDecodeCache; } FFMpegDecodeCache;
@ -167,7 +167,7 @@ bool ODFFmpegDecoder::SeekingAllowed()
//test the audio stream(s) //test the audio stream(s)
for (unsigned int i = 0; i < ic->nb_streams; i++) 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; audioStreamExists = true;
st = ic->streams[i]; st = ic->streams[i];