<div>Hi Arnaud,</div>
<div> </div>
<div>I am actually working on a similar application... the purpose is to build a video server that accelerate the decoding phase by taking advantage of GP-GPU capabilities.</div>
<div> </div>
<div>My question is : do you integrate your code in the context of the appsrc-stream.c example?</div>
<div> </div>
<div>I&#39;ll try your code and tell you more if I can... There is no &quot;audiConverter&quot;, right? Have you try your C application with a first step example : no Ranking just as your command line example?</div>
<div> </div>
<div>
<div><span style="WHITE-SPACE: pre-wrap"></span>&quot;    //Sanity check on elements validity</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>    if(!playbin || !vdpauSink || !alsaSink || <strong><u>!audioConverter??</u></strong> || !vdpauVideoPostProcess || !videoOutputBin)</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>    {</div>
<div>        ....</div>
<div>    }</div></div>
<div>&quot;</div>
<div> </div>
<div>Regards.</div>
<div> </div>
<div>Jérémy.</div>
<div>_____________<br><br></div>
<div class="gmail_quote">2011/6/30 arnaud tonda <span dir="ltr">&lt;<a href="mailto:arnaud.tonda@gmail.com">arnaud.tonda@gmail.com</a>&gt;</span><br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi everybody, 
<div><br></div>
<div>i have started the development of a multimedia player based on gstreamer pipelines and i encounter some problems.</div>
<div><br></div>
<div>i work on a debian platform using Nvidia drivers, and so vdpau.</div>
<div><br></div>
<div>after reading the documentations on the gstreamer mechanisms and the different example codes, i have started to make pipelines using gst-launch, and then i have written some C source code.</div>
<div><br></div>
<div>i don&#39;t know if it&#39;s the better way, but i use the playbin2 element, with setting video-sink property to a &quot;vdpau sink&quot; pipeline.</div>
<div><br></div>
<div>in commandLine, i use this :</div>
<div><br></div>
<div>gst-launch-0.10 -v -m playbin2 uri=file:///Movies/test.mkv video-sink=&quot;vdpauvideopostprocess ! vdpausink&quot; audio-sink=&quot;alsasink&quot;</div>
<div><br></div>
<div>this works fine, except that i can&#39;t set the Rank of the vdpau decoder, and so it hangs...</div>
<div><br></div>
<div>i tried to make the same in C source code, and the results are not convincing... a piece of my code is below :</div>
<div><br></div>
<div>/*************************************************************************************************************************/</div>
<div>
<div>int main (int argc, char *argv[])</div>
<div>{</div>
<div>/***************************/</div>
<div>/*Variables Declaration*/</div>
<div>/***************************/</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//GStreamer main event loop</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GMainLoop *loop;</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//elementary elements</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GstElement *playbin;</div>
<div>        GstElement *videoOutputBin;</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//VideoSink elements for VDPau;</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GstElement *vdpauSink;</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GstElement *vdpauVideoPostProcess;</div>
<div><span style="WHITE-SPACE: pre-wrap"><br></span></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//AudioSink elements for Alsa;</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GstElement *alsaSink;</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//Gstreamer bus to communicate with elements</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GstBus *bus;</div>
<div><br></div>
<div>        //pad for videoOutputBin</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GstPad *vdpauBinPad;</div>
<div><br></div>
<div>/********************/</div>
<div>/*Real code start*/</div>
<div>/********************/</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//Gstreamer initialisation</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_init(&amp;argc, &amp;argv);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>loop = g_main_loop_new(NULL, FALSE);</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//Sanity check on parameters</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>if(argc != 2)</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>{</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>   g_printerr (&quot;Usage: %s &lt;Multimedia filename&gt;\n&quot;, argv[0]);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>   return -1;</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>}</div>
<div><span style="WHITE-SPACE: pre-wrap"></span></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//elements initialisation</div>
<div><span style="WHITE-SPACE: pre-wrap"></span></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>videoOutputBin<span style="WHITE-SPACE: pre-wrap"> </span>        = gst_bin_new(&quot;vdpau-output-chain&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>playbin<span style="WHITE-SPACE: pre-wrap"> </span>        = gst_element_factory_make(&quot;playbin2&quot;,&quot;play-bin&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>vdpauSink<span style="WHITE-SPACE: pre-wrap"> </span>                = gst_element_factory_make(&quot;vdpausink&quot;,&quot;vdpau-sink&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>vdpauVideoPostProcess<span style="WHITE-SPACE: pre-wrap"> </span>= gst_element_factory_make(&quot;vdpauvideopostprocess&quot;,&quot;post-process&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>alsaSink<span style="WHITE-SPACE: pre-wrap"> </span> <span style="WHITE-SPACE: pre-wrap"> </span>                = gst_element_factory_make(&quot;alsasink&quot;,&quot;alsa-sink&quot;);</div>

<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//Sanity check on elements validity</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>if(!playbin || !vdpauSink || !alsaSink || !audioConverter ||!vdpauVideoPostProcess || !videoOutputBin)</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>{</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_printerr(&quot;Some gstreamer elements could&#39;nt itialized exit\n&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>return -1;</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>}</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//set up the pipeline</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//1 - We set the URI input filename to the fileSource element</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_object_set(G_OBJECT(playbin),&quot;uri&quot;,argv[1],NULL);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//2 - We add a message Handler</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>bus<span style="WHITE-SPACE: pre-wrap"> </span>= gst_pipeline_get_bus (GST_PIPELINE(playbin));</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_bus_add_watch(bus, bus_callback, loop);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_object_unref(bus);</div>
<div><br></div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//3 - define specific rank for VDpau decoders</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GstElementFactory *vdpauh264dec = gst_element_factory_find(&quot;vdpauh264dec&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE(vdpauh264dec), GST_RANK_PRIMARY+2);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GstElementFactory *vdpaumpeg4dec = gst_element_factory_find(&quot;vdpaumpeg4dec&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE(vdpaumpeg4dec), GST_RANK_PRIMARY+2);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>GstElementFactory *vdpaumpegdec = gst_element_factory_find(&quot;vdpaumpegdec&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_plugin_feature_set_rank (GST_PLUGIN_FEATURE(vdpaumpegdec), GST_RANK_PRIMARY+2);</div>
<div><br></div>
<div>        //4 - create the videoOutputBin</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_signal_connect (G_OBJECT(videoOutputBin), &quot;pad-added&quot;, G_CALLBACK (on_pad_added), NULL);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_signal_connect (G_OBJECT(videoOutputBin), &quot;pad-removed&quot;, G_CALLBACK (on_pad_removed), NULL);</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_bin_add_many(GST_BIN(videoOutputBin),vdpauVideoPostProcess,vdpauSink, NULL);</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_element_link(vdpauVideoPostProcess,vdpauSink);</div>
<div><br></div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>vdpauBinPad = gst_ghost_pad_new(&quot;sink&quot;,gst_element_get_static_pad(vdpauVideoPostProcess,&quot;sink&quot;));</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>if(!vdpauBinPad)</div>
<div>        {</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_printerr(&quot;vdpauBinPad is null\n&quot;);</div>
<div>                exit -1;</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>}</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>        else</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>{</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_print(&quot;vpaudBinPad Exist\n&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_element_add_pad(videoOutputBin,vdpauBinPad);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>}</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>//4 - set playbin properties</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_object_set(G_OBJECT(playbin),&quot;video-sink&quot;,videoOutputBin,&quot;audio-sink&quot;,alsaSink,NULL);</div>
<div><br></div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>/* Set the pipeline to &quot;playing&quot; state*/</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_print (&quot;Now playing: %s\n&quot;, argv[1]);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_element_set_state (playbin, GST_STATE_PLAYING);</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>/* Iterate */</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_print (&quot;Running...\n&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_timeout_add (200, (GSourceFunc) cb_print_position, playbin);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_main_loop_run (loop);</div>
<div><br></div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>/* Out of the main loop, clean up nicely */</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_print (&quot;Returned, stopping playback\n&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_element_set_state (playbin, GST_STATE_NULL);</div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>g_print (&quot;Deleting pipeline\n&quot;);</div>
<div><span style="WHITE-SPACE: pre-wrap"></span>gst_object_unref (GST_OBJECT (playbin));</div>
<div><br></div>
<div><br></div>
<div><span style="WHITE-SPACE: pre-wrap"></span>return 0;</div>
<div>}</div></div>
<div>
<div>/*************************************************************************************************************************/</div>
<div></div></div>
<div><br></div>
<div>As you can see, i have made a GstBin to encapsulate the post process element, and the vdpauSink, and created a ghost pad to vdpauvideopostprocess.</div>
<div><br></div>
<div>but i don&#39;t know if it is the right way to do this, because on certain streams, video is displayed, but in other cases, gstreamer pipeline hang... and when it hangs, in the gstreamer debug traces, i have a lot of warnings, and some errors like this :</div>

<div><br></div>
<div>
<div>0:00:04.675157784   669  0x8783ff0 ERROR                h264dpb h264/gsth264dpb.c:145:gst_h264_dpb_add:&lt;GstH264DPB@0x8659ea8&gt; Couldn&#39;t make room in DPB</div>
<div>0:00:04.696232757   669  0x8783ff0 WARN           basetransform gstbasetransform.c:1065:gst_base_transform_acceptcaps_default:&lt;passthrough-identity&gt; transform could not transform video/x-vdpau-video, chroma-type=(int)0, width=(int)1920, height=(int)1080, framerate=(fraction)1710843747/71356439, pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false in anything we support</div>

<div>0:00:04.729182133   669  0x8783ff0 WARN           basetransform gstbasetransform.c:1065:gst_base_transform_acceptcaps_default:&lt;passthrough-identity&gt; transform could not transform video/x-vdpau-video, chroma-type=(int)0, width=(int)1920, height=(int)1080, framerate=(fraction)1710843747/71356439, pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false in anything we support</div>

<div>0:00:04.729352573   669  0x8783ff0 ERROR                h264dpb h264/gsth264dpb.c:145:gst_h264_dpb_add:&lt;GstH264DPB@0x8659ea8&gt; Couldn&#39;t make room in DPB</div>
<div>0:00:04.749110902   669  0x8783ff0 WARN           basetransform gstbasetransform.c:1065:gst_base_transform_acceptcaps_default:&lt;passthrough-identity&gt; transform could not transform video/x-vdpau-video, chroma-type=(int)0, width=(int)1920, height=(int)1080, framerate=(fraction)1710843747/71356439, pixel-aspect-ratio=(fraction)1/1, interlaced=(boolean)false in anything we support</div>
</div>
<div><br></div>
<div>As it works in commandLine, i think i have made some errors, but i don&#39;t see them right now.</div>
<div><br></div>
<div>if necessary i can take you some more informations.</div>
<div><br></div>
<div>Best regards</div>
<div><br></div>
<div>-- </div>
<div>Arnaud Tonda<br><br></div><br>_______________________________________________<br>gstreamer-devel mailing list<br><a href="mailto:gstreamer-devel@lists.freedesktop.org">gstreamer-devel@lists.freedesktop.org</a><br><a href="http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel" target="_blank">http://lists.freedesktop.org/mailman/listinfo/gstreamer-devel</a><br>
<br></blockquote></div><br>