videotestsrc: Publish multiview-mode info in the caps
authorJan Schmidt <jan@centricular.com>
Thu, 16 Mar 2017 00:27:47 +0000 (11:27 +1100)
committerJan Schmidt <jan@centricular.com>
Fri, 17 Mar 2017 15:03:47 +0000 (02:03 +1100)
Don't allow downstream to accidentally pretend that
the output is anything than a mono or single-eye
left/right view.

https://bugzilla.gnome.org/show_bug.cgi?id=776172

gst/videotestsrc/gstvideotestsrc.c

index c6b520a..af03efb 100644 (file)
@@ -86,11 +86,14 @@ enum
 };
 
 
-#define VTS_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) ";" \
+#define VTS_VIDEO_CAPS GST_VIDEO_CAPS_MAKE (GST_VIDEO_FORMATS_ALL) "," \
+  "multiview-mode = { mono, left, right }"                              \
+  ";" \
   "video/x-bayer, format=(string) { bggr, rggb, grbg, gbrg }, "        \
   "width = " GST_VIDEO_SIZE_RANGE ", "                                 \
   "height = " GST_VIDEO_SIZE_RANGE ", "                                \
-  "framerate = " GST_VIDEO_FPS_RANGE
+  "framerate = " GST_VIDEO_FPS_RANGE ", "                              \
+  "multiview-mode = { mono, left, right }"
 
 
 static GstStaticPadTemplate gst_video_test_src_template =
@@ -491,6 +494,15 @@ gst_video_test_src_src_fixate (GstBaseSrc * bsrc, GstCaps * caps)
     gst_structure_set (structure, "interlace-mode", G_TYPE_STRING,
         "progressive", NULL);
 
+  if (gst_structure_has_field (structure, "multiview-mode"))
+    gst_structure_fixate_field_string (structure, "multiview-mode",
+        gst_video_multiview_mode_to_caps_string
+        (GST_VIDEO_MULTIVIEW_MODE_MONO));
+  else
+    gst_structure_set (structure, "multiview-mode", G_TYPE_STRING,
+        gst_video_multiview_mode_to_caps_string (GST_VIDEO_MULTIVIEW_MODE_MONO),
+        NULL);
+
   caps = GST_BASE_SRC_CLASS (parent_class)->fixate (bsrc, caps);
 
   return caps;