From 398e2d5d4278f89601cac0e031d3535cfc610df0 Mon Sep 17 00:00:00 2001 From: wm4 Date: Wed, 18 Jan 2017 08:13:28 +0100 Subject: vaapi: fix va_surface_get_uncropped_size() for libavutil surfaces Fixes vf_vavpp crashing with the new vaapi decode API. --- video/vaapi.c | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/video/vaapi.c b/video/vaapi.c index 6386660c8c..6b3dac4b30 100644 --- a/video/vaapi.c +++ b/video/vaapi.c @@ -296,9 +296,15 @@ int va_surface_rt_format(struct mp_image *mpi) // padded surfaces for example.) void va_surface_get_uncropped_size(struct mp_image *mpi, int *out_w, int *out_h) { - struct va_surface *s = va_surface_in_mp_image(mpi); - *out_w = s ? s->w : 0; - *out_h = s ? s->h : 0; + if (mpi->hwctx) { + AVHWFramesContext *fctx = (void *)mpi->hwctx->data; + *out_w = fctx->width; + *out_h = fctx->height; + } else { + struct va_surface *s = va_surface_in_mp_image(mpi); + *out_w = s ? s->w : 0; + *out_h = s ? s->h : 0; + } } static void release_va_surface(void *arg) -- cgit v1.2.3