diff options
author | wm4 <wm4@nowhere> | 2017-01-18 08:13:28 +0100 |
---|---|---|
committer | wm4 <wm4@nowhere> | 2017-01-18 08:17:10 +0100 |
commit | 398e2d5d4278f89601cac0e031d3535cfc610df0 (patch) | |
tree | 1eccbcec6474d03aa28bc554a2e28220399e2d1e /video/vaapi.c | |
parent | a38283d5d92e75c62b1c0be5e029aaa5ce9d4b1e (diff) | |
download | mpv-398e2d5d4278f89601cac0e031d3535cfc610df0.tar.bz2 mpv-398e2d5d4278f89601cac0e031d3535cfc610df0.tar.xz |
vaapi: fix va_surface_get_uncropped_size() for libavutil surfaces
Fixes vf_vavpp crashing with the new vaapi decode API.
Diffstat (limited to 'video/vaapi.c')
-rw-r--r-- | video/vaapi.c | 12 |
1 files 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) |