[vlc-devel] commit: XCB: handle planar YVU (YV12) properly (untested) ( Rémi Denis-Courmont )

git version control git at videolan.org
Sun Apr 26 17:01:23 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Sun Apr 26 18:00:48 2009 +0300| [e163db1b0daae037c780cdb4d19b6cefe9f3cff7] | committer: Rémi Denis-Courmont 

XCB: handle planar YVU (YV12) properly (untested)

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=e163db1b0daae037c780cdb4d19b6cefe9f3cff7
---

 modules/video_output/xcb/xvideo.c |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index 4ec03e2..a823050 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -372,7 +372,8 @@ FindFormat (vout_thread_t *vout, vlc_fourcc_t chroma, xcb_xv_port_t port,
 static int Init (vout_thread_t *vout)
 {
     vout_sys_t *p_sys = vout->p_sys;
-    xcb_xv_query_image_attributes_reply_t *att;
+    xcb_xv_query_image_attributes_reply_t *att = NULL;
+    bool swap_planes = false; /* whether X wants V before U */
 
     /* FIXME: check max image size */
     xcb_xv_adaptor_info_iterator_t it;
@@ -427,6 +428,9 @@ static int Init (vout_thread_t *vout)
             vout->fmt_out.i_gmask = vout->output.i_gmask = fmt->green_mask;
             vout->fmt_out.i_bmask = vout->output.i_bmask = fmt->blue_mask;
         }
+        else
+        if (fmt->num_planes == 3)
+            swap_planes = !strcmp ((const char *)fmt->vcomp_order, "YVU");
         free (r);
         goto found_adaptor;
     }
@@ -457,7 +461,8 @@ found_adaptor:
         /* Allocate further planes as specified by XVideo */
         /* We assume that offsets[0] is zero */
         for (int i = 1; i < pic->i_planes; i++)
-             pic->p[i].p_pixels = pic->p->p_pixels + offsets[i];
+             pic->p[i].p_pixels =
+                 pic->p->p_pixels + offsets[swap_planes ? (3 - i) : i];
         PP_OUTPUTPICTURE[I_OUTPUTPICTURES++] = pic;
     }
     free (att);




More information about the vlc-devel mailing list