]> Gitweb @ Texas Instruments - Open Source Git Repositories - git.TI.com/gitweb - glsdk/gstreamer0-10.git/blob - test/mp3parse.c
initial checkin
[glsdk/gstreamer0-10.git] / test / mp3parse.c
1 #include <gst/gst.h>
3 extern gboolean _gst_plugin_spew;
5 void mp3parse_info_chain(GstPad *pad,GstBuffer *buf) {
6   g_print("got buffer of size %d\n",GST_BUFFER_SIZE(buf));
7   gst_buffer_unref(buf);
8 }
10 int main(int argc,char *argv[]) {
11   GstPipeline *pipeline;
12   GstElementFactory *srcfactory, *parsefactory;
13   GstElement *src, *parse;
14   GstPad *infopad;
16   g_print("have %d args\n",argc);
18   _gst_plugin_spew = TRUE;
19   gst_init(&argc,&argv);
20 // gst_plugin_load("mp3parse");
21   gst_plugin_load_all();
23   pipeline = gst_pipeline_new("pipeline");
24   g_return_if_fail(pipeline != NULL);
26   srcfactory = gst_elementfactory_find("disksrc");
27   g_return_if_fail(srcfactory != NULL);
28   parsefactory = gst_elementfactory_find("mp3parse");
29   g_return_if_fail(parsefactory != NULL);
31   src = gst_elementfactory_create(srcfactory,"src");
32   g_return_if_fail(src != NULL);
33   gtk_object_set(GTK_OBJECT(src),"location",argv[1],NULL);
34   g_print("should be using file '%s'\n",argv[1]);
35   parse = gst_elementfactory_create(parsefactory,"parse");
36   g_return_if_fail(parse != NULL);
38   infopad = gst_pad_new("sink",GST_PAD_SINK);
39   gst_pad_set_chain_function(infopad,mp3parse_info_chain);
41   gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src));
42   gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse));
44   gst_pad_connect(gst_element_get_pad(src,"src"),
45                   gst_element_get_pad(parse,"sink"));
46   gst_pad_connect(gst_element_get_pad(parse,"src"),
47                   infopad);
49   g_print("setting to RUNNING state\n");
50   gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_RUNNING);
52   g_print("about to enter loop\n");
53   while (1)
54     gst_src_push(GST_SRC(src));
55 }