diff options
Diffstat (limited to 'video/decode/vdpau.c')
-rw-r--r-- | video/decode/vdpau.c | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/video/decode/vdpau.c b/video/decode/vdpau.c index 2aba10c13b..0003182dcb 100644 --- a/video/decode/vdpau.c +++ b/video/decode/vdpau.c @@ -61,6 +61,17 @@ static struct mp_image *allocate_image(struct lavc_ctx *ctx, int w, int h) return mp_vdpau_get_video_surface(p->mpvdp, chroma, s_w, s_h); } +static struct mp_image *update_format(struct lavc_ctx *ctx, struct mp_image *img) +{ + VdpChromaType chroma = 0; + uint32_t s_w, s_h; + if (av_vdpau_get_surface_parameters(ctx->avctx, &chroma, &s_w, &s_h) >= 0) { + if (chroma == VDP_CHROMA_TYPE_420) + img->params.hw_subfmt = IMGFMT_NV12; + } + return img; +} + static void uninit(struct lavc_ctx *ctx) { struct priv *p = ctx->hwdec_priv; @@ -99,4 +110,5 @@ const struct vd_lavc_hwdec mp_vd_lavc_vdpau = { .uninit = uninit, .init_decoder = init_decoder, .allocate_image = allocate_image, + .process_image = update_format, }; |