<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
  <meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
</head>
<body bgcolor="#ffffff" text="#000000">
wavparse element has 'sometimes' src pads so you can't just do
gst_element_link (wavparse, convert);<br>
See <a
 href="http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html">http://gstreamer.freedesktop.org/data/doc/gstreamer/head/manual/html/index.html</a>
section 8.1.1 how to handle it.<br>
<br>
Tiago Katcipis wrote:
<blockquote
 cite="mid:60a9403b0905070623u10c8e5f8yd8371552931351e1@mail.gmail.com"
 type="cite">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.<br>
  <br>
The gst-launch comand:<br>
gst-launch filesrc location="exemploWav.wav" ! wavparse ! audioconvert
! gconfaudiosink<br>
  <br>
The source code that builds the same pipe (or at least it should build):<br>
#include &lt;gst/gst.h&gt;<br>
#include &lt;glib.h&gt;<br>
  <br>
static gboolean<br>
bus_call (GstBus&nbsp;&nbsp;&nbsp;&nbsp; *bus,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GstMessage *msg,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gpointer&nbsp;&nbsp;&nbsp; data)<br>
{<br>
&nbsp; GMainLoop *loop = (GMainLoop *) data;<br>
  <br>
&nbsp; switch (GST_MESSAGE_TYPE (msg)) {<br>
  <br>
&nbsp;&nbsp;&nbsp; case GST_MESSAGE_EOS:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print ("End of stream\n");<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_main_loop_quit (loop);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
  <br>
&nbsp;&nbsp;&nbsp; case GST_MESSAGE_ERROR: {<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gchar&nbsp; *debug;<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; GError *error;<br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; gst_message_parse_error (msg, &amp;error, &amp;debug);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_free (debug);<br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_printerr ("Error: %s\n", error-&gt;message);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_error_free (error);<br>
  <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_main_loop_quit (loop);<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
&nbsp;&nbsp;&nbsp; }<br>
&nbsp;&nbsp;&nbsp; default:<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; g_print("Teste.....[%d]\n", GST_MESSAGE_TYPE (msg));<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; break;<br>
&nbsp; }<br>
  <br>
&nbsp; return TRUE;<br>
}<br>
  <br>
int<br>
main (int&nbsp;&nbsp; argc,<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; char *argv[])<br>
{<br>
&nbsp; GMainLoop *loop;<br>
  <br>
&nbsp; GstElement *pipeline, *source, *sink, *convert, *wavparse;<br>
&nbsp; GstBus *bus;<br>
  <br>
&nbsp; /* Initialisation */<br>
&nbsp; gst_init (&amp;argc, &amp;argv);<br>
  <br>
&nbsp; loop = g_main_loop_new (NULL, FALSE);<br>
  <br>
&nbsp; /* Check input arguments */<br>
&nbsp; if (argc != 2) {<br>
&nbsp;&nbsp;&nbsp; g_printerr ("Usage: %s &lt;Wav filename&gt;\n", argv[0]);<br>
&nbsp;&nbsp;&nbsp; return -1;<br>
&nbsp; }<br>
  <br>
&nbsp; /* Create gstreamer elements */<br>
&nbsp; pipeline = gst_pipeline_new ("wav_player");<br>
&nbsp; source&nbsp;&nbsp; = gst_element_factory_make ("filesrc",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "file_source");<br>
&nbsp; wavparse = gst_element_factory_make ("wavparse",&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; "wav_parser");<br>
&nbsp; convert&nbsp; = gst_element_factory_make ("audioconvert",&nbsp;
"audio_convert");<br>
&nbsp; sink&nbsp;&nbsp;&nbsp;&nbsp; = gst_element_factory_make ("gconfaudiosink","gnome_output");<br>
  <br>
&nbsp; if (!pipeline || !source || !sink || !convert || !wavparse ) {<br>
&nbsp;&nbsp;&nbsp; g_printerr ("One element could not be created. Exiting.\n");<br>
&nbsp;&nbsp;&nbsp; return -1;<br>
&nbsp; }<br>
  <br>
&nbsp; /* Set up the pipeline */<br>
&nbsp; /* we set the input filename to the source element */<br>
&nbsp; g_object_set (G_OBJECT (source), "location", argv[1], NULL);<br>
  <br>
&nbsp; /* we add a message handler */<br>
&nbsp; bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));<br>
&nbsp; gst_bus_add_watch (bus, bus_call, loop);<br>
&nbsp; gst_object_unref (bus);<br>
  <br>
&nbsp; /* we add all elements into the pipeline */<br>
&nbsp; gst_bin_add_many (GST_BIN (pipeline),<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; source, convert, wavparse, sink, NULL);<br>
  <br>
&nbsp; /* we link the elements together */<br>
&nbsp; gst_element_link (source, wavparse);<br>
&nbsp; gst_element_link (wavparse, convert);<br>
&nbsp; gst_element_link (convert, sink);<br>
&nbsp; <br>
&nbsp; <br>
&nbsp; /* Set the pipeline to "playing" state*/<br>
&nbsp; g_print ("Now playing: %s\n", argv[1]);<br>
&nbsp; gst_element_set_state (pipeline, GST_STATE_PLAYING);<br>
  <br>
  <br>
&nbsp; /* Iterate */<br>
&nbsp; g_print ("Running...\n");<br>
&nbsp; g_main_loop_run (loop);<br>
  <br>
&nbsp; /* Out of the main loop, clean up nicely */<br>
&nbsp; g_print ("Returned, stopping playback\n");<br>
&nbsp; gst_element_set_state (pipeline, GST_STATE_NULL);<br>
  <br>
&nbsp; g_print ("Deleting pipeline\n");<br>
&nbsp; gst_object_unref (GST_OBJECT (pipeline));<br>
  <br>
&nbsp; return 0;<br>
}<br>
  <br>
The error:<br>
Error: Erro no fluxo interno de dados. (something like "Error on
internal data flow").<br>
  <br>
best regards,<br>
Katcipis<br>
  <pre wrap="">
<hr size="4" width="90%">
------------------------------------------------------------------------------
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. <a class="moz-txt-link-freetext" href="http://p.sf.net/sfu/kodak-com">http://p.sf.net/sfu/kodak-com</a></pre>
  <pre wrap="">
<hr size="4" width="90%">
_______________________________________________
gstreamer-devel mailing list
<a class="moz-txt-link-abbreviated" href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a>
<a class="moz-txt-link-freetext" href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a>
  </pre>
</blockquote>
<br>
</body>
</html>