gst-validate: ensure the top level element is a pipeline

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).
This commit is contained in:
Vincent Penquerc'h 2013-09-04 11:09:50 -04:00 committed by Thiago Santos
parent 9cf4857776
commit 7223b183f3

View file

@ -168,6 +168,11 @@ main (int argc, gchar ** argv)
err ? err->message : "unknown reason"); err ? err->message : "unknown reason");
exit (1); 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 #ifdef G_OS_UNIX
signal_watch_id = signal_watch_id =
g_unix_signal_add (SIGINT, (GSourceFunc) intr_handler, pipeline); g_unix_signal_add (SIGINT, (GSourceFunc) intr_handler, pipeline);