You're not dealing with dynamic pads (as used by decodebin2) correctly.<br><br>gst-launch does that for you automatically. You're also not checking any of your return values - if you were, you'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"><<a href="mailto:dingchengus1@yahoo.com">dingchengus1@yahoo.com</a>></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(&argc, &argv);<br> loop = g_main_loop_new(NULL, FALSE);<br> pipeline = gst_pipeline_new("my-pipeline");<br> src = gst_element_factory_make("filesrc", "src");<br>
g_object_set (G_OBJECT (usrc),"location","h264.mp4", NULL);</div>
<div> decode = gst_element_factory_make("decodebin2", "decode");<br> scale = gst_element_factory_make("videoscale", "scale");<br> sink = gst_element_factory_make("xvimagesink", "sink");<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("Failed to go into PLAYING state");<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>