[gst-devel] Having Problems with a modified hello world.
Bob Doan
bdoan at sicompos.com
Thu May 29 09:40:02 CEST 2003
Hi All,
I'm trying to make gstreamer convert mp3's to wav's
I can get it to work from the command line with
gst-launch filesrc location=test.mp3 ! mad ! wavenc ! filesink
location=test.wav
However I can't seem to make it work in c
It seems to fail on the gst_element_set_state and I'm not sure why
(my appologies if this is a really stupid question but I could not find
any documentation on how to do this)
Any help would be greatly appreciated!!!
Thanks in advance
- Bob
#include <gst/gst.h>
int
main (int argc, char *argv[])
{
GstElement *pipeline, *filesrc, *decoder, *encoder, *filesink;
int res;
gst_init(&argc, &argv);
if (argc != 2) {
g_print ("usage: %s <mp3 filename>\n", argv[0]);
exit (-1);
}
pipeline = gst_pipeline_new ("pipeline");
filesrc = gst_element_factory_make ("filesrc", "disk_source");
g_object_set (G_OBJECT (filesrc), "location", argv[1], NULL);
decoder = gst_element_factory_make ("mad", "decoder");
encoder = gst_element_factory_make ("wavenc", "encoder");
filesink = gst_element_factory_make ("filesink", "sink");
g_object_set (G_OBJECT (filesrc), "location", "test.wav", NULL);
gst_bin_add_many (GST_BIN (pipeline), filesrc, decoder, encoder,
filesink, NULL);
res = gst_element_link_many (filesrc, decoder, encoder, filesink,
NULL);
res = gst_element_set_state (pipeline, GST_STATE_READY);
while (gst_bin_iterate (GST_BIN (pipeline)));
gst_element_set_state (pipeline, GST_STATE_NULL);
gst_object_unref (GST_OBJECT (pipeline));
exit (0);
}
More information about the gstreamer-devel
mailing list