Can someone please help me spot how I&#39;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 &lt;unistd.h&gt;</span></font><br style="font-family: courier new,monospace;">
<font size="1"><span style="font-family: courier new,monospace;">#include &lt;stdio.h&gt;</span></font><br style="font-family: courier new,monospace;"><font size="1"><span style="font-family: courier new,monospace;">#include &lt;stdlib.h&gt;</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 &lt;gst/gst.h&gt;</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(&amp;argc, &amp;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(&quot;pipey&quot;));</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(&quot;filesrc&quot;, &quot;filey&quot;);</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(&quot;ffdemux_flv&quot;, &quot;demuxey&quot;);</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(&quot;ffdec_flv&quot;, &quot;decodey&quot;);</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(&quot;xvimagesink&quot;, &quot;sinky&quot;);</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), &quot;location&quot;, &quot;jerrydog.flv&quot;, 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&#39;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 &lt;unistd.h&gt;</span></font><br style="font-family: courier new,monospace;">
<font size="1"><span style="font-family: courier new,monospace;">#include &lt;stdio.h&gt;</span></font><br style="font-family: courier new,monospace;"><font size="1"><span style="font-family: courier new,monospace;">#include &lt;stdlib.h&gt;</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 &lt;gst/gst.h&gt;</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(&amp;argc, &amp;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(&quot;pipey&quot;));</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(&quot;filesrc&quot;, &quot;filey&quot;);</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(&quot;mpeg2dec&quot;, &quot;decodey&quot;);</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(&quot;xvimagesink&quot;, &quot;sinky&quot;);</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), &quot;location&quot;, &quot;jerrydog.mp2&quot;, 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&#39;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&#39;m compiling it.  My input video files are available at:<br><br><a href="http://media.westbrook.com/media/jerrydog.flv">http://media.westbrook.com/media/jerrydog.flv</a><br>
<a href="http://media.westbrook.com/media/jerrydog.mp2">http://media.westbrook.com/media/jerrydog.mp2</a><br>
<br>