1
0
mirror of https://github.com/cookiengineer/audacity synced 2025-08-01 16:39:30 +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/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)
#define av_frame_alloc avcodec_alloc_frame
#define av_frame_free avcodec_free_frame

View File

@ -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;

View File

@ -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));

View File

@ -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;

View File

@ -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];