summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2015-09-02 23:31:01 +0200
committerwm4 <wm4@nowhere>2015-09-02 23:33:13 +0200
commit61b902f5a7e8dc273b6d680c19af65f362d2233f (patch)
treebe9267000b9f893d51c966e6328e25886878c249
parent11f44a10f977c076411a64c818fcd52de9b9c118 (diff)
downloadmpv-61b902f5a7e8dc273b6d680c19af65f362d2233f.tar.bz2
mpv-61b902f5a7e8dc273b6d680c19af65f362d2233f.tar.xz
vd_lavc: better hwdec log output
Often, we don't know whether hardware decoding will work until we've tried. (This used to be different, but API changes and improvements in libavcodec led to this situation.) We will often output that we're going to use hardware decoding, and then print a fallback warning. Instead, print the status once we have decoded a frame. Some of the old messages are turned into verbose messages, which should be helpful for debugging. Also add some new ones.
-rw-r--r--video/decode/lavc.h1
-rw-r--r--video/decode/vd_lavc.c20
2 files changed, 17 insertions, 4 deletions
diff --git a/video/decode/lavc.h b/video/decode/lavc.h
index 590697d056..90b2d6a886 100644
--- a/video/decode/lavc.h
+++ b/video/decode/lavc.h
@@ -20,6 +20,7 @@ typedef struct lavc_ctx {
enum AVDiscard skip_frame;
const char *software_fallback_decoder;
bool hwdec_failed;
+ bool hwdec_notified;
// From VO
struct mp_hwdec_info *hwdec_info;
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index d598cfe898..d9974e2531 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -243,6 +243,7 @@ static struct vd_lavc_hwdec *probe_hwdec(struct dec_video *vd, bool autoprobe,
enum hwdec_type api,
const char *decoder)
{
+ MP_VERBOSE(vd, "Probing '%s'...\n", m_opt_choice_str(mp_hwdec_names, api));
struct vd_lavc_hwdec *hwdec = find_hwcodec(api);
if (!hwdec) {
MP_VERBOSE(vd, "Requested hardware decoder not compiled.\n");
@@ -281,7 +282,8 @@ static bool force_fallback(struct dec_video *vd)
return false;
uninit_avctx(vd);
- MP_WARN(vd, "Falling back to software decoding.\n");
+ int lev = ctx->hwdec_notified ? MSGL_WARN : MSGL_V;
+ mp_msg(vd->log, lev, "Falling back to software decoding.\n");
const char *decoder = ctx->software_fallback_decoder;
ctx->software_fallback_decoder = NULL;
init_avctx(vd, decoder, NULL);
@@ -328,9 +330,9 @@ static int init(struct dec_video *vd, const char *decoder)
ctx->software_fallback_decoder = talloc_strdup(ctx, decoder);
if (hwdec->get_codec)
decoder = hwdec->get_codec(ctx);
- MP_INFO(vd, "Using hardware decoding.\n");
- } else if (vd->opts->hwdec_api != HWDEC_NONE) {
- MP_INFO(vd, "Using software decoding.\n");
+ MP_VERBOSE(vd, "Trying hardware decoding.\n");
+ } else {
+ MP_VERBOSE(vd, "Using software decoding.\n");
}
init_avctx(vd, decoder, hwdec);
@@ -678,6 +680,16 @@ static struct mp_image *decode_with_fallback(struct dec_video *vd,
decode(vd, packet, flags, &mpi);
}
+ if (mpi && !ctx->hwdec_notified && vd->opts->hwdec_api != HWDEC_NONE) {
+ if (ctx->hwdec) {
+ MP_INFO(vd, "Using hardware decoding (%s).\n",
+ m_opt_choice_str(mp_hwdec_names, ctx->hwdec->type));
+ } else {
+ MP_INFO(vd, "Using software decoding.\n");
+ }
+ ctx->hwdec_notified = true;
+ }
+
return mpi;
}