mirror of
https://github.com/mpv-player/mpv
synced 2024-12-27 09:32:40 +00:00
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.
This commit is contained in:
parent
3db3653227
commit
8fbf0300d8
@ -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 {
|
||||
|
@ -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)
|
||||
|
Loading…
Reference in New Issue
Block a user