mirror of
https://github.com/mpv-player/mpv
synced 2024-12-19 05:15:12 +00:00
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.
This commit is contained in:
parent
11f44a10f9
commit
61b902f5a7
@ -20,6 +20,7 @@ typedef struct lavc_ctx {
|
|||||||
enum AVDiscard skip_frame;
|
enum AVDiscard skip_frame;
|
||||||
const char *software_fallback_decoder;
|
const char *software_fallback_decoder;
|
||||||
bool hwdec_failed;
|
bool hwdec_failed;
|
||||||
|
bool hwdec_notified;
|
||||||
|
|
||||||
// From VO
|
// From VO
|
||||||
struct mp_hwdec_info *hwdec_info;
|
struct mp_hwdec_info *hwdec_info;
|
||||||
|
@ -243,6 +243,7 @@ static struct vd_lavc_hwdec *probe_hwdec(struct dec_video *vd, bool autoprobe,
|
|||||||
enum hwdec_type api,
|
enum hwdec_type api,
|
||||||
const char *decoder)
|
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);
|
struct vd_lavc_hwdec *hwdec = find_hwcodec(api);
|
||||||
if (!hwdec) {
|
if (!hwdec) {
|
||||||
MP_VERBOSE(vd, "Requested hardware decoder not compiled.\n");
|
MP_VERBOSE(vd, "Requested hardware decoder not compiled.\n");
|
||||||
@ -281,7 +282,8 @@ static bool force_fallback(struct dec_video *vd)
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
uninit_avctx(vd);
|
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;
|
const char *decoder = ctx->software_fallback_decoder;
|
||||||
ctx->software_fallback_decoder = NULL;
|
ctx->software_fallback_decoder = NULL;
|
||||||
init_avctx(vd, 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);
|
ctx->software_fallback_decoder = talloc_strdup(ctx, decoder);
|
||||||
if (hwdec->get_codec)
|
if (hwdec->get_codec)
|
||||||
decoder = hwdec->get_codec(ctx);
|
decoder = hwdec->get_codec(ctx);
|
||||||
MP_INFO(vd, "Using hardware decoding.\n");
|
MP_VERBOSE(vd, "Trying hardware decoding.\n");
|
||||||
} else if (vd->opts->hwdec_api != HWDEC_NONE) {
|
} else {
|
||||||
MP_INFO(vd, "Using software decoding.\n");
|
MP_VERBOSE(vd, "Using software decoding.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
init_avctx(vd, decoder, hwdec);
|
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);
|
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;
|
return mpi;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user