libav: Fix codecpar version check

FFmpeg 3.0, as used on Ubuntu Yakkety, did not include the codecpar
changes, although it uses the same library major version. So refine the
libavformat version check to sort that out.
This commit is contained in:
Justin Maggard 2017-03-16 18:39:55 +00:00
parent 10ae45f53f
commit f76f060f72

View File

@ -57,6 +57,8 @@
#include <avformat.h>
#endif
#define USE_CODECPAR LIBAVFORMAT_VERSION_INT >= ((57<<16)+(50<<8)+100)
#ifndef FF_PROFILE_H264_BASELINE
#define FF_PROFILE_H264_BASELINE 66
#endif
@ -166,7 +168,7 @@ lav_get_interlaced(AVStream *s)
#endif
}
#if LIBAVCODEC_VERSION_MAJOR >= 57
#if USE_CODECPAR
#define lav_codec_id(s) s->codecpar->codec_id
#define lav_codec_type(s) s->codecpar->codec_type
#define lav_codec_tag(s) s->codecpar->codec_tag
@ -195,7 +197,7 @@ lav_get_interlaced(AVStream *s)
static inline uint8_t *
lav_codec_extradata(AVStream *s)
{
#if LIBAVCODEC_VERSION_MAJOR >= 57
#if USE_CODECPAR
if (!s->codecpar->extradata_size)
return NULL;
return s->codecpar->extradata;