summaryrefslogtreecommitdiffstats
path: root/video
diff options
context:
space:
mode:
authorwm4 <wm4@nowhere>2014-03-17 18:19:03 +0100
committerwm4 <wm4@nowhere>2014-03-17 18:19:03 +0100
commit8fbf0300d8248400e1c21784c3abe931f553383b (patch)
treedc92128e9a112cd3c57952c5f4c4dc657e3fcd84 /video
parent3db365322737b50e9e1437ff93e1631f71f811bb (diff)
downloadmpv-8fbf0300d8248400e1c21784c3abe931f553383b.tar.bz2
mpv-8fbf0300d8248400e1c21784c3abe931f553383b.tar.xz
vd_lavc: reinit hwdec on profile changes
Needed in theory. I don't know if there are even any real-world files which change the profile mid-stream.
Diffstat (limited to 'video')
-rw-r--r--video/decode/lavc.h1
-rw-r--r--video/decode/vd_lavc.c7
2 files changed, 6 insertions, 2 deletions
diff --git a/video/decode/lavc.h b/video/decode/lavc.h
index 35c66fc19b..16d3251725 100644
--- a/video/decode/lavc.h
+++ b/video/decode/lavc.h
@@ -40,6 +40,7 @@ typedef struct lavc_ctx {
int hwdec_fmt;
int hwdec_w;
int hwdec_h;
+ int hwdec_profile;
} vd_ffmpeg_ctx;
struct vd_lavc_hwdec {
diff --git a/video/decode/vd_lavc.c b/video/decode/vd_lavc.c
index 632d5cacd7..969c78f54c 100644
--- a/video/decode/vd_lavc.c
+++ b/video/decode/vd_lavc.c
@@ -463,14 +463,17 @@ static enum AVPixelFormat get_format_hwdec(struct AVCodecContext *avctx,
if (ctx->hwdec->image_format) {
for (int i = 0; fmt[i] != AV_PIX_FMT_NONE; i++) {
if (ctx->hwdec->image_format == pixfmt2imgfmt(fmt[i])) {
- // There could be more reasons for a change, e.g. profile change.
+ // There could be more reasons for a change, and it's possible
+ // that we miss some. (Might also depend on the hwaccel type.)
bool change =
ctx->hwdec_w != avctx->width ||
ctx->hwdec_h != avctx->height ||
- ctx->hwdec_fmt != ctx->hwdec->image_format;
+ ctx->hwdec_fmt != ctx->hwdec->image_format ||
+ ctx->hwdec_profile != avctx->profile;
ctx->hwdec_w = avctx->width;
ctx->hwdec_h = avctx->height;
ctx->hwdec_fmt = ctx->hwdec->image_format;
+ ctx->hwdec_profile = avctx->profile;
if (ctx->hwdec->init_decoder && change) {
if (ctx->hwdec->init_decoder(ctx, ctx->hwdec_fmt,
ctx->hwdec_w, ctx->hwdec_h) < 0)