From 514ac0999de3564a4cd8a4313064fc2c9ec1f21d Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Sun, 6 Feb 2000 00:56:12 +0000 Subject: [PATCH] The mpeg1 parser test program. Original commit message from CVS: The mpeg1 parser test program. --- test/mp1parse.c | 63 +++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 63 insertions(+) create mode 100644 test/mp1parse.c diff --git a/test/mp1parse.c b/test/mp1parse.c new file mode 100644 index 0000000000..0091c41aee --- /dev/null +++ b/test/mp1parse.c @@ -0,0 +1,63 @@ +#include + +extern gboolean _gst_plugin_spew; + +void eof(GstSrc *src) { + g_print("have eof, quitting\n"); + exit(0); +} + +void mp1parse_info_chain(GstPad *pad,GstBuffer *buf) { + g_print("sink : got buffer of size %d\n",GST_BUFFER_SIZE(buf)); + gst_buffer_unref(buf); +} + +int main(int argc,char *argv[]) { + GstPipeline *pipeline; + GstElementFactory *srcfactory, *parsefactory; + GstElement *src, *parse; + GstPad *infopad; + + g_print("have %d args\n",argc); + + _gst_plugin_spew = TRUE; + gst_init(&argc,&argv); +// gst_plugin_load("mp3parse"); + gst_plugin_load_all(); + + pipeline = gst_pipeline_new("pipeline"); + g_return_if_fail(pipeline != NULL); + + srcfactory = gst_elementfactory_find("disksrc"); + g_return_if_fail(srcfactory != NULL); + parsefactory = gst_elementfactory_find("mpeg1parse"); + g_return_if_fail(parsefactory != NULL); + + src = gst_elementfactory_create(srcfactory,"src"); + g_return_if_fail(src != NULL); + gtk_object_set(GTK_OBJECT(src),"location",argv[1],NULL); + g_print("should be using file '%s'\n",argv[1]); + 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(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); + + g_print("about to enter loop\n"); + while (1) + gst_src_push(GST_SRC(src)); +}