ges-launch: add an option to use a custom video sink
authorMathieu Duponchelle <mathieu.duponchelle@opencreed.com>
Thu, 8 May 2014 12:12:11 +0000 (14:12 +0200)
committerMathieu Duponchelle <mathieu.duponchelle@opencreed.com>
Thu, 8 May 2014 12:28:58 +0000 (14:28 +0200)
tools/ges-launch.c

index df95c3c..f4e754b 100644 (file)
@@ -720,7 +720,9 @@ main (int argc, gchar ** argv)
   static gdouble thumbinterval = 0;
   static gboolean verbose = FALSE;
   gchar *load_path = NULL;
+  gchar *videosink = NULL;
   const gchar *scenario = NULL;
+
   GOptionEntry options[] = {
     {"thumbnail", 'm', 0.0, G_OPTION_ARG_DOUBLE, &thumbinterval,
         "Take thumbnails every n seconds (saved in current directory)", "N"},
@@ -762,6 +764,8 @@ main (int argc, gchar ** argv)
         "Mute playback output, which means that we use faksinks"},
     {"disable-mixing", 0, 0, G_OPTION_ARG_NONE, &disable_mixing,
         "Do not use mixing element in the tracks"},
+    {"videosink", 'v', 0, G_OPTION_ARG_STRING, &videosink,
+      "The video sink used for playing back", "<videosink>"},
 #ifdef HAVE_GST_VALIDATE
     {"set-scenario", 0, 0, G_OPTION_ARG_STRING, &scenario,
         "Specify a GstValidate scenario to run, 'none' means load gst-validate"
@@ -833,6 +837,15 @@ main (int argc, gchar ** argv)
   if (!pipeline)
     exit (1);
 
+  if (videosink != NULL) {
+    GstElement *sink = gst_element_factory_make (videosink, "custom-videosink");
+    if (sink == NULL) {
+      GST_ERROR ("could not create the requested videosink %s, exiting", videosink);
+      exit (1);
+    }
+    ges_pipeline_preview_set_video_sink (pipeline, sink);
+  }
+
   /* Setup profile/encoding if needed */
   if (smartrender || outputuri) {
     GstEncodingProfile *prof = NULL;