videobox: Fix caps negotiation issue
authorRavi Kiran K N <ravi.kiran@samsung.com>
Tue, 17 Jun 2014 07:46:27 +0000 (13:16 +0530)
committerThiago Santos <ts.santos@sisa.samsung.com>
Tue, 17 Jun 2014 12:27:45 +0000 (09:27 -0300)
Make sure that if AYUV is received it will detect that it can produce
both RGB and YUV formats

Signed-off-by: Ravi Kiran K N <ravi.kiran@samsung.com>
https://bugzilla.gnome.org/show_bug.cgi?id=725248

gst/videobox/gstvideobox.c

index 5df2588..861bcae 100644 (file)
@@ -2862,22 +2862,27 @@ gst_video_box_transform_caps (GstBaseTransform * trans,
       for (j = 0; j < gst_value_list_get_size (fval); j++) {
         lval = gst_value_list_get_value (fval, j);
         if ((str = g_value_get_string (lval))) {
-          if (strstr (str, "RGB") || strstr (str, "BGR") ||
-              strcmp (str, "AYUV") == 0)
+          if (strcmp (str, "AYUV") == 0) {
+            seen_yuv = TRUE;
+            seen_rgb = TRUE;
+            break;
+          } else if (strstr (str, "RGB") || strstr (str, "BGR")) {
             seen_rgb = TRUE;
-          else if (strcmp (str, "I420") == 0 || strcmp (str, "YV12") == 0 ||
-              strcmp (str, "AYUV") == 0)
+          } else if (strcmp (str, "I420") == 0 || strcmp (str, "YV12") == 0) {
             seen_yuv = TRUE;
+          }
         }
       }
     } else if (fval && G_VALUE_HOLDS_STRING (fval)) {
       if ((str = g_value_get_string (fval))) {
-        if (strstr (str, "RGB") || strstr (str, "BGR") ||
-            strcmp (str, "AYUV") == 0)
+        if (strcmp (str, "AYUV") == 0) {
+          seen_yuv = TRUE;
           seen_rgb = TRUE;
-        else if (strcmp (str, "I420") == 0 || strcmp (str, "YV12") == 0 ||
-            strcmp (str, "AYUV") == 0)
+        } else if (strstr (str, "RGB") || strstr (str, "BGR")) {
+          seen_rgb = TRUE;
+        } else if (strcmp (str, "I420") == 0 || strcmp (str, "YV12") == 0) {
           seen_yuv = TRUE;
+        }
       }
     }