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=&quot;exemploWav.wav&quot; ! 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     *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 (&quot;End of stream\n&quot;);<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, &amp;error, &amp;debug);<br>
      g_free (debug);<br><br>      g_printerr (&quot;Error: %s\n&quot;, error-&gt;message);<br>      g_error_free (error);<br><br>      g_main_loop_quit (loop);<br>      break;<br>    }<br>    default:<br>      g_print(&quot;Teste.....[%d]\n&quot;, 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 (&amp;argc, &amp;argv);<br><br>  loop = g_main_loop_new (NULL, FALSE);<br><br>  /* Check input arguments */<br>  if (argc != 2) {<br>    g_printerr (&quot;Usage: %s &lt;Wav filename&gt;\n&quot;, argv[0]);<br>
    return -1;<br>  }<br><br>  /* Create gstreamer elements */<br>  pipeline = gst_pipeline_new (&quot;wav_player&quot;);<br>  source   = gst_element_factory_make (&quot;filesrc&quot;,       &quot;file_source&quot;);<br>  wavparse = gst_element_factory_make (&quot;wavparse&quot;,      &quot;wav_parser&quot;);<br>
  convert  = gst_element_factory_make (&quot;audioconvert&quot;,  &quot;audio_convert&quot;);<br>  sink     = gst_element_factory_make (&quot;gconfaudiosink&quot;,&quot;gnome_output&quot;);<br><br>  if (!pipeline || !source || !sink || !convert || !wavparse ) {<br>
    g_printerr (&quot;One element could not be created. Exiting.\n&quot;);<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), &quot;location&quot;, 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 &quot;playing&quot; state*/<br>  g_print (&quot;Now playing: %s\n&quot;, argv[1]);<br>  gst_element_set_state (pipeline, GST_STATE_PLAYING);<br><br>
<br>  /* Iterate */<br>  g_print (&quot;Running...\n&quot;);<br>  g_main_loop_run (loop);<br><br>  /* Out of the main loop, clean up nicely */<br>  g_print (&quot;Returned, stopping playback\n&quot;);<br>  gst_element_set_state (pipeline, GST_STATE_NULL);<br>
<br>  g_print (&quot;Deleting pipeline\n&quot;);<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 &quot;Error on internal data flow&quot;).<br>
<br>best regards,<br>Katcipis<br>