title: How to connect to a UDP video broadcast with GStreamer in C
body: <p>I have a small program that uses the <code>GStreamer</code> library to play videos from local files and videos on webservers using HTTP. How does one go about connecting to a UDP video broadcast in C using <code>GStreamer</code>?</p>
  
  <p>For example, what is required to play the streaming video at this hypothetical URI?
  10.0.11.255:9001</p>
  
  <p>I tried:</p>
  
  <pre><code>// using playbin2 connect to UDP broadcast
  g_object_set (data.playbin2, "uri", "udp://10.0.11.255:9001", NULL);
  </code></pre>
  
  <p>Then I try to start the stream with the following:</p>
  
  <pre><code>/* Start playing */
      if( gst_element_set_state (data.playbin2, GST_STATE_PLAYING) == GST_STATE_CHANGE_FAILURE )
      {
          g_printerr ("Unable to set the pipeline to the playing state.\n");
          gst_object_unref (data.playbin2);
          return( -1 );
      }
  </code></pre>
  
  <p>and I get the failure to change state message.</p>
  
  <p>I've done searches on google and have not found anything useful.</p>
  
  <p>EDIT: After some more googling, I found out about <a href="https://developer.gnome.org/gst-plugins-libs/0.10/gst-plugins-good-plugins-udpsrc.html" rel="nofollow">udpsrc</a>. However, I can't figure out how to use it in C code.</p>