diff options
-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) |