2000-01-30 10:44:33 +00:00
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
void eof(GstSrc *src) {
|
|
|
|
g_print("have eof, quitting\n");
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc,char *argv[]) {
|
|
|
|
GList *factories;
|
|
|
|
GstElementFactory *parsefactory;
|
2001-03-24 17:22:03 +00:00
|
|
|
GstElement *bin, *disksrc, *parse, *osssink;
|
2000-01-30 10:44:33 +00:00
|
|
|
GList *padlist;
|
|
|
|
guchar *filename;
|
|
|
|
int i;
|
|
|
|
|
|
|
|
if (argc == 2)
|
|
|
|
filename = argv[1];
|
|
|
|
else
|
|
|
|
filename = "ctp2.mp3";
|
|
|
|
|
|
|
|
gst_init(&argc,&argv);
|
|
|
|
gst_plugin_load_all();
|
|
|
|
g_print("\n");
|
|
|
|
|
|
|
|
bin = gst_bin_new("bin");
|
|
|
|
|
|
|
|
disksrc = gst_disksrc_new("disksrc");
|
|
|
|
g_print("created disksrc\n");
|
|
|
|
gtk_object_set(GTK_OBJECT(disksrc),"location",filename,NULL);
|
|
|
|
gtk_object_set(GTK_OBJECT(disksrc),"bytesperread",1048576,NULL);
|
|
|
|
|
|
|
|
/* now it's time to get the parser */
|
|
|
|
parsefactory = gst_plugin_find_elementfactory("xing");
|
|
|
|
parse = gst_elementfactory_create(parsefactory,"parser");
|
|
|
|
if (parse == NULL) {
|
|
|
|
g_print("sorry, couldn't create parser\n");
|
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2001-03-24 17:22:03 +00:00
|
|
|
osssink = gst_osssink_new("osssink");
|
2000-01-30 10:44:33 +00:00
|
|
|
|
|
|
|
gtk_signal_connect(GTK_OBJECT(disksrc),"eof",
|
|
|
|
GTK_SIGNAL_FUNC(eof),NULL);
|
|
|
|
|
|
|
|
/* add objects to the main pipeline */
|
|
|
|
gst_bin_add(GST_BIN(bin),GST_OBJECT(disksrc));
|
|
|
|
gst_bin_add(GST_BIN(bin),GST_OBJECT(parse));
|
2001-03-24 17:22:03 +00:00
|
|
|
gst_bin_add(GST_BIN(bin),GST_OBJECT(osssink));
|
2000-01-30 10:44:33 +00:00
|
|
|
|
|
|
|
/* connect src to sink */
|
|
|
|
gst_pad_connect(gst_element_get_pad(disksrc,"src"),
|
|
|
|
gst_element_get_pad(parse,"sink"));
|
|
|
|
gst_pad_connect(gst_element_get_pad(parse,"src"),
|
2001-03-24 17:22:03 +00:00
|
|
|
gst_element_get_pad(osssink,"sink"));
|
2000-01-30 10:44:33 +00:00
|
|
|
|
|
|
|
for (i=0;i<4;i++) {
|
|
|
|
g_print("\n");
|
|
|
|
gst_disksrc_push(GST_SRC(disksrc));
|
|
|
|
}
|
|
|
|
|
2001-03-24 17:22:03 +00:00
|
|
|
gst_object_destroy(GST_OBJECT(osssink));
|
2000-01-30 10:44:33 +00:00
|
|
|
gst_object_destroy(GST_OBJECT(parse));
|
|
|
|
gst_object_destroy(GST_OBJECT(disksrc));
|
|
|
|
gst_object_destroy(GST_OBJECT(bin));
|
|
|
|
}
|
|
|
|
|