try to fix version check for avformat codecpar

This commit is contained in:
Jacek Jendrzej
2017-04-19 17:19:43 +02:00
parent f6482eb042
commit a3bf23d9c9
3 changed files with 9 additions and 9 deletions

View File

@@ -223,7 +223,7 @@ CBaseDec::RetCode CFfmpegDec::Decoder(FILE *_in, int /*OutputFd*/, State* state,
Status=DATA_ERR;
return Status;
}
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
AVCodecContext *c = avc->streams[best_stream]->codec;
#else
AVCodecContext *c = avcodec_alloc_context3(codec);
@@ -460,7 +460,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
if (!is_stream) {
GetMeta(avc->metadata);
for(unsigned int i = 0; i < avc->nb_streams; i++) {
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
if (avc->streams[i]->codec->codec_type == AVMEDIA_TYPE_AUDIO)
#else
if (avc->streams[i]->codecpar->codec_type == AVMEDIA_TYPE_AUDIO)
@@ -481,7 +481,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
DeInit();
return false;
}
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
if (!codec)
codec = avcodec_find_decoder(avc->streams[best_stream]->codec->codec_id);
samplerate = avc->streams[best_stream]->codec->sample_rate;
@@ -511,7 +511,7 @@ bool CFfmpegDec::SetMetaData(FILE *_in, CAudioMetaData* m, bool save_cover)
printf("CFfmpegDec: format %s (%s) duration %ld\n", avc->iformat->name, type_info.c_str(), total_time);
for(unsigned int i = 0; i < avc->nb_streams; i++) {
#if (LIBAVCODEC_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
#if (LIBAVFORMAT_VERSION_INT < AV_VERSION_INT( 57,5,0 ))
if (avc->streams[i]->codec->bit_rate > 0)
bitrate += avc->streams[i]->codec->bit_rate;
#else