[gst-devel] How to specify type of sink or src pad in gstrtpbin

Thomas Winkler wi-tom at gmx.de
Thu Jun 26 19:23:55 CEST 2008

Thanks a lot !


That's exactly what I was looking for and UDPSink/UDPSrc now connects to my
RtpBin correct.

But I have one more problem.


The following two elements wouldn't connect on this way:


GstElement* m_gstrtpbin = gst_element_factory_make("gstrtpbin", "rtpbin");

GstElement* m_udpsource = gst_element_factory_make("udpsrc", "udpsource");

GstElement* m_depayloader = gst_element_factory_make("rtph263pdepay",


GstPad* rtp_receiverSrc = gst_element_get_request_pad(m_gstrtpbin,

GstPad* rtp_receiverSink = gst_element_get_request_pad(m_gstrtpbin,

GstPad* udpsourceSrc = gst_element_get_static_pad(m_udpsource, "src");

GstPad* depayloaderSink = gst_element_get_static_pad(m_depayloader, "sink");


gst_pad_link(udpsourceSrc, rtp_receiverSink);              <---------- works

gst_pad_link(rtp_receiverSrc, depayloaderSink);            <---------- at
this point the app crashes




Ok, I've read the Reference again and I saw that the "recv_rtp_src" has the
Availability-Prop "Sometimes" which means that the Pad is created dynamical
when a Stream comes in.

So I decided to add a signal-watch function:


static GstElement* m_vid_depayloader = m_depayloader;


static void cb_new_pad(GstElement* element, GstPad* pad, gpointer data)


gchar* name;


      name = gst_pad_get_name(pad);

      g_print("A new pad %s was created\n", name);



GstPad* vidDepayloadSink = gst_element_get_static_pad(m_vid_depayloader,

      gst_pad_link(pad, vidDepayloadSink);



And in my Application I added the signal-watcher:


g_signal_connect (m_gstrtpbin, "?????", G_CALLBACK (cb_new_pad), NULL);


But what signal is the right signal for my pad-creation?

gstrtbin has only: "request-pt-map", "on-new-ssrc", "on-ssrc-collision",
"on-ssrc-validated", "on-ssrc-active", "on-ssrc-sdes", "on-bye-ssrc",
"on-bye-timeout", "on-timeout"




Do I have the change to force a creation of a pad or do I have to connect
them in another way?


Hope someone can help me.






Von: Sreejesh [mailto:sreejesh at multitech.co.in] 
Gesendet: Donnerstag, 26. Juni 2008 07:40
An: 'Thomas Winkler'; gstreamer-devel at lists.sourceforge.net
Betreff: RE: [gst-devel] How to specify type of sink or src pad in gstrtpbin




I think "send_rtp_src_%d" is available to you after you request for

Again gstrtpbin to uspsink direction should be.


Gstrtpbin (src) -> m_udp_rtp_sink (sink)

The following example might be helpful to you.


*gchar *tmpStr;


/* Get the sink pad for id */

tmpStr = g_strdup_printf ("send_rtp_sink_%u",id); /* You can use the numbers
0,1,..for id*/

send_rtp_sink = gst_element_get_request_pad (m_gstrtpbin,tmpStr);

g_free (tmpStr);


/* Get the source pad for id */

tmpStr = g_strdup_printf ("send_rtp_src_%u",id); /* You can use the numbers
0,1,..for id*/

send_rtp_src = gst_element_get_pad (m_gstrtpbin,tmpStr);


/* Create the udp sink and set the properties here */


/* Now get the static sink pad from udpsink */

tmp_pad = gst_element_get_static_pad (m_udp_rtp_sink,"sink");


/* Link the pads */

gst_pad_link (send_rtp_src,tmp_pad);


Hope it helps.



Sreejesh R B

Sr. Project Lead.

Multitech Software Systems India Pvt. Ltd.

Bangalore, India




From: gstreamer-devel-bounces at lists.sourceforge.net
[mailto:gstreamer-devel-bounces at lists.sourceforge.net] On Behalf Of Thomas
Sent: Wednesday, June 25, 2008 9:51 PM
To: gstreamer-devel at lists.sourceforge.net
Subject: [gst-devel] How to specify type of sink or src pad in gstrtpbin



is there any way to specify the type of the sink or src pad in gstrtpbin?


I'm trying to specify the rtp and rtcp pads while linking.


My code below:


gst_init(0, 0);


GMainLoop* m_mainLoop = g_main_loop_new(NULL,FALSE);

GstElement* m_bin = gst_pipeline_new("pipe");

GstElement* m_gstrtpbin = gst_element_factory_make("gstrtpbin", "rtpbin");


GstElement* m_video_pipe = createVideoPipe();

// the createVideoPipe()-method creates a separate pipeline

// adds and link all elements to the pipeline and returns the created


gst_bin_add(GST_BIN(m_gstrtpbin), m_video_pipe);

// here I add the created video-pipeline to my gstrtpbin


GstElement* m_udp_rtp_sink = createUdpRtpSink();

      // the createUdpRtpSink()-method creates a pipeline within a
UdpSink-Element, adds + link all elements and returns the pipe


GstElement* m_udp_rtcp_sink = createUdpRtcpSink();

      // the createUdpRtcpSink()-method creates a pipeline within a
UdpSink-Element, adds + link all elements and returns the pipe


GstElement* m_udp_rtcp_src = createUdpRtcpSrc();

      // the createUdpRtcpSrc()-method creates a pipeline within a
UdpSrc-Element, adds + link all elements and returns the pipe


// finally I add the the 3 Upd-Elements to my gstrtpbin

gst_bin_add(GST_BIN(m_gstrtpbin), m_udp_rtp_sink);

gst_bin_add(GST_BIN(m_gstrtpbin), m_udp_rtcp_sink);

gst_bin_add(GST_BIN(m_gstrtpbin), m_udp_rtcp_src);


// now comes my problem with linking the pipes to the gstrtpbin sinks and

// if I try following the links does not work:


gst_element_link_pads(m_udp_rtp_sink, "src", m_gstrtpbin,


// the problem is that gstrtpbin has no "send_rtp_src_%d" pad.





My Question is how to specify the type and number of the sink or src pads in

I will exclusive specify, that my payloader should connect the
"send_rtp_sink_0" and the UdpSink for this should connect to

Also my RtcpSender UdpSink should connect to "send_rtcp_src_0" and the
RtcpReceiver UdpSrc should connect to "send_rtcp_sink_0"


Is there a way to specify this?




__________ NOD32 3216 (20080625) Information __________

Diese E-Mail wurde vom NOD32 antivirus system gepr|ft

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/gstreamer-devel/attachments/20080626/3b983395/attachment.htm>

More information about the gstreamer-devel mailing list