[gst-devel] Odd problem playing wav file
Tiago Katcipis
katcipis at inf.ufsc.br
Thu May 7 17:35:04 CEST 2009
thanks fot the hints Wim. Im going to read more before posting now.
On Thu, May 7, 2009 at 12:19 PM, Wim Taymans <wim.taymans at gmail.com> wrote:
> On Thu, 2009-05-07 at 10:23 -0300, Tiago Katcipis wrote:
> > Im having some trouble making a wav player, when i try to build the
> > pipeline using gst-launch it works fine, but the source code building
> > the same pipeline generates an error. Im sorry if the question is
> > stupid, im new at gstreamer and im not getting what im doing
> > wrong :-(. I followed an example i found on gstreamer documentation.
> >
> > The gst-launch comand:
> > gst-launch filesrc location="exemploWav.wav" ! wavparse !
> > audioconvert ! gconfaudiosink
>
> Hi,
>
> Check the result codes from various methods (hint some elements will not
> link correctly. Another hint, read some more about dynamic pads)
>
> Wim
> >
> > The source code that builds the same pipe (or at least it should
> > build):
> > #include <gst/gst.h>
> > #include <glib.h>
> >
> > static gboolean
> > bus_call (GstBus *bus,
> > GstMessage *msg,
> > gpointer data)
> > {
> > GMainLoop *loop = (GMainLoop *) data;
> >
> > switch (GST_MESSAGE_TYPE (msg)) {
> >
> > case GST_MESSAGE_EOS:
> > g_print ("End of stream\n");
> > g_main_loop_quit (loop);
> > break;
> >
> > case GST_MESSAGE_ERROR: {
> > gchar *debug;
> > GError *error;
> >
> > gst_message_parse_error (msg, &error, &debug);
> > g_free (debug);
> >
> > g_printerr ("Error: %s\n", error->message);
> > g_error_free (error);
> >
> > g_main_loop_quit (loop);
> > break;
> > }
> > default:
> > g_print("Teste.....[%d]\n", GST_MESSAGE_TYPE (msg));
> > break;
> > }
> >
> > return TRUE;
> > }
> >
> > int
> > main (int argc,
> > char *argv[])
> > {
> > GMainLoop *loop;
> >
> > GstElement *pipeline, *source, *sink, *convert, *wavparse;
> > GstBus *bus;
> >
> > /* Initialisation */
> > gst_init (&argc, &argv);
> >
> > loop = g_main_loop_new (NULL, FALSE);
> >
> > /* Check input arguments */
> > if (argc != 2) {
> > g_printerr ("Usage: %s <Wav filename>\n", argv[0]);
> > return -1;
> > }
> >
> > /* Create gstreamer elements */
> > pipeline = gst_pipeline_new ("wav_player");
> > source = gst_element_factory_make ("filesrc",
> > "file_source");
> > wavparse = gst_element_factory_make ("wavparse", "wav_parser");
> > convert = gst_element_factory_make ("audioconvert",
> > "audio_convert");
> > sink = gst_element_factory_make
> > ("gconfaudiosink","gnome_output");
> >
> > if (!pipeline || !source || !sink || !convert || !wavparse ) {
> > g_printerr ("One element could not be created. Exiting.\n");
> > return -1;
> > }
> >
> > /* Set up the pipeline */
> > /* we set the input filename to the source element */
> > g_object_set (G_OBJECT (source), "location", argv[1], NULL);
> >
> > /* we add a message handler */
> > bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
> > gst_bus_add_watch (bus, bus_call, loop);
> > gst_object_unref (bus);
> >
> > /* we add all elements into the pipeline */
> > gst_bin_add_many (GST_BIN (pipeline),
> > source, convert, wavparse, sink, NULL);
> >
> > /* we link the elements together */
> > gst_element_link (source, wavparse);
> > gst_element_link (wavparse, convert);
> > gst_element_link (convert, sink);
> >
> >
> > /* Set the pipeline to "playing" state*/
> > g_print ("Now playing: %s\n", argv[1]);
> > gst_element_set_state (pipeline, GST_STATE_PLAYING);
> >
> >
> > /* Iterate */
> > g_print ("Running...\n");
> > g_main_loop_run (loop);
> >
> > /* Out of the main loop, clean up nicely */
> > g_print ("Returned, stopping playback\n");
> > gst_element_set_state (pipeline, GST_STATE_NULL);
> >
> > g_print ("Deleting pipeline\n");
> > gst_object_unref (GST_OBJECT (pipeline));
> >
> > return 0;
> > }
> >
> > The error:
> > Error: Erro no fluxo interno de dados. (something like "Error on
> > internal data flow").
> >
> > best regards,
> > Katcipis
> >
> ------------------------------------------------------------------------------
> > The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> > production scanning environment may not be a perfect world - but thanks
> to
> > Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
> i700
> > Series Scanner you'll get full speed at 300 dpi even with all image
> > processing features enabled. http://p.sf.net/sfu/kodak-com
> > _______________________________________________ gstreamer-devel mailing
> list gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
>
>
> ------------------------------------------------------------------------------
> The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your
> production scanning environment may not be a perfect world - but thanks to
> Kodak, there's a perfect scanner to get the job done! With the NEW KODAK
> i700
> Series Scanner you'll get full speed at 300 dpi even with all image
> processing features enabled. http://p.sf.net/sfu/kodak-com
> _______________________________________________
> gstreamer-devel mailing list
> gstreamer-devel at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/gstreamer-devel
>
--
"it might be a profitable thing to learn Java, but it has no intellectual
value whatsoever" Alexander Stepanov
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20090507/8a0079cc/attachment.htm>
More information about the gstreamer-devel
mailing list