Help - I can't make code from simple gst-launch pipeline

David Kosir kosirdavid at gmail.com
Sun Apr 1 19:57:32 PDT 2012


This is pipeline I wan't to write in C.

gst-launch-0.10 udpsrc port=1234 multicast-group=239.0.0.1
caps="application/x-rtp,media=(string)video,clock-rate=(int)90000,payload=(int)96"
! .recv_rtp_sink_0 gstrtpbin latency=400 ! rtpmp2tdepay ! flutsdemux !
ffdec_mpeg2video ! xvimagesink

It is tested and working.

This is part of code that is not working for me. I suppose that it is
something trivial, but I can't find where mistake is.

-----------------------------------------------------------
    GstElement    *src;
    GstElement    *rtp;
    GstElement    *depay;
    GstElement    *demux;
    GstElement    *decode;
    GstElement    *deinter;
    GstElement    *sink;
    GstPad        *srcpad;
    GstPad        *sinkpad;

    player->texture = g_object_new (CLUTTER_TYPE_TEXTURE,
"disable-slicing", TRUE, NULL);
    player->pipeline = GST_PIPELINE(gst_pipeline_new ("player"));

    src        = gst_element_factory_make("udpsrc",            "src");
    g_object_set(src, "port", 1234, NULL);
    g_object_set(src, "multicast-group", location, NULL);
    g_object_set(src, "caps", gst_caps_from_string (RTP_CAPS), NULL);
    rtp        = gst_element_factory_make("gstrtpbin",        "rtp");
    g_object_set(rtp, "latency", latency, NULL);
    depay    = gst_element_factory_make("rtpmp2tdepay",    "depay");
    demux    = gst_element_factory_make("flutsdemux",        "demux");
    decode    = gst_element_factory_make("ffdec_mpeg2video","decode");
    deinter    = gst_element_factory_make("ffdeinterlace",    "deinter");
    sink    = clutter_gst_video_sink_new(CLUTTER_TEXTURE (player->texture));

    if (!src || !rtp || !depay || !demux || !decode || !deinter || !sink){
        g_error("failde to create all elements");
        return EXIT_FAILURE;
    }

    gst_bin_add_many(GST_BIN(player->pipeline), src, rtp, depay,
demux, decode, deinter, sink, NULL);

    srcpad  = gst_element_get_static_pad (src, "src");
    sinkpad = gst_element_get_request_pad (rtp, "recv_rtcp_sink_0");
    if (!gst_pad_link (srcpad, sinkpad))
        g_error("can't link");
    gst_object_unref (srcpad);
    gst_object_unref (sinkpad);

    gst_element_link_many(decode, deinter, sink, NULL);
    gst_element_link(depay, demux);
// THESE TWO SIGNALS NEVER EMIT
    g_signal_connect(rtp, "pad-added", G_CALLBACK(on_pad_added), depay);
    g_signal_connect(demux, "pad-added", G_CALLBACK(on_pad_added), decode);
-----------------------------------------------------------


More information about the gstreamer-devel mailing list