Fix build on older libavcodec versions

avcodec_profile_name() was added only a week ago or so.
This commit is contained in:
wm4 2016-01-08 17:19:04 +01:00
parent 8e87ddd7fe
commit 2a80680d95
3 changed files with 9 additions and 0 deletions

View File

@ -974,6 +974,7 @@ cat > $TMPC << EOF
#define HAVE_GPL3 1 #define HAVE_GPL3 1
#define HAVE_WIN32 0 #define HAVE_WIN32 0
#define HAVE_GL_DXINTEROP 0 #define HAVE_GL_DXINTEROP 0
#define HAVE_AVCODEC_PROFILE_NAME 1
#ifdef __OpenBSD__ #ifdef __OpenBSD__
#define DEFAULT_CDROM_DEVICE "/dev/rcd0c" #define DEFAULT_CDROM_DEVICE "/dev/rcd0c"

View File

@ -529,9 +529,11 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx,
MP_VERBOSE(vd, " %s", av_get_pix_fmt_name(fmt[i])); MP_VERBOSE(vd, " %s", av_get_pix_fmt_name(fmt[i]));
MP_VERBOSE(vd, "\n"); MP_VERBOSE(vd, "\n");
#if HAVE_AVCODEC_PROFILE_NAME
const char *profile = avcodec_profile_name(avctx->codec_id, avctx->profile); const char *profile = avcodec_profile_name(avctx->codec_id, avctx->profile);
MP_VERBOSE(vd, "Codec profile: %s (0x%x)\n", profile ? profile : "unknown", MP_VERBOSE(vd, "Codec profile: %s (0x%x)\n", profile ? profile : "unknown",
avctx->profile); avctx->profile);
#endif
assert(ctx->hwdec); assert(ctx->hwdec);

View File

@ -477,6 +477,12 @@ FFmpeg/Libav libraries. You need at least {0}. Aborting.".format(libav_versions_
'func': check_statement('libavcodec/avcodec.h', 'func': check_statement('libavcodec/avcodec.h',
'AVSubtitleRect r = {.linesize={0}}', 'AVSubtitleRect r = {.linesize={0}}',
use='libav'), use='libav'),
}, {
'name': 'avcodec-profile-name',
'desc': 'libavcodec avcodec_profile_name()',
'func': check_statement('libavcodec/avcodec.h',
'avcodec_profile_name(0,0)',
use='libav'),
}, },
] ]