video-test-src: Force video/x-raw
authorThibault Saunier <thibault.saunier@collabora.com>
Sat, 27 Apr 2013 06:45:29 +0000 (03:45 -0300)
committerThibault Saunier <thibault.saunier@collabora.com>
Sat, 27 Apr 2013 23:45:02 +0000 (01:45 +0200)
Avoiding to hit errors with video/x-bayer

ges/ges-video-test-source.c

index c113e50..f71eca8 100644 (file)
@@ -61,13 +61,18 @@ ges_video_test_source_init (GESVideoTestSource * self)
 static GstElement *
 ges_video_test_source_create_element (GESTrackElement * self)
 {
-  GstElement *ret;
   gint pattern;
+  GstElement *ret;
+  gchar *bin_desc;
 
-  pattern = ((GESVideoTestSource *) self)->priv->pattern;
 
-  ret = gst_element_factory_make ("videotestsrc", NULL);
-  g_object_set (ret, "pattern", (gint) pattern, NULL);
+  pattern = ((GESVideoTestSource *) self)->priv->pattern;
+  bin_desc =
+      g_strdup_printf
+      ("videotestsrc pattern=%i name=testsrc ! capsfilter caps=video/x-raw",
+      pattern);
+  ret = gst_parse_bin_from_description (bin_desc, TRUE, NULL);
+  g_free (bin_desc);
 
   return ret;
 }
@@ -89,7 +94,8 @@ ges_video_test_source_set_pattern (GESVideoTestSource
   self->priv->pattern = pattern;
 
   if (element)
-    g_object_set (element, "pattern", (gint) pattern, NULL);
+    gst_child_proxy_set (GST_CHILD_PROXY (element), "testsrc::pattern",
+        (gint) pattern, NULL);
 }
 
 /**