<div>Hi </div>
<div> </div>
<div> You can not link demuxer and decoder using gst_element_link_many(src, dmx, dec, sink, NULL) function . You need to link these two elements in callback function because demuxer has to create these pads dynamically. <br>
<br></div>
<div class="gmail_quote">On Mon, Jul 20, 2009 at 10:00 AM, E. Westbrook <span dir="ltr"><<a href="mailto:gstreamer@westbrook.com">gstreamer@westbrook.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Can someone please help me spot how I'm being stupid?<br><br>I can play a FLV file using:<br><br>
<div style="MARGIN-LEFT: 40px"><font size="1"><span style="FONT-FAMILY: courier new,monospace">$ gst-launch filesrc location=jerrydog.flv ! ffdemux_flv ! ffdec_flv ! xvimagesink</span></font><br></div><br>But when I try to play the same file with the following code, it hangs with no output.<br>
<br>
<div style="MARGIN-LEFT: 40px"><font size="1"><span style="FONT-FAMILY: courier new,monospace">#include <unistd.h></span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace">#include <stdio.h></span></font><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace">#include <stdlib.h></span></font><br style="FONT-FAMILY: courier new,monospace"><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace">#include <gst/gst.h></span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace">int main(int argc, char** argv) {</span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> gst_init(&argc, &argv);</span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> GMainLoop* loop = g_main_loop_new(NULL, FALSE);</span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> GstPipeline* p = GST_PIPELINE(gst_pipeline_new("pipey"));</span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> GstElement* src = gst_element_factory_make("filesrc", "filey");</span></font><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> GstElement* dmx = gst_element_factory_make("ffdemux_flv", "demuxey");</span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> GstElement* dec = gst_element_factory_make("ffdec_flv", "decodey");</span></font><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> GstElement* sink = gst_element_factory_make("xvimagesink", "sinky");</span></font><br style="FONT-FAMILY: courier new,monospace"><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> g_object_set(G_OBJECT(src), "location", "jerrydog.flv", NULL);</span></font><br style="FONT-FAMILY: courier new,monospace"><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> gst_bin_add_many(GST_BIN(p), src, dmx, dec, sink, NULL);</span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> gst_element_link_many(src, dmx, dec, sink, NULL);</span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> gst_element_set_state(GST_ELEMENT(p), GST_STATE_PLAYING);</span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> g_main_loop_run(loop);</span></font><br style="FONT-FAMILY: courier new,monospace"><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> return 0;</span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace">}</span></font><br style="FONT-FAMILY: courier new,monospace">
</div><br>The thing is, I've separately encoded the file to mpeg2, and I can also play it using:<br><br>
<div style="MARGIN-LEFT: 40px"><font size="1"><span style="FONT-FAMILY: courier new,monospace">$ gst-launch filesrc location=jerrydog.mp2 ! mpeg2dec ! xvimagesink</span></font><br></div><br>and then, puzzlingly, unlike the FLV version, my C code plays the mpeg2 flavor just great:<br>
<br>
<div style="MARGIN-LEFT: 40px"><font size="1"><span style="FONT-FAMILY: courier new,monospace">#include <unistd.h></span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace">#include <stdio.h></span></font><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace">#include <stdlib.h></span></font><br style="FONT-FAMILY: courier new,monospace"><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace">#include <gst/gst.h></span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace">int main(int argc, char** argv) {</span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> gst_init(&argc, &argv);</span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> GMainLoop* loop = g_main_loop_new(NULL, FALSE);</span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> GstPipeline* p = GST_PIPELINE(gst_pipeline_new("pipey"));</span></font><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> GstElement* src = gst_element_factory_make("filesrc", "filey");</span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> GstElement* dec = gst_element_factory_make("mpeg2dec", "decodey");</span></font><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> GstElement* sink = gst_element_factory_make("xvimagesink", "sinky");</span></font><br style="FONT-FAMILY: courier new,monospace"><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> g_object_set(G_OBJECT(src), "location", "jerrydog.mp2", NULL);</span></font><br style="FONT-FAMILY: courier new,monospace"><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> gst_bin_add_many(GST_BIN(p), src, dec, sink, NULL);</span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> gst_element_link_many(src, dec, sink, NULL);</span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> gst_element_set_state(GST_ELEMENT(p), GST_STATE_PLAYING);</span></font><br style="FONT-FAMILY: courier new,monospace">
<br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace"> g_main_loop_run(loop);</span></font><br style="FONT-FAMILY: courier new,monospace"><br style="FONT-FAMILY: courier new,monospace">
<font size="1"><span style="FONT-FAMILY: courier new,monospace"> return 0;</span></font><br style="FONT-FAMILY: courier new,monospace"><font size="1"><span style="FONT-FAMILY: courier new,monospace">}</span></font><br></div>
<br>So what's confusing me is, in the FLV case, how am I constructing the pipeline wrongly in C, in the FLV case anyway, that differs from gst-launch? Or am I? Is this as dumb a question as it seems to me it must be?<br>
<br>Thanks,<br>E. Westbrook<br><br>PS - All test case source is here exactly as I'm compiling it. My input video files are available at:<br><br><a href="http://media.westbrook.com/media/jerrydog.flv" target="_blank">http://media.westbrook.com/media/jerrydog.flv</a><br>
<a href="http://media.westbrook.com/media/jerrydog.mp2" target="_blank">http://media.westbrook.com/media/jerrydog.mp2</a><br><br><br>------------------------------------------------------------------------------<br>Enter the BlackBerry Developer Challenge<br>
This is your chance to win up to $100,000 in prizes! For a limited time,<br>vendors submitting new applications to BlackBerry App World(TM) will have<br>the opportunity to enter the BlackBerry Developer Challenge. See full prize<br>
details at: <a href="http://p.sf.net/sfu/Challenge" target="_blank">http://p.sf.net/sfu/Challenge</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><br clear="all">
<div></div><br>-- <br>Regards,<br><br>Sudarshan Bisht<br>