[vlc-devel] commit: XCB-XV: do not clobber video chroma is port grabbing fails ( Rémi Denis-Courmont )

git version control git at videolan.org
Mon Oct 19 19:28:02 CEST 2009


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Mon Oct 19 20:22:30 2009 +0300| [8b65aa8a59088a7305270a51aacf0a70a8b1a26c] | committer: Rémi Denis-Courmont 

XCB-XV: do not clobber video chroma is port grabbing fails

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

 modules/video_output/xcb/xvideo.c |   25 ++++++++++++-------------
 1 files changed, 12 insertions(+), 13 deletions(-)

diff --git a/modules/video_output/xcb/xvideo.c b/modules/video_output/xcb/xvideo.c
index dde7dcb..600d905 100644
--- a/modules/video_output/xcb/xvideo.c
+++ b/modules/video_output/xcb/xvideo.c
@@ -356,9 +356,8 @@ static int Open (vlc_object_t *obj)
         if (r == NULL)
             continue;
 
-        const xcb_xv_image_format_info_t *xfmt;
-
-        /* */
+        /* Look for an image format */
+        const xcb_xv_image_format_info_t *xfmt = NULL;
         const vlc_fourcc_t *chromas, chromas_default[] = {
             fmt.i_chroma,
             VLC_CODEC_RGB32,
@@ -373,20 +372,19 @@ static int Open (vlc_object_t *obj)
         else
             chromas = chromas_default;
 
-        for (size_t i = 0; chromas[i]; i++)
+        vlc_fourcc_t chroma;
+        for (size_t i = 0; chromas[i] && (xfmt == NULL); i++)
         {
-            vlc_fourcc_t chroma = chromas[i];
+            chroma = chromas[i];
             xfmt = FindFormat (vd, chroma, &fmt, a->base_id, r, &p_sys->att);
-            if (xfmt != NULL)
-            {
-                fmt.i_chroma = chroma;
-                goto found_format;
-            }
         }
-        free (r);
-        continue;
 
-    found_format:
+        if (xfmt == NULL) /* No acceptable image formats */
+        {
+            free (r);
+            continue;
+        }
+
         /* Grab a port */
         for (unsigned i = 0; i < a->num_ports; i++)
         {
@@ -417,6 +415,7 @@ static int Open (vlc_object_t *obj)
 
         p_sys->id = xfmt->id;
         msg_Dbg (vd, "using image format 0x%"PRIx32, p_sys->id);
+        fmt.i_chroma = chroma;
         if (xfmt->type == XCB_XV_IMAGE_FORMAT_INFO_TYPE_RGB)
         {
             fmt.i_rmask = xfmt->red_mask;




More information about the vlc-devel mailing list