Fixes to properly conditionally compile architecture-dependent code
[platform/upstream/gstreamer.git] / test / ac3parse.c
1 #include <gst/gst.h>
2
3 extern gboolean _gst_plugin_spew;
4
5 void ac3parse_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 }
9
10 int main(int argc,char *argv[]) {
11   GstPipeline *pipeline;
12   GstElementFactory *srcfactory, *parsefactory;
13   GstElement *src, *parse;
14   GstPad *infopad;
15
16   g_print("have %d args\n",argc);
17
18   _gst_plugin_spew = TRUE;
19   gst_init(&argc,&argv);
20 // gst_plugin_load("ac3parse");
21   gst_plugin_load_all();
22
23   pipeline = GST_PIPELINE (gst_pipeline_new("pipeline"));
24   g_return_val_if_fail(pipeline != NULL, -1);
25
26   srcfactory = gst_elementfactory_find("disksrc");
27   g_return_val_if_fail(srcfactory != NULL, -1);
28   parsefactory = gst_elementfactory_find("ac3parse");
29   g_return_val_if_fail(parsefactory != NULL, -1);
30
31   src = gst_elementfactory_create(srcfactory,"src");
32   g_return_val_if_fail(src != NULL, -1);
33   g_object_set(G_OBJECT(src),"location",argv[1],"bytesperread",4096,NULL);
34   g_print("should be using file '%s'\n",argv[1]);
35   parse = gst_elementfactory_create(parsefactory,"parse");
36   g_return_val_if_fail(parse != NULL, -1);
37
38   infopad = gst_pad_new("sink",GST_PAD_SINK);
39   gst_pad_set_chain_function(infopad,ac3parse_info_chain);
40
41   gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(src));
42   gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(parse));
43
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);
48
49   g_print("setting to READY state\n");
50   gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_READY);
51   gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
52
53   g_print("about to enter loop\n");
54   while (1)
55     gst_bin_iterate(GST_BIN(pipeline));
56 }