From 70cfc6cb4db1ce5b0a9e1f4c7939cb9eb198358d Mon Sep 17 00:00:00 2001 From: Andy Wingo Date: Sun, 7 Apr 2002 23:32:16 +0000 Subject: new parser that uses flex and bison Original commit message from CVS: * new parser that uses flex and bison - doesn't do dynamic pipelines yet... * added GErrors to the gst_parse_launch[v] api * added --gst-mask-help command line option * fixed -o option for gst-launch * GstElement api change: - gst_element_get_pad - gst_element_get_request_pad, gst_element_get_static_pad - gst_element_get_compatible_pad - gst_element_get_compatible_static_pad, gst_element_get_compatible_request_pad - gst_element_[dis]connect -> gst_element_[dis]connect_pads - gst_element_[dis]connect_elements -> gst_element_[dis]connect * manual update * example, tool, and doc updates for the api changes - no more plugin docs in the core docs, plugins require a more extensive doc system --- examples/autoplug/autoplug.c | 29 ++++++++++++++--------------- examples/helloworld/helloworld.c | 4 ++-- examples/helloworld2/helloworld2.c | 16 ++++++++-------- examples/launch/mp3parselaunch.c | 9 +++++++-- examples/mixer/mixer.c | 12 ++++++------ examples/xml/createxml.c | 2 +- examples/xml/runxml.c | 2 +- 7 files changed, 39 insertions(+), 35 deletions(-) (limited to 'examples') diff --git a/examples/autoplug/autoplug.c b/examples/autoplug/autoplug.c index 0848636555..1f7ae4f36b 100644 --- a/examples/autoplug/autoplug.c +++ b/examples/autoplug/autoplug.c @@ -19,22 +19,22 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) cache = gst_bin_get_by_name (GST_BIN (autobin), "cache"); /* disconnect the typefind from the pipeline and remove it */ - gst_element_disconnect (cache, "src", typefind, "sink"); + gst_element_disconnect_pads (cache, "src", typefind, "sink"); gst_bin_remove (GST_BIN (autobin), typefind); /* and an audio sink */ - osssink = gst_elementfactory_make("osssink", "play_audio"); - g_assert(osssink != NULL); + osssink = gst_elementfactory_make ("osssink", "play_audio"); + g_assert (osssink != NULL); videosink = gst_bin_new ("videosink"); /* and an video sink */ - videoelement = gst_elementfactory_make("xvideosink", "play_video"); - g_assert(videosink != NULL); + videoelement = gst_elementfactory_make ("xvideosink", "play_video"); + g_assert (videosink != NULL); - colorspace = gst_elementfactory_make("colorspace", "colorspace"); - g_assert(colorspace != NULL); + colorspace = gst_elementfactory_make ("colorspace", "colorspace"); + g_assert (colorspace != NULL); - gst_element_connect (colorspace, "src", videoelement, "sink"); + gst_element_connect_pads (colorspace, "src", videoelement, "sink"); gst_bin_add (GST_BIN (videosink), colorspace); gst_bin_add (GST_BIN (videosink), videoelement); @@ -61,7 +61,7 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) g_object_set (G_OBJECT (cache), "reset", TRUE, NULL); - gst_element_connect (cache, "src", new_element, "sink"); + gst_element_connect_pads (cache, "src", new_element, "sink"); gst_element_set_state (pipeline, GST_STATE_PLAYING); @@ -87,10 +87,9 @@ gst_play_cache_empty (GstElement *element, GstElement *pipeline) cache = gst_bin_get_by_name (GST_BIN (autobin), "cache"); new_element = gst_bin_get_by_name (GST_BIN (autobin), "new_element"); - gst_element_disconnect (filesrc, "src", cache, "sink"); - gst_element_disconnect (cache, "src", new_element, "sink"); + gst_element_disconnect_many (filesrc, cache, new_element, NULL); gst_bin_remove (GST_BIN (autobin), cache); - gst_element_connect (filesrc, "src", new_element, "sink"); + gst_element_connect_pads (filesrc, "src", new_element, "sink"); gst_element_set_state (pipeline, GST_STATE_PLAYING); @@ -132,14 +131,14 @@ int main(int argc,char *argv[]) gst_bin_add (GST_BIN (autobin), cache); gst_bin_add (GST_BIN (autobin), typefind); - gst_element_connect (cache, "src", typefind, "sink"); + gst_element_connect_pads (cache, "src", typefind, "sink"); gst_element_add_ghost_pad (autobin, gst_element_get_pad (cache, "sink"), "sink"); gst_bin_add (GST_BIN( pipeline), autobin); - gst_element_connect (filesrc, "src", autobin, "sink"); + gst_element_connect_pads (filesrc, "src", autobin, "sink"); /* start playing */ - gst_element_set_state( GST_ELEMENT (pipeline), GST_STATE_PLAYING); + gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING); while (gst_bin_iterate (GST_BIN (pipeline))); diff --git a/examples/helloworld/helloworld.c b/examples/helloworld/helloworld.c index d82d7157d5..67105949da 100644 --- a/examples/helloworld/helloworld.c +++ b/examples/helloworld/helloworld.c @@ -22,7 +22,7 @@ int main (int argc, char *argv[]) g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); /* now it's time to get the decoder */ - decoder = gst_elementfactory_make ("mad", "parse"); + decoder = gst_elementfactory_make ("mad", "decode"); if (!decoder) { g_print ("could not find plugin \"mad\""); return -1; @@ -35,7 +35,7 @@ int main (int argc, char *argv[]) gst_bin_add_many (GST_BIN (bin), filesrc, decoder, osssink, NULL); /* connect the elements */ - gst_element_connect_elements_many (filesrc, decoder, osssink, NULL); + gst_element_connect_many (filesrc, decoder, osssink, NULL); /* start playing */ gst_element_set_state (bin, GST_STATE_PLAYING); diff --git a/examples/helloworld2/helloworld2.c b/examples/helloworld2/helloworld2.c index e36b74cb5d..4fa7e72826 100644 --- a/examples/helloworld2/helloworld2.c +++ b/examples/helloworld2/helloworld2.c @@ -18,8 +18,8 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) autobin = gst_bin_get_by_name (GST_BIN (pipeline), "autobin"); cache = gst_bin_get_by_name (GST_BIN (autobin), "cache"); - /* disconnect the typefind from the pipeline and remove it */ - gst_element_disconnect (cache, "src", typefind, "sink"); + /* disconnect_pads the typefind from the pipeline and remove it */ + gst_element_disconnect_pads (cache, "src", typefind, "sink"); gst_bin_remove (GST_BIN (autobin), typefind); /* and an audio sink */ @@ -45,7 +45,7 @@ gst_play_have_type (GstElement *typefind, GstCaps *caps, GstElement *pipeline) g_object_set (G_OBJECT (cache), "reset", TRUE, NULL); - gst_element_connect (cache, "src", new_element, "sink"); + gst_element_connect_pads (cache, "src", new_element, "sink"); gst_element_set_state (pipeline, GST_STATE_PLAYING); } @@ -67,10 +67,10 @@ gst_play_cache_empty (GstElement *element, GstElement *pipeline) cache = gst_bin_get_by_name (GST_BIN (autobin), "cache"); new_element = gst_bin_get_by_name (GST_BIN (autobin), "new_element"); - gst_element_disconnect (filesrc, "src", cache, "sink"); - gst_element_disconnect (cache, "src", new_element, "sink"); + gst_element_disconnect_pads (filesrc, "src", cache, "sink"); + gst_element_disconnect_pads (cache, "src", new_element, "sink"); gst_bin_remove (GST_BIN (autobin), cache); - gst_element_connect (filesrc, "src", new_element, "sink"); + gst_element_connect_pads (filesrc, "src", new_element, "sink"); gst_element_set_state (pipeline, GST_STATE_PLAYING); @@ -114,11 +114,11 @@ main (int argc, char *argv[]) gst_bin_add (GST_BIN (autobin), cache); gst_bin_add (GST_BIN (autobin), typefind); - gst_element_connect (cache, "src", typefind, "sink"); + gst_element_connect_pads (cache, "src", typefind, "sink"); gst_element_add_ghost_pad (autobin, gst_element_get_pad (cache, "sink"), "sink"); gst_bin_add (GST_BIN( pipeline), autobin); - gst_element_connect (filesrc, "src", autobin, "sink"); + gst_element_connect_pads (filesrc, "src", autobin, "sink"); /* start playing */ gst_element_set_state( GST_ELEMENT (pipeline), GST_STATE_PLAYING); diff --git a/examples/launch/mp3parselaunch.c b/examples/launch/mp3parselaunch.c index 345cff3d45..5489b2652d 100644 --- a/examples/launch/mp3parselaunch.c +++ b/examples/launch/mp3parselaunch.c @@ -5,6 +5,7 @@ main (int argc, char *argv[]) { GstElement *pipeline; GstElement *filesrc; + GError *error = NULL; gst_init (&argc, &argv); @@ -13,8 +14,12 @@ main (int argc, char *argv[]) return -1; } - pipeline = (GstElement*) gst_parse_launch ("filesrc [ my_filesrc ] ! mad ! osssink"); - + pipeline = (GstElement*) gst_parse_launch ("filesrc name=my_filesrc ! mad ! osssink", &error); + if (!pipeline) { + fprintf (stderr, "Parse error: %s", error->message); + exit (1); + } + filesrc = gst_bin_get_by_name (GST_BIN (pipeline), "my_filesrc"); g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL); diff --git a/examples/mixer/mixer.c b/examples/mixer/mixer.c index 5e30152c2f..8bd3bde527 100644 --- a/examples/mixer/mixer.c +++ b/examples/mixer/mixer.c @@ -40,7 +40,7 @@ void eos(GstElement *element) /* playing = FALSE; */ } -static GstCaps* +G_GNUC_UNUSED static GstCaps* gst_play_typefind (GstBin *bin, GstElement *element) { GstElement *typefind; @@ -140,7 +140,7 @@ int main(int argc,char *argv[]) /* request pads and connect to adder */ GST_INFO (0, "requesting pad\n"); - pad = gst_element_request_pad_by_name (adder, "sink%d"); + pad = gst_element_get_request_pad (adder, "sink%d"); printf ("\tGot new adder sink pad %s\n", gst_pad_get_name (pad)); sprintf (buffer, "channel%d", i); gst_pad_connect (gst_element_get_pad (channel_in->pipe, buffer), pad); @@ -237,8 +237,8 @@ create_input_channel (int id, char* location) char buffer[20]; /* hold the names */ - GstAutoplug *autoplug; - GstCaps *srccaps; +/* GstAutoplug *autoplug; + GstCaps *srccaps; */ GstElement *new_element; GstElement *decoder; @@ -364,8 +364,8 @@ create_input_channel (int id, char* location) gst_bin_add (GST_BIN(channel->pipe), channel->volenv); gst_bin_add (GST_BIN (channel->pipe), new_element); - gst_element_connect (channel->filesrc, "src", new_element, "sink"); - gst_element_connect (new_element, "src_00", channel->volenv, "sink"); + gst_element_connect_pads (channel->filesrc, "src", new_element, "sink"); + gst_element_connect_pads (new_element, "src_00", channel->volenv, "sink"); /* add a ghost pad */ sprintf (buffer, "channel%d", id); diff --git a/examples/xml/createxml.c b/examples/xml/createxml.c index 00b09c56b1..d4501c9a69 100644 --- a/examples/xml/createxml.c +++ b/examples/xml/createxml.c @@ -19,7 +19,7 @@ object_saved (GstObject *object, xmlNodePtr parent, gpointer data) int main(int argc,char *argv[]) { - GstElement *filesrc, *osssink, *queue, *queue2, *parse, *decode; + GstElement *filesrc, *osssink, *queue, *queue2, *decode; GstElement *pipeline; GstElement *thread, *thread2; diff --git a/examples/xml/runxml.c b/examples/xml/runxml.c index 5b91e44ce4..e754d5f09e 100644 --- a/examples/xml/runxml.c +++ b/examples/xml/runxml.c @@ -4,7 +4,7 @@ gboolean playing; -static void +G_GNUC_UNUSED static void xml_loaded (GstXML *xml, GstObject *object, xmlNodePtr self, gpointer data) { xmlNodePtr children = self->xmlChildrenNode; -- cgit v1.2.1