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