summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2017-03-01 16:02:08 +0100
committerwm4 <wm4@nowhere>2017-03-01 16:02:08 +0100
commitee9c850a00acdae06d8fe904c382182fc049a0a0 (patch)
treec071afa9d8c144d60a26e58c46e6d18f2038b229 /video
parent97403839e5e8ac90e3b8cbff3014428edc1f45c9 (diff)
downloadmpv-ee9c850a00acdae06d8fe904c382182fc049a0a0.tar.bz2
mpv-ee9c850a00acdae06d8fe904c382182fc049a0a0.tar.xz
vd_lavc: log pixel format requested from decoder
I find it slightly helpful in some situations. Also change the code to have a single exit path to make this easier.
Diffstat (limited to 'video')
-rw-r--r--video/decode/vd_lavc.c26
1 files changed, 18 insertions, 8 deletions
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 8faf2dc71d..a7b05c8a35 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -821,12 +821,14 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx,
ctx->hwdec_request_reinit |= ctx->hwdec_failed;
ctx->hwdec_failed = false;
+ enum AVPixelFormat select = AV_PIX_FMT_NONE;
for (int i = 0; fmt[i] != AV_PIX_FMT_NONE; i++) {
if (ctx->hwdec->image_format == pixfmt2imgfmt(fmt[i])) {
if (ctx->hwdec->generic_hwaccel) {
if (init_generic_hwaccel(vd) < 0)
break;
- return fmt[i];
+ select = fmt[i];
+ break;
}
// There could be more reasons for a change, and it's possible
// that we miss some. (Might also depend on the hwaccel type.)
@@ -849,17 +851,25 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx,
break;
}
}
- return fmt[i];
+ select = fmt[i];
+ break;
}
}
- ctx->hwdec_failed = true;
- for (int i = 0; fmt[i] != AV_PIX_FMT_NONE; i++) {
- const AVPixFmtDescriptor *d = av_pix_fmt_desc_get(fmt[i]);
- if (d && !(d->flags & AV_PIX_FMT_FLAG_HWACCEL))
- return fmt[i];
+ if (select == AV_PIX_FMT_NONE) {
+ ctx->hwdec_failed = true;
+ for (int i = 0; fmt[i] != AV_PIX_FMT_NONE; i++) {
+ const AVPixFmtDescriptor *d = av_pix_fmt_desc_get(fmt[i]);
+ if (d && !(d->flags & AV_PIX_FMT_FLAG_HWACCEL)) {
+ select = fmt[i];
+ break;
+ }
+ }
}
- return AV_PIX_FMT_NONE;
+
+ const char *name = av_get_pix_fmt_name(select);
+ MP_VERBOSE(vd, "Requesting pixfmt '%s' from decoder.\n", name ? name : "-");
+ return select;
}
static int get_buffer2_hwdec(AVCodecContext *avctx, AVFrame *pic, int flags)