You&#39;re not dealing with dynamic pads (as used by decodebin2) correctly.<br><br>gst-launch does that for you automatically. You&#39;re also not checking any of your return values - if you were, you&#39;d see that your gst_element_link_many call is failing.<br>
<br>Mike<br><br><br><div class="gmail_quote">On Fri, Feb 25, 2011 at 2:59 PM, ding cheng <span dir="ltr">&lt;<a href="mailto:dingchengus1@yahoo.com">dingchengus1@yahoo.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
<table border="0" cellpadding="0" cellspacing="0"><tbody><tr><td style="font: inherit;" valign="top"><div>gst-launch filesrc location=h264.mp4 ! decodebin2 ! videoscale ! xvimagesink</div>
<div> </div>
<div>This command works, but I convert it to C application, it fails. Any suggestion ?</div>
<div> </div>
<div>---------------------------------------------------------------------------------------------------------</div>
<div>   gst_init(&amp;argc, &amp;argv);<br>   loop = g_main_loop_new(NULL, FALSE);<br>   pipeline = gst_pipeline_new(&quot;my-pipeline&quot;);<br>   src = gst_element_factory_make(&quot;filesrc&quot;, &quot;src&quot;);<br>
   g_object_set (G_OBJECT (usrc),&quot;location&quot;,&quot;h264.mp4&quot;, NULL);</div>
<div>   decode = gst_element_factory_make(&quot;decodebin2&quot;, &quot;decode&quot;);<br>   scale = gst_element_factory_make(&quot;videoscale&quot;, &quot;scale&quot;);<br>   sink = gst_element_factory_make(&quot;xvimagesink&quot;, &quot;sink&quot;);<br>
   gst_bin_add_many(GST_BIN(pipeline), src, decode, scale,  sink, NULL);<br>   gst_element_link_many(src, decode, scale, sink, NULL);</div>
<div>   gst_element_set_state(pipeline, GST_STATE_PLAYING);<br>   if (gst_element_get_state(pipeline, NULL, NULL, -1) ==  ST_STATE_CHANGE_FAILURE)<br>         g_error(&quot;Failed to go into PLAYING state&quot;);<br>   g_main_loop_run(loop);<br>
   gst_element_set_state(pipeline, GST_STATE_NULL);<br>   gst_object_unref(pipeline);</div>
<div>-----------------------------------------------------------------------------------------------</div>
<div>Thanks,</div></td></tr></tbody></table><br>

      <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>