<br><br><div class="gmail_quote">On Mon, Mar 1, 2010 at 1:24 AM, Qin Chen <span dir="ltr">&lt;<a href="mailto:eric.qin.chen@gmail.com">eric.qin.chen@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<span style="font-family:courier new,monospace">Hi experts,<br><br>I am trying to write a pipeline for receiving and decoding H.264 RTP packets. Please see the C codes below. It is basically equivalent to following pipeline.<br>

</span><pre>gst<span>-</span>launch <span>-</span>v gstrtpbin name<span>=</span>rtpbin                                          \<br>    udpsrc caps<span>=</span><span>&quot;application/x-rtp,media=(string)video,clock-rate=(int)90000,encoding-name=(string)H264&quot;</span> \<br>

            port<span>=</span><span>5000</span> <span>!</span> rtpbin<span>.</span>recv_rtp_sink_0                                \<br>        rtpbin<span>. !</span> rtph264depay <span>!</span> ffdec_h264 <span>!</span> xvimagesink                    \<br>

</pre><br><span style="font-family:courier new,monospace">But I couldn&#39;t link gstrtpbin and rtph264depay. The error message is as follows:<br><font size="1">0:00:00.135605335  5934  0x95aa008 INFO        GST_ELEMENT_PADS gstutils.c:1587:gst_element_link_pads: trying to link element gst-rtp-bin:(any) to element rtp-decoder:(any)<br>

0:00:00.135657988  5934  0x95aa008 INFO        GST_ELEMENT_PADS gstelement.c:970:gst_element_get_static_pad: no such pad &#39;recv_rtp_src_%d_%d_%d&#39; in element &quot;gst-rtp-bin&quot;<br>0:00:00.135679108  5934  0x95aa008 INFO        GST_ELEMENT_PADS gstutils.c:1208:gst_element_get_compatible_pad:&lt;gst-rtp-bin&gt; Could not find a compatible pad to link to rtp-decoder:sink</font><br>

