[vlc-devel] [PATCH 06/15] vdpau/display: check the source video format via vd->source

Steve Lhomme robux4 at ycbcr.xyz
Thu Sep 3 07:52:23 CEST 2020


The output format is only needed at the end to set the chroma and apply
the source rotation.
---
 modules/hw/vdpau/display.c | 25 +++++++++++--------------
 1 file changed, 11 insertions(+), 14 deletions(-)

diff --git a/modules/hw/vdpau/display.c b/modules/hw/vdpau/display.c
index e3484a72988..2ca9c519362 100644
--- a/modules/hw/vdpau/display.c
+++ b/modules/hw/vdpau/display.c
@@ -323,19 +323,16 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
         msg_Dbg(vd, "using back-end %s", info);
 
     /* Check source format */
-    video_format_t fmt;
     VdpChromaType chroma;
     VdpYCbCrFormat format;
     VdpStatus err;
 
-    video_format_ApplyRotation(&fmt, fmtp);
-
-    if (fmt.i_chroma == VLC_CODEC_VDPAU_VIDEO_420
-     || fmt.i_chroma == VLC_CODEC_VDPAU_VIDEO_422
-     || fmt.i_chroma == VLC_CODEC_VDPAU_VIDEO_444)
+    if (vd->source->i_chroma == VLC_CODEC_VDPAU_VIDEO_420
+     || vd->source->i_chroma == VLC_CODEC_VDPAU_VIDEO_422
+     || vd->source->i_chroma == VLC_CODEC_VDPAU_VIDEO_444)
         ;
     else
-    if (vlc_fourcc_to_vdp_ycc(fmt.i_chroma, &chroma, &format))
+    if (vlc_fourcc_to_vdp_ycc(vd->source->i_chroma, &chroma, &format))
     {
         uint32_t w, h;
         VdpBool ok;
@@ -348,7 +345,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
                     vdp_get_error_string(sys->vdp, err));
             goto error;
         }
-        if (!ok || w < fmt.i_width || h < fmt.i_height)
+        if (!ok || w < vd->source->i_width || h < vd->source->i_height)
         {
             msg_Err(vd, "source video %s not supported", "chroma type");
             goto error;
@@ -385,7 +382,7 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
                     vdp_get_error_string(sys->vdp, err));
             goto error;
         }
-        if (min > fmt.i_width || fmt.i_width > max)
+        if (min > vd->source->i_width || vd->source->i_width > max)
         {
             msg_Err(vd, "source video %s not supported", "width");
             goto error;
@@ -401,16 +398,15 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
                     vdp_get_error_string(sys->vdp, err));
             goto error;
         }
-        if (min > fmt.i_height || fmt.i_height > max)
+        if (min > vd->source->i_height || vd->source->i_height > max)
         {
             msg_Err(vd, "source video %s not supported", "height");
             goto error;
         }
     }
-    fmt.i_chroma = VLC_CODEC_VDPAU_OUTPUT;
 
-    sys->width = fmtp->i_visible_width;
-    sys->height = fmtp->i_visible_height;
+    sys->width = vd->source->i_visible_width;
+    sys->height = vd->source->i_visible_height;
     /* VDPAU-X11 requires a window dedicated to the back-end */
     {
         xcb_pixmap_t pix = xcb_generate_id(sys->conn);
@@ -488,7 +484,8 @@ static int Open(vout_display_t *vd, const vout_display_cfg_t *cfg,
     sys->current = NULL;
     vd->sys = sys;
     vd->info.subpicture_chromas = spu_chromas;
-    *fmtp = fmt;
+    video_format_ApplyRotation(fmtp, vd->source);
+    fmtp->i_chroma = VLC_CODEC_VDPAU_OUTPUT;
 
     vd->prepare = Queue;
     vd->display = Wait;
-- 
2.26.2



More information about the vlc-devel mailing list