From 216e862be2b548b62289a2ae81542b8a65a0a85a Mon Sep 17 00:00:00 2001 From: Richard Boulton Date: Tue, 19 Jun 2001 10:34:15 +0000 Subject: [PATCH] Add -o option argument to gstreamer-launch, to specify a file to output the pipeline to, instead of running it. Original commit message from CVS: Add -o option argument to gstreamer-launch, to specify a file to output the pipeline to, instead of running it. --- tools/gstreamer-launch.c | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) diff --git a/tools/gstreamer-launch.c b/tools/gstreamer-launch.c index 5fe73997bd..fdc464aa6b 100644 --- a/tools/gstreamer-launch.c +++ b/tools/gstreamer-launch.c @@ -94,9 +94,21 @@ main(int argc, char *argv[]) char **argvn; gchar *cmdline; int i; + gboolean save_pipeline = FALSE; + gboolean run_pipeline = TRUE; + gchar *savefile = ""; gst_init (&argc, &argv); + if (argc >= 3 && !strcmp(argv[1], "-o")) { + save_pipeline = TRUE; + run_pipeline = FALSE; + savefile = argv[2]; + argv[2] = argv[0]; + argv+=2; + argc-=2; + } + launch_argc = argc; launch_argv = argv; @@ -128,17 +140,20 @@ main(int argc, char *argv[]) gst_parse_launch (cmdline, GST_BIN (pipeline)); - arg_search(GST_BIN(pipeline),"xid",xid_handler,NULL); + if (save_pipeline) { + xmlSaveFile (savefile, gst_xml_write (pipeline)); + } + if (run_pipeline) { + arg_search(GST_BIN(pipeline),"xid",xid_handler,NULL); -// xmlSaveFile("gstreamer-launch.gst",gst_xml_write(pipeline)); + fprintf(stderr,"RUNNING pipeline\n"); + gst_element_set_state (pipeline, GST_STATE_PLAYING); - fprintf(stderr,"RUNNING pipeline\n"); - gst_element_set_state (pipeline, GST_STATE_PLAYING); + gtk_idle_add(idle_func,pipeline); + gtk_main(); - gtk_idle_add(idle_func,pipeline); - gtk_main(); - - gst_element_set_state (pipeline, GST_STATE_NULL); + gst_element_set_state (pipeline, GST_STATE_NULL); + } return 0; }