title: GStreamer pipeline in C++
body: <p>I have a working GStreamer-1.0 pipeline in terminal and I'm trying to replicate it in code using GStreamer 1.0 on Mac/Xcode. </p>
  
  <p>My sending pipeline:</p>
  
  <pre><code>gst-launch-1.0 videotestsrc ! videoconvert ! x264enc ! rtph264pay config-interval=1 ! udpsink host=127.0.0.1 port=5000
  </code></pre>
  
  <p>My receiving pipeline:</p>
  
  <pre><code>gst-launch-1.0 -vvv udpsrc port=5000 caps="application/x-rtp" ! rtph264depay ! avdec_h264 ! videoconvert ! xvimagesink
  </code></pre>
  
  <p>This can also by played back in VLC with the following SDP file:</p>
  
  <pre><code>v=0
  m=video 5000 RTP/AVP 96
  c=IN IP4 127.0.0.1
  a=rtpmap:96 H264/90000
  </code></pre>
  
  <p>I've created the following code to replicate the aforementioned but the problem is that the receiving pipeline doesn't display anything while running this code. The code does send packets to the network according to the Xcode debug console.</p>
  
  <pre><code>gint
  main (gint   argc,
        gchar *argv[])
  {
      GstElement *pipeline, *videosrc, *conv,*enc, *pay, *udp;
  
      // init GStreamer
      gst_init (&amp;argc, &amp;argv);
      loop = g_main_loop_new (NULL, FALSE);
  
      // setup pipeline
      pipeline = gst_pipeline_new ("pipeline");
  
      videosrc = gst_element_factory_make ("videotestsrc", "source");
  
      conv = gst_element_factory_make ("videoconvert", "conv");
  
      enc = gst_element_factory_make("x264enc", "enc");
  
      pay = gst_element_factory_make("rtph264pay", "pay");
      g_object_set(G_OBJECT(pay), "config-interval", 1, NULL);
  
      udp = gst_element_factory_make("udpsink", "udp");
      g_object_set(G_OBJECT(udp), "host", "127.0.0.1", NULL);
      g_object_set(G_OBJECT(udp), "port", "5000", NULL);
  
      gst_bin_add_many (GST_BIN (pipeline), videosrc, conv, enc, pay, udp, NULL);
  
      if (gst_element_link_many (videosrc, conv, enc, pay, udp, NULL) != TRUE)
      {
          return -1;
      }
  
      // play
      gst_element_set_state (pipeline, GST_STATE_PLAYING);
  
      g_main_loop_run (loop);
  
      // clean up
      gst_element_set_state (pipeline, GST_STATE_NULL);
      gst_object_unref (GST_OBJECT (pipeline));
      g_main_loop_unref (loop);
  
      return 0;
  }
  </code></pre>