[gst-devel] Gstreamer App equivalent of gst-launch command line

Deeptendu Bikash dbikash at gmail.com
Fri Aug 11 09:17:14 CEST 2006


Hi,

I want to write a gstreamer app of the following command line:
gst-launch udpsrc port=1234 ! application/x-rtp ! rtph263pdepay ! ffdec_h263
! xvimagesink
in order to play a H.263+ encoded video received from a RTP source.

The code in my main function is as follows:
gint main(gint argc, gchar *argv[])
{
    GstElement *pipeline, *udpsrc, *depayloader, *decoder, *sink;
    GMainLoop *loop;
    gint value = atoi(argv[1]);

    gst_init(&argc, &argv);
    loop = g_main_loop_new(NULL, FALSE);
    if(argc != 2){ g_print("Usage: %s <port>\n", argv[0]);  return 0;  }

    pipeline = gst_pipeline_new("test_rtpplayer_pipeline");
    gst_bus_add_watch(gst_pipeline_get_bus(GST_PIPELINE(pipeline)), bus_cb,
loop);

    udpsrc = gst_element_factory_make("udpsrc", "testrtpplayer_src");
    depayloader = gst_element_factory_make("rtph263pdepay",
"testrtpplayer_depay");
    decoder = gst_element_factory_make("ffdec_h263", "testrtpplayer_dec");
    sink = gst_element_factory_make("xvimagesink", "testrtpplayer_sink");

    rtpcaps = gst_caps_new_simple("application/x-rtp",  NULL);
    gst_element_link_pads_filtered(udpsrc, "src", depayloader, "sink",
rtpcaps);
    gst_element_link_pads(depayloader, "src", decoder, "sink");
    gst_element_link_pads(decoder, "src", sink, "sink");
    gst_bin_add_many(GST_BIN(pipeline), udpsrc, depayloader, decoder, sink,
NULL);
    gst_element_set_state(pipeline, GST_STATE_PLAYING);
    g_main_loop_run(loop);
    gst_element_set_state(pipeline, GST_STATE_NULL);
    gst_object_unref(GST_OBJECT(pipeline));
    return 0;
}

However, on running this I get the following error:
 GStreamer-CRITICAL **: gst_element_link_pads_filtered: assertion
`GST_IS_BIN (parent)' failed
Error: Internal data flow error.

How could I get this working?

Regards,
Deeptendu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20060811/3a8caacd/attachment.htm>


More information about the gstreamer-devel mailing list