2000-01-30 10:44:33 +00:00
|
|
|
#include <glib.h>
|
|
|
|
#include <gst/gst.h>
|
|
|
|
|
|
|
|
void eof(GstSrc *src) {
|
|
|
|
g_print("have eof, quitting\n");
|
|
|
|
exit(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int main(int argc,char *argv[]) {
|
2001-03-24 17:22:03 +00:00
|
|
|
GstElement *bin, *disksrc, *p, *osssink;
|
2000-01-30 10:44:33 +00:00
|
|
|
GList *padlist;
|
|
|
|
|
|
|
|
gst_init(&argc,&argv);
|
|
|
|
|
|
|
|
bin = gst_bin_new("bin");
|
|
|
|
|
|
|
|
disksrc = gst_disksrc_new("disksrc");
|
|
|
|
g_print("created disksrc\n");
|
|
|
|
if (argc == 2)
|
|
|
|
gst_disksrc_set_filename(disksrc,argv[1]);
|
|
|
|
else
|
|
|
|
gst_disksrc_set_filename(disksrc,"mendelssohn.1.raw");
|
|
|
|
gst_disksrc_set_bytesperread(disksrc,32768);
|
|
|
|
g_print("loaded file '%s'\n",gst_disksrc_get_filename(disksrc));
|
|
|
|
|
|
|
|
p = gst_plugin_find_elementfactory("pipe");
|
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(p));
|
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(p,"sink"));
|
|
|
|
gst_pad_connect(gst_element_get_pad(p,"src"),
|
2001-03-24 17:22:03 +00:00
|
|
|
gst_element_get_pad(osssink,"sink"));
|
2000-01-30 10:44:33 +00:00
|
|
|
|
|
|
|
/* set soundcard properties */
|
2001-03-24 17:22:03 +00:00
|
|
|
gst_osssink_set_format(GST_AUDIOSINK(osssink),AFMT_S16_BE);
|
|
|
|
gst_osssink_set_channels(GST_AUDIOSINK(osssink),2);
|
|
|
|
gst_osssink_set_frequency(GST_AUDIOSINK(osssink),44100);
|
2000-01-30 10:44:33 +00:00
|
|
|
|
|
|
|
while(1)
|
|
|
|
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(disksrc));
|
|
|
|
gst_object_destroy(GST_OBJECT(bin));
|
|
|
|
}
|
|
|
|
|