<br>Could someone give me some hints? Why I have no &quot;recv_rtp_src_%d_%d_%d&quot;? </span></blockquote><div><br></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><a href="http://www.gstreamer.net/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-gstrtpbin.html">http://www.gstreamer.net/data/doc/gstreamer/head/gst-plugins-good-plugins/html/gst-plugins-good-plugins-gstrtpbin.html</a></font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">as you can see the &quot;recv_rtp_src_%d_%d_%d&quot; pad is created dinamically, you cant get it.</font></div>
<div><font class="Apple-style-span" face="arial, helvetica, sans-serif"><br></font></div><div><font class="Apple-style-span" face="arial, helvetica, sans-serif">&quot;To use </font><a class="link" href="gst-plugins-good-plugins-gstrtpbin.html#GstRtpBin" style="text-decoration: none; color: rgb(52, 101, 164); "><span class="type"><font class="Apple-style-span" face="arial, helvetica, sans-serif">GstRtpBin</font></span></a><font class="Apple-style-span" face="arial, helvetica, sans-serif"> as an RTP receiver, request a recv_rtp_sink_%</font><code class="literal"><font class="Apple-style-span" face="arial, helvetica, sans-serif">d</font></code><font class="Apple-style-span" face="arial, helvetica, sans-serif"> pad. The session number must be specified in the pad name. Data received on the recv_rtp_sink_%</font><code class="literal"><font class="Apple-style-span" face="arial, helvetica, sans-serif">d</font></code><font class="Apple-style-span" face="arial, helvetica, sans-serif"> pad will be processed in the </font><a class="link" href="gst-plugins-good-plugins-gstrtpsession.html#GstRtpSession" style="text-decoration: none; color: rgb(52, 101, 164); "><span class="type"><font class="Apple-style-span" face="arial, helvetica, sans-serif">GstRtpSession</font></span></a><font class="Apple-style-span" face="arial, helvetica, sans-serif"> manager and after being validated forwarded on </font><a class="link" href="gst-plugins-good-plugins-gstrtpssrcdemux.html#GstRtpSsrcDemux" style="text-decoration: none; color: rgb(52, 101, 164); "><span class="type"><font class="Apple-style-span" face="arial, helvetica, sans-serif">GstRtpSsrcDemux</font></span></a><font class="Apple-style-span" face="arial, helvetica, sans-serif"> element. Each RTP stream is demuxed based on the SSRC and send to a </font><a class="link" href="gst-plugins-good-plugins-gstrtpjitterbuffer.html#GstRtpJitterBuffer" style="text-decoration: none; color: rgb(52, 101, 164); "><span class="type"><font class="Apple-style-span" face="arial, helvetica, sans-serif">GstRtpJitterBuffer</font></span></a><font class="Apple-style-span" face="arial, helvetica, sans-serif">. After the packets are released from the jitterbuffer, they will be forwarded to a</font><a class="link" href="gst-plugins-good-plugins-gstrtpssrcdemux.html#GstRtpSsrcDemux" style="text-decoration: none; color: rgb(52, 101, 164); "><span class="type"><font class="Apple-style-span" face="arial, helvetica, sans-serif">GstRtpSsrcDemux</font></span></a><font class="Apple-style-span" face="arial, helvetica, sans-serif"> element. The </font><a class="link" href="gst-plugins-good-plugins-gstrtpssrcdemux.html#GstRtpSsrcDemux" style="text-decoration: none; color: rgb(52, 101, 164); "><span class="type"><font class="Apple-style-span" face="arial, helvetica, sans-serif">GstRtpSsrcDemux</font></span></a><font class="Apple-style-span" face="arial, helvetica, sans-serif"> element will demux the packets based on the payload type and will create a unique pad recv_rtp_src_%</font><code class="literal"><font class="Apple-style-span" face="arial, helvetica, sans-serif">d_</font></code><font class="Apple-style-span" face="arial, helvetica, sans-serif">%</font><code class="literal"><font class="Apple-style-span" face="arial, helvetica, sans-serif">d_</font></code><font class="Apple-style-span" face="arial, helvetica, sans-serif">%</font><code class="literal"><font class="Apple-style-span" face="arial, helvetica, sans-serif">d</font></code><font class="Apple-style-span" face="arial, helvetica, sans-serif"> on gstrtpbin with the session number, SSRC and payload type respectively as the pad name.&quot;</font></div>
<div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"><span style="font-family:courier new,monospace">Or could someone lead me to similar examples? Thanks in advance!<br>
<br>Regards,<br><br>Qin<br><br><br>static</span><br style="font-family:courier new,monospace">
<span style="font-family:courier new,monospace">GstElement* construct_receiver_pipeline(void){</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    GstElement *pipeline, *gstrtpbin, *vdec, *rtpdec, *vsink;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    GstElement *jitterbuf, *vconv;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    GstElement *udpsrc_rtp;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    GstCaps *caps;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    GstPad  *pad;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    gboolean err;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    GstPadLinkReturn res;</span><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    //Create gstrtpbin</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    gstrtpbin = gst_element_factory_make(&quot;gstrtpbin&quot;, &quot;gst-rtp-bin&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    if ( !gstrtpbin ) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        g_printerr(&quot;Failed to create gstrtpbin\n&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        return 0;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    g_object_set(G_OBJECT (jitterbuf), &quot;latency&quot;, jitter_latency, NULL);</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    //RTP ource initialization</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    udpsrc_rtp = gst_element_factory_make(&quot;udpsrc&quot;, &quot;udp-udpsrc_rtp&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    if ( !udpsrc_rtp ) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        g_printerr(&quot;Failed to create udpsrc\n&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        return 0;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    g_object_set(G_OBJECT (udpsrc_rtp), &quot;port&quot;, rtp_port, NULL);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    //gst_caps_new_simple and gst_element_linked_filter don&#39;t work</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    g_object_set(G_OBJECT (udpsrc_rtp), &quot;caps&quot;,</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">            gst_caps_from_string(&quot;application/x-rtp, &quot;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">                    &quot;clock-rate=(int)90000, &quot;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">                    &quot;payload=(int)96, &quot;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">                    &quot;media=(string)video, &quot;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">                    &quot;encoding-name=(string)H264&quot;), NULL);</span><span style="font-family:courier new,monospace"></span><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    //Create video decoder</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    vdec = gst_element_factory_make(vdecoder, &quot;video-decoder&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    if ( !vdec ) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        g_printerr(&quot;Failed to create %s\n&quot;, vdecoder);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        return 0;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    //Choose RTP decoder according to video codec</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    rtpdecoder = g_strdup(select_rtp_decoder(vdecoder));</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    g_free(vdecoder);</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    //Create rtp decoder</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    rtpdec = gst_element_factory_make(rtpdecoder, &quot;rtp-decoder&quot;);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    if ( !rtpdec ) {</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        g_printerr(&quot;Failed to create %s\n&quot;, rtpdecoder);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        return 0;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    //Create video converter</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    vconv = gst_element_factory_make(&quot;ffmpegcolorspace&quot;, &quot;video-converter&quot;);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    if ( !vconv ) {</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        g_printerr(&quot;Failed to create ffmpegcolorspace\n&quot;);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        return 0;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    //Create video sink</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    vsink = gst_element_factory_make(&quot;xvimagesink&quot;, &quot;video-sink&quot;);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    if ( !vsink ) {</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        g_printerr(&quot;Failed to create xvimagesink\n&quot;);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        return 0;</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace"><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    /* Set up the pipeline */</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    gst_bin_add_many(GST_BIN (pipeline), udpsrc_rtp, gstrtpbin/*, jitterbuf*/,</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">            rtpdec, vdec, vconv, vsink, NULL);</span><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    //link udpsrc_rtp to gstrtpbin</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    pad = gst_element_get_request_pad(gstrtpbin, &quot;recv_rtp_sink_%d&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    if ( !pad ) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        g_printerr(&quot;Failed to create pad\n&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        return 0;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    res = gst_pad_link(gst_element_get_pad(udpsrc_rtp, &quot;src&quot;), pad);</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    gst_object_unref(GST_OBJECT (pad));</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    if ( GST_PAD_LINK_FAILED(res)  ) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        g_printerr(&quot;Failed to link pads\n&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        return 0;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    err = gst_element_link_many(gstrtpbin, rtpdec, vdec, vconv, vsink, NULL);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">    if ( err==FALSE ) {</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">        g_printerr(&quot;Failed to link elements\n&quot;);</span><br style="font-family:courier new,monospace">

<span style="font-family:courier new,monospace">        return 0;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    }</span><br style="font-family:courier new,monospace">

<br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">    return pipeline;</span><br style="font-family:courier new,monospace"><span style="font-family:courier new,monospace">}</span><br>

<br>------------------------------------------------------------------------------<br>
Download Intel&amp;#174; Parallel Studio Eval<br>
Try the new software tools for yourself. Speed compiling, find bugs<br>
proactively, and fine-tune applications for parallel performance.<br>
See why Intel Parallel Studio got high marks during beta.<br>
<a href="http://p.sf.net/sfu/intel-sw-dev" target="_blank">http://p.sf.net/sfu/intel-sw-dev</a><br>_______________________________________________<br>
gstreamer-devel mailing list<br>
<a href="mailto:gstreamer-devel@lists.sourceforge.net">gstreamer-devel@lists.sourceforge.net</a><br>
<a href="https://lists.sourceforge.net/lists/listinfo/gstreamer-devel" target="_blank">https://lists.sourceforge.net/lists/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br>