From 8dfef4d6b66b6609fb8a43accbd893b629711702 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 6 Feb 2000 01:52:15 +0000 Subject: [PATCH] cleanup. Still not working... Original commit message from CVS: cleanup. Still not working... --- test/mp1parse.c | 25 ++++++++++++++++++------- 1 file changed, 18 insertions(+), 7 deletions(-) diff --git a/test/mp1parse.c b/test/mp1parse.c index 0091c41aee..e13b6b68b9 100644 --- a/test/mp1parse.c +++ b/test/mp1parse.c @@ -3,7 +3,7 @@ extern gboolean _gst_plugin_spew; void eof(GstSrc *src) { - g_print("have eof, quitting\n"); + g_print("have eof, quitting\n"); exit(0); } @@ -12,11 +12,24 @@ void mp1parse_info_chain(GstPad *pad,GstBuffer *buf) { gst_buffer_unref(buf); } +void new_pad_created(GstElement *parse, GstPad *pad) { + GstPad *infopad; + g_print("a new pad %s was created\n", gst_pad_get_name(pad)); + + // connect to audio pad + if (strncmp(gst_pad_get_name(pad), "audio_", 6) == 0) { + infopad = gst_pad_new("sink",GST_PAD_SINK); + gst_pad_set_chain_function(infopad,mp1parse_info_chain); + + gst_pad_connect(gst_element_get_pad(parse,gst_pad_get_name(pad)), + infopad); + } +} + int main(int argc,char *argv[]) { GstPipeline *pipeline; GstElementFactory *srcfactory, *parsefactory; GstElement *src, *parse; - GstPad *infopad; g_print("have %d args\n",argc); @@ -40,19 +53,17 @@ int main(int argc,char *argv[]) { parse = gst_elementfactory_create(parsefactory,"parse"); g_return_if_fail(parse != NULL); - infopad = gst_pad_new("sink",GST_PAD_SINK); - gst_pad_set_chain_function(infopad,mp1parse_info_chain); - gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src)); gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse)); + gtk_signal_connect(GTK_OBJECT(parse),"new_pad", + GTK_SIGNAL_FUNC(new_pad_created),NULL); + gtk_signal_connect(GTK_OBJECT(src),"eos", GTK_SIGNAL_FUNC(eof),NULL); gst_pad_connect(gst_element_get_pad(src,"src"), gst_element_get_pad(parse,"sink")); - gst_pad_connect(gst_element_get_pad(parse,"src"), - infopad); g_print("setting to RUNNING state\n"); gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_RUNNING);