gst-validate: ensure the top level element is a pipeline
authorVincent Penquerc'h <vincent.penquerch@collabora.co.uk>
Wed, 4 Sep 2013 15:09:50 +0000 (11:09 -0400)
committerThiago Santos <thiago.sousa.santos@collabora.com>
Thu, 5 Sep 2013 16:40:39 +0000 (13:40 -0300)
For instance, "fakesrc" will return a fakesrc, not a pipeline.

This is similar to what gst-launch does, and avoids calling
pipeline API on a non pipeline object (and thus asserting).

validate/tools/gst-validate.c

index 39f20a0..7e341d3 100644 (file)
@@ -168,6 +168,11 @@ main (int argc, gchar ** argv)
         err ? err->message : "unknown reason");
     exit (1);
   }
+  if (!GST_IS_PIPELINE (pipeline)) {
+    GstElement *new_pipeline = gst_pipeline_new ("");
+    gst_bin_add (GST_BIN (new_pipeline), pipeline);
+    pipeline = new_pipeline;
+  }
 #ifdef G_OS_UNIX
   signal_watch_id =
       g_unix_signal_add (SIGINT, (GSourceFunc) intr_handler, pipeline);