2000-01-30 10:44:33 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
#include "mem.h"
|
|
|
|
|
|
|
|
extern gboolean _gst_plugin_spew;
|
|
|
|
|
|
|
|
int main(int argc,char *argv[]) {
|
2001-06-01 18:09:26 +00:00
|
|
|
GstElement *pipeline, *decodethread;
|
2000-01-30 10:44:33 +00:00
|
|
|
GstElement *src, *parse, *decode, *play;
|
|
|
|
GstElement *queue;
|
|
|
|
|
2001-02-06 19:39:15 +00:00
|
|
|
// g_print("have %d args\n",argc);
|
2000-01-30 10:44:33 +00:00
|
|
|
|
2001-02-06 19:39:15 +00:00
|
|
|
// _gst_plugin_spew = TRUE;
|
2000-01-30 10:44:33 +00:00
|
|
|
gst_init(&argc,&argv);
|
|
|
|
|
|
|
|
pipeline = gst_elementfactory_make("pipeline","ac3player");
|
2001-06-01 18:09:26 +00:00
|
|
|
g_return_val_if_fail(pipeline != NULL, -1);
|
2000-01-30 10:44:33 +00:00
|
|
|
decodethread = gst_elementfactory_make("thread","decodethread");
|
2001-06-01 18:09:26 +00:00
|
|
|
g_return_val_if_fail(decodethread != NULL, -1);
|
2000-01-30 10:44:33 +00:00
|
|
|
queue = gst_elementfactory_make("queue","queue");
|
2001-06-01 18:09:26 +00:00
|
|
|
g_return_val_if_fail(queue != NULL, -1);
|
2000-01-30 10:44:33 +00:00
|
|
|
|
|
|
|
src = gst_elementfactory_make("disksrc","src");
|
2001-06-01 18:09:26 +00:00
|
|
|
g_return_val_if_fail(src != NULL, -1);
|
2001-06-25 01:20:11 +00:00
|
|
|
g_object_set(G_OBJECT(src),"location",argv[1],NULL);
|
2001-02-06 19:39:15 +00:00
|
|
|
// g_print("should be using file '%s'\n",argv[1]);
|
2000-01-30 10:44:33 +00:00
|
|
|
parse = gst_elementfactory_make("ac3parse","parse");
|
2001-06-01 18:09:26 +00:00
|
|
|
g_return_val_if_fail(parse != NULL, -1);
|
2000-01-30 10:44:33 +00:00
|
|
|
decode = gst_elementfactory_make("ac3dec","decode");
|
2001-06-01 18:09:26 +00:00
|
|
|
g_return_val_if_fail(decode != NULL, -1);
|
2001-03-24 17:22:03 +00:00
|
|
|
play = gst_elementfactory_make("osssink","play");
|
2001-06-01 18:09:26 +00:00
|
|
|
g_return_val_if_fail(play != NULL, -1);
|
2000-01-30 10:44:33 +00:00
|
|
|
|
|
|
|
// construct the decode thread
|
|
|
|
g_print("constructing the decode thread\n");
|
|
|
|
gst_bin_add(GST_BIN(decodethread),GST_ELEMENT(src));
|
|
|
|
gst_bin_add(GST_BIN(decodethread),GST_ELEMENT(parse));
|
|
|
|
gst_bin_add(GST_BIN(decodethread),GST_ELEMENT(decode));
|
|
|
|
gst_pad_connect(gst_element_get_pad(src,"src"),
|
|
|
|
gst_element_get_pad(parse,"sink"));
|
|
|
|
gst_pad_connect(gst_element_get_pad(parse,"src"),
|
|
|
|
gst_element_get_pad(decode,"sink"));
|
|
|
|
gst_element_add_ghost_pad(GST_ELEMENT(decodethread),
|
2001-01-20 03:33:55 +00:00
|
|
|
gst_element_get_pad(decode,"src"),"src");
|
2000-01-30 10:44:33 +00:00
|
|
|
|
|
|
|
// construct the outer pipeline
|
|
|
|
g_print("constructing the main pipeline\n");
|
|
|
|
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(decodethread));
|
|
|
|
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(queue));
|
2001-02-06 19:39:15 +00:00
|
|
|
gst_bin_add(GST_BIN(pipeline),GST_ELEMENT(play));
|
|
|
|
g_print("connecting main pipeline\n");
|
2000-01-30 10:44:33 +00:00
|
|
|
gst_pad_connect(gst_element_get_pad(decodethread,"src"),
|
|
|
|
gst_element_get_pad(queue,"sink"));
|
|
|
|
gst_pad_connect(gst_element_get_pad(queue,"src"),
|
2001-02-06 19:39:15 +00:00
|
|
|
gst_element_get_pad(play,"sink"));
|
|
|
|
|
2001-10-17 10:21:27 +00:00
|
|
|
#ifndef GST_DISABLE_LOADSAVE
|
2001-02-06 19:39:15 +00:00
|
|
|
xmlSaveFile("ac3play.gst", gst_xml_write(GST_ELEMENT(pipeline)));
|
2001-10-17 10:21:27 +00:00
|
|
|
#endif
|
2000-01-30 10:44:33 +00:00
|
|
|
|
|
|
|
// set thread start state
|
2001-06-25 01:20:11 +00:00
|
|
|
g_object_set(G_OBJECT(decodethread),"create_thread",TRUE,NULL);
|
2000-01-30 10:44:33 +00:00
|
|
|
|
2000-08-14 15:17:24 +00:00
|
|
|
g_print("setting to READY state\n");
|
2000-01-30 10:44:33 +00:00
|
|
|
gst_element_set_state(GST_ELEMENT(pipeline),GST_STATE_PLAYING);
|
|
|
|
|
|
|
|
// sleep(1);
|
2001-02-06 19:39:15 +00:00
|
|
|
// g_print("about to enter loop\n");
|
2000-01-30 10:44:33 +00:00
|
|
|
while (1) {
|
2001-02-06 19:39:15 +00:00
|
|
|
gst_bin_iterate(GST_BIN(pipeline));
|
2000-01-30 10:44:33 +00:00
|
|
|
}
|
|
|
|
}
|