From e8d10e59c55e5d90e0c6725ea1654effde524ede Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?R=C3=A9mi=20Denis-Courmont?= <remi@remlab.net>
Date: Sun, 27 Sep 2015 14:56:03 +0300
Subject: [PATCH] vdpau: use avcodec context dimensions

---
 modules/hw/vdpau/avcodec.c | 15 +++++++--------
 1 file changed, 7 insertions(+), 8 deletions(-)

diff --git a/modules/hw/vdpau/avcodec.c b/modules/hw/vdpau/avcodec.c
index 71c17ddd72ef..e175cb2dacf4 100644
--- a/modules/hw/vdpau/avcodec.c
+++ b/modules/hw/vdpau/avcodec.c
@@ -146,6 +146,7 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
     if (pix_fmt != AV_PIX_FMT_VDPAU)
         return VLC_EGENERIC;
 
+    (void) fmt;
     (void) p_sys;
     void *func;
     VdpStatus err;
@@ -227,8 +228,6 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
 
     if (av_vdpau_bind_context(avctx, sys->device, func, flags))
         goto error;
-
-    (void) fmt;
 #else
     AVVDPAUContext *hwctx = av_vdpau_alloc_context();
     if (unlikely(hwctx == NULL))
@@ -257,10 +256,10 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
         goto error;
     }
     msg_Dbg(va, "video surface limits: %"PRIu32"x%"PRIu32, w, h);
-    if (w < fmt->video.i_width || h < fmt->video.i_height)
+    if (w < avctx->coded_width || h < avctx->coded_height)
     {
-        msg_Err(va, "video surface above limits: %ux%u",
-                fmt->video.i_width, fmt->video.i_height);
+        msg_Err(va, "video surface above limits: %dx%d",
+                avctx->coded_width, avctx->coded_height);
         goto error;
     }
 
@@ -274,10 +273,10 @@ static int Open(vlc_va_t *va, AVCodecContext *avctx, enum PixelFormat pix_fmt,
     }
     msg_Dbg(va, "decoder profile limits: level %"PRIu32" mb %"PRIu32" "
             "%"PRIu32"x%"PRIu32, l, mb, w, h);
-    if ((int)l < level || w < fmt->video.i_width || h < fmt->video.i_height)
+    if ((int)l < level || w < avctx->coded_width || h < avctx->coded_height)
     {
-        msg_Err(va, "decoder profile above limits: level %d %ux%u",
-                level, fmt->video.i_width, fmt->video.i_height);
+        msg_Err(va, "decoder profile above limits: level %d %dx%d",
+                level, avctx->coded_width, avctx->coded_height);
         goto error;
     }
 
-- 
GitLab