Writing gstreamer pipeline in c

When I use the following pipelines:

gst-launch-1.0 udpsrc port=5000 ! application/x-rtp,encoding-name=H264,payload=96 ! rtph264depay ! h264parse ! avdec_h264 ! autovideosink


gst-launch-1.0 v4l2src !  video/x-raw,width=640,height=480 !  x264enc tune=zerolatency byte-stream=true  bitrate=3000 threads=2 !  h264parse config-interval=1 !  rtph264pay ! udpsink host= port=5000

it works well: I get a video on the client screen of my server webcam.
But if I try to replace the server pipeline by the following code:

    <#include <gst/gst.h>

static GMainLoop *loop;

main (gint   argc,
      gchar *argv[])
  GstElement *pipeline;
  GstElement *source, *capsfilter, *rtp, *parse, *dec, *sink;

  /* init */
  gst_init (&argc, &argv);

  /* create pipeline, add handler */
  pipeline = gst_pipeline_new ("my_pipeline");

    // create elements
    //source = gst_element_factory_make("v4l2src", "source");
    source = gst_element_factory_make("udpsrc", "source");
    g_object_set(G_OBJECT(source), "port", 5001, NULL);
        capsfilter = gst_element_factory_make("capsfilter","cfilter");
        g_object_set(G_OBJECT(capsfilter),"caps",gst_caps_new_simple("application/x-rtp","payload",G_TYPE_INT,96, "encodingname",G_TYPE_STRING,"H264",NULL),NULL);
        rtp = gst_element_factory_make("rtph264depay","rtp_depayload");
    parse = gst_element_factory_make("h264parse","parser");
    dec = gst_element_factory_make("avdec_h264","decoder");
    sink = gst_element_factory_make("autovideosink", "sink");
    // add to pipeline before linking
    gst_bin_add_many(GST_BIN(pipeline), source, capsfilter, rtp, parse, dec, sink, NULL);
    // link
    if (!gst_element_link_many(source, capsfilter, rtp, parse, dec, sink, NULL)) {
        g_warning("Failed to link elements");
    // start playing
    gst_element_set_state (GST_ELEMENT (pipeline), GST_STATE_PLAYING);

  /* create a mainloop that runs/iterates the default GLib main context
   * (context NULL), in other words: makes the context check if anything
   * it watches for has happened. When a message has been posted on the
   * bus, the default main context will automatically call our
   * my_bus_callback() function to notify us of that message.
   * The main loop will be run until someone calls g_main_loop_quit()
  loop = g_main_loop_new (NULL, FALSE);
  g_main_loop_run (loop);

  /* clean up */
  gst_element_set_state (pipeline, GST_STATE_NULL);
  gst_object_unref (pipeline);
  g_main_loop_unref (loop);

  return 0;

I do not get any video.
What do I do wrong?