2000-01-30 10:44:33 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <gst/gst.h>
|
2001-01-09 04:39:35 +00:00
|
|
|
#include <gst/gstparse.h>
|
2000-08-28 20:20:55 +00:00
|
|
|
#include <string.h>
|
|
|
|
#include <stdlib.h>
|
2000-01-30 10:44:33 +00:00
|
|
|
|
2001-01-21 16:06:42 +00:00
|
|
|
int
|
|
|
|
main(int argc, char *argv[])
|
|
|
|
{
|
2001-01-09 04:39:35 +00:00
|
|
|
GstElement *pipeline;
|
2000-12-31 10:46:16 +00:00
|
|
|
char **argvn;
|
|
|
|
gchar *cmdline;
|
2001-05-20 20:06:09 +00:00
|
|
|
int i;
|
2001-01-09 04:39:35 +00:00
|
|
|
|
2001-01-21 16:06:42 +00:00
|
|
|
gst_init (&argc, &argv);
|
|
|
|
|
|
|
|
pipeline = gst_pipeline_new ("launch");
|
2000-12-31 10:46:16 +00:00
|
|
|
|
|
|
|
// make a null-terminated version of argv
|
2001-01-21 16:06:42 +00:00
|
|
|
argvn = g_new0 (char *,argc);
|
|
|
|
memcpy (argvn, argv+1, sizeof (char*) * (argc-1));
|
2001-05-20 20:06:09 +00:00
|
|
|
|
|
|
|
// escape spaces
|
|
|
|
for (i=0; i<argc-1; i++) {
|
|
|
|
gchar **split;
|
|
|
|
|
|
|
|
split = g_strsplit (argvn[i], " ", 0);
|
|
|
|
|
|
|
|
argvn[i] = g_strjoinv ("\\ ", split);
|
|
|
|
g_strfreev (split);
|
|
|
|
}
|
2000-12-31 10:46:16 +00:00
|
|
|
// join the argvs together
|
2001-01-21 16:06:42 +00:00
|
|
|
cmdline = g_strjoinv (" ", argvn);
|
2000-12-31 10:46:16 +00:00
|
|
|
// free the null-terminated argv
|
2001-01-21 16:06:42 +00:00
|
|
|
g_free (argvn);
|
2000-12-31 10:46:16 +00:00
|
|
|
|
2001-01-21 16:06:42 +00:00
|
|
|
gst_parse_launch (cmdline, GST_BIN (pipeline));
|
2000-12-31 10:46:16 +00:00
|
|
|
|
2001-04-15 22:54:57 +00:00
|
|
|
xmlSaveFile("gstreamer-launch.gst",gst_xml_write(pipeline));
|
|
|
|
|
2001-01-09 04:39:35 +00:00
|
|
|
fprintf(stderr,"RUNNING pipeline\n");
|
2001-01-21 16:06:42 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_PLAYING);
|
|
|
|
|
|
|
|
while (gst_bin_iterate (GST_BIN (pipeline)));
|
2001-01-04 10:47:39 +00:00
|
|
|
|
2001-01-21 16:06:42 +00:00
|
|
|
gst_element_set_state (pipeline, GST_STATE_NULL);
|
2000-08-28 20:20:55 +00:00
|
|
|
|
2000-09-09 16:36:10 +00:00
|
|
|
return 0;
|
2000-01-30 10:44:33 +00:00
|
|
|
}
|