summaryrefslogtreecommitdiffstats
path: root/video/decode/vd_lavc.c
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2016-04-07 17:48:00 +0200
committerwm4 <wm4@nowhere>2016-04-07 17:48:00 +0200
commitf009d16f362694b6f49571b76f8b0331966824b5 (patch)
tree92851b786b11c32c0345cc1a803d58cc535a6219 /video/decode/vd_lavc.c
parent32a92071b4cc58967d51a5e3ce1c3bed219d9111 (diff)
downloadmpv-f009d16f362694b6f49571b76f8b0331966824b5.tar.bz2
mpv-f009d16f362694b6f49571b76f8b0331966824b5.tar.xz
vd_lavc: fix codec vs. decoder confusion
Some functions which expected a codec name (i.e. the name of the video format itself) were passed a decoder name. Most "native" libavcodec decoders have the same name as the codec, so this was never an issue. This should mean that e.g. using "--vd=lavc:h264_mmal --hwdec=mmal" should now actually enable native surface mode (instead of doing copy- back).
Diffstat (limited to 'video/decode/vd_lavc.c')
-rw-r--r--video/decode/vd_lavc.c27
1 files changed, 14 insertions, 13 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 677d406989..175df0bc6e 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -214,12 +214,12 @@ const struct hwdec_profile_entry *hwdec_find_profile(
}
// Check codec support, without checking the profile.
-bool hwdec_check_codec_support(const char *decoder,
+bool hwdec_check_codec_support(const char *codec,
const struct hwdec_profile_entry *table)
{
- enum AVCodecID codec = mp_codec_to_av_codec_id(decoder);
+ enum AVCodecID codecid = mp_codec_to_av_codec_id(codec);
for (int n = 0; table[n].av_codec; n++) {
- if (table[n].av_codec == codec)
+ if (table[n].av_codec == codecid)
return true;
}
return false;
@@ -240,17 +240,17 @@ void hwdec_request_api(struct mp_hwdec_info *info, const char *api_name)
}
static int hwdec_probe(struct vd_lavc_hwdec *hwdec, struct mp_hwdec_info *info,
- const char *decoder)
+ const char *codec)
{
int r = 0;
if (hwdec->probe)
- r = hwdec->probe(hwdec, info, decoder);
+ r = hwdec->probe(hwdec, info, codec);
return r;
}
static struct vd_lavc_hwdec *probe_hwdec(struct dec_video *vd, bool autoprobe,
enum hwdec_type api,
- const char *decoder)
+ const char *codec)
{
MP_VERBOSE(vd, "Probing '%s'...\n", m_opt_choice_str(mp_hwdec_names, api));
struct vd_lavc_hwdec *hwdec = find_hwcodec(api);
@@ -258,7 +258,7 @@ static struct vd_lavc_hwdec *probe_hwdec(struct dec_video *vd, bool autoprobe,
MP_VERBOSE(vd, "Requested hardware decoder not compiled.\n");
return NULL;
}
- int r = hwdec_probe(hwdec, vd->hwdec_info, decoder);
+ int r = hwdec_probe(hwdec, vd->hwdec_info, codec);
if (r == HWDEC_ERR_EMULATED) {
if (autoprobe)
return NULL;
@@ -269,8 +269,8 @@ static struct vd_lavc_hwdec *probe_hwdec(struct dec_video *vd, bool autoprobe,
if (r >= 0) {
return hwdec;
} else if (r == HWDEC_ERR_NO_CODEC) {
- MP_VERBOSE(vd, "Hardware decoder '%s' not found in libavcodec.\n",
- decoder);
+ MP_VERBOSE(vd, "Hardware decoder for '%s' with the given API not found "
+ "in libavcodec.\n", codec);
} else if (r == HWDEC_ERR_NO_CTX && !autoprobe) {
MP_WARN(vd, "VO does not support requested hardware decoder, or "
"loading it failed.\n");
@@ -301,25 +301,26 @@ static void reinit(struct dec_video *vd)
{
vd_ffmpeg_ctx *ctx = vd->priv;
const char *decoder = ctx->decoder;
+ const char *codec = vd->codec->codec;
uninit_avctx(vd);
struct vd_lavc_hwdec *hwdec = NULL;
- if (hwdec_codec_allowed(vd, decoder)) {
+ if (hwdec_codec_allowed(vd, codec)) {
if (vd->opts->hwdec_api == HWDEC_AUTO) {
for (int n = 0; hwdec_list[n]; n++) {
- hwdec = probe_hwdec(vd, true, hwdec_list[n]->type, decoder);
+ hwdec = probe_hwdec(vd, true, hwdec_list[n]->type, codec);
if (hwdec)
break;
}
} else if (vd->opts->hwdec_api != HWDEC_NONE) {
- hwdec = probe_hwdec(vd, false, vd->opts->hwdec_api, decoder);
+ hwdec = probe_hwdec(vd, false, vd->opts->hwdec_api, codec);
}
} else {
MP_VERBOSE(vd, "Not trying to use hardware decoding: codec %s is not "
"on whitelist, or does not support hardware acceleration.\n",
- decoder);
+ codec);
}
if (hwdec) {