Hi,<br>&nbsp;Some of people are asking a C code example for their application. I was on the same problem a few weeks, I will give you a sample of my code. My code was so horrible(lots of code in comments) that I was forced to cut a (callback like hand off signal and typefind signal). 
<br>So It is just an example, you will have to code yourself the bus fonction(see in doc), and also the callback function: new padd added.<br>With that structure, I was able to grab frame video and audio, to synchronise manually audio and video buffers (after a frame audio and video it stop to lets the other thread do the same frame).
<br>Hope this help you a bit,<br>Erwan Masson<br><br><blockquote style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;" class="gmail_quote">/* Main pipeline */<br>&nbsp; pipeline = gst_pipeline_new (&quot;Main pipeline&quot;);
<br>&nbsp; source = gst_element_factory_make (&quot;filesrc&quot;, &quot;file-source&quot;);<br>&nbsp; /* the parser got 2 dynamic output pad, you will have to link them to your audio thread and video thread */<br>&nbsp; parser = gst_element_factory_make (&quot;decodebin&quot;, &quot;decodebin-parser&quot;);
<br>&nbsp; <br>&nbsp; /* Audio Pipeline */<br>&nbsp; pipeAudio = gst_pipeline_new (&quot;audio-player &quot;);<br>&nbsp; /* A queue is needed to synchronise with Video thread */<br>&nbsp;&nbsp;&nbsp; aqueue = gst_element_factory_make(&quot;queue&quot;, &quot;aqueue&quot;);
<br>&nbsp; decoder = gst_element_factory_make (&quot;identity&quot;, &quot;identity-decoder-audio&quot;);<br>&nbsp; conv = gst_element_factory_make (&quot;audioconvert&quot;, &quot;converteraudio&quot;);&nbsp; <br>&nbsp; /* Identity, useful for add handdoff signal (to grab a sample) */
<br>&nbsp; aconv2 = gst_element_factory_make (&quot;identity&quot;, &quot; identity conv2&quot;);<br>&nbsp; /* With typefind you are able to retrieves some info in the signal */<br>&nbsp; afind = gst_element_factory_make (&quot;typefind&quot;, &quot;typefindaudio&quot;);
<br>&nbsp; sink = gst_element_factory_make (&quot;alsasink&quot;, &quot;alsa-output&quot;);&nbsp; <br>&nbsp; <br>&nbsp; <br>&nbsp; <br>&nbsp; /* Video Pipeline */<br>&nbsp; pipeVideo = gst_pipeline_new (&quot;video-player&quot;);<br>&nbsp; /* queue usefull to synchronize with audio thread */
<br>&nbsp;&nbsp;&nbsp; vqueue = gst_element_factory_make(&quot;queue&quot;, &quot;vqueue&quot;);<br>&nbsp; vdecoder = gst_element_factory_make (&quot;identity&quot;, &quot;identity-decoder&quot;);&nbsp; <br>&nbsp; vconv = gst_element_factory_make (&quot;ffmpegcolorspace&quot;, &quot;convertervideo&quot;);
<br>&nbsp; /* Use capsfilter if you want to convert to RGB (default ffmpeg output is YUV */<br>&nbsp; vcapsfilter = gst_element_factory_make (&quot;capsfilter&quot;, &quot;restreint le caps&quot;); <br>&nbsp; g_object_set (G_OBJECT (vcapsfilter), &quot;caps&quot;,
<br>&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; gst_caps_new_simple (&quot;video/x-raw-rgb&quot;,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &quot;bpp&quot;, G_TYPE_INT, 32,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; &quot;depth&quot;, G_TYPE_INT, 32,<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp; NULL)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; , NULL);
<br>&nbsp;&nbsp;&nbsp; /* Put a handoff signal on identity and you will grab video frame */<br>&nbsp; vconv2 = gst_element_factory_make (&quot;identity&quot;, &quot;identity-vconv2&quot;);&nbsp;&nbsp;&nbsp; <br>&nbsp; g_signal_connect (vconv2, &quot;handoff&quot;, G_CALLBACK (cb_handoff_video), NULL);
<br>&nbsp; /* use typefind if you want to grab some info on video, like width, height....*/<br>&nbsp; vfind = gst_element_factory_make (&quot;typefind&quot;, &quot;typefindVideo2&quot;);&nbsp; <br>&nbsp; vsink = gst_element_factory_make (&quot;fakesink&quot;, &quot;video-fake-output&quot;);
<br>&nbsp; <br>&nbsp; <br>&nbsp; /* You need to test all Element to see if they are created */<br>&nbsp; if (!pipeline || !source || !parser || !decoder || !conv || !sink) {<br>&nbsp;&nbsp;&nbsp; g_print (&quot;One element could not be created 1\n&quot;);<br>
&nbsp;&nbsp;&nbsp; if (!decoder)<br>&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;decoder\n&quot;);<br>&nbsp;&nbsp;&nbsp; if (!parser)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;parser\n&quot;);<br>&nbsp;&nbsp;&nbsp; if (!source)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;source\n&quot;);<br>&nbsp;&nbsp;&nbsp; if(!conv)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;conv\n&quot;);
<br>&nbsp;&nbsp;&nbsp; if(!pipeline)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;pipeline\n&quot;);<br>&nbsp;&nbsp;&nbsp; if(!sink)<br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; g_print(&quot;sink\n&quot;);<br>&nbsp;&nbsp;&nbsp; return -1;<br>&nbsp; } <br>&nbsp; if (!vqueue || !aqueue&nbsp; || !vdecoder || !vconv || !vsink) {<br>&nbsp;&nbsp;&nbsp; g_print (&quot;One element could not be created 2\n&quot;);
<br>&nbsp;&nbsp;&nbsp; return -1;<br>&nbsp; }<br><br>&nbsp; <br>&nbsp; g_object_set (G_OBJECT (source), &quot;location&quot;,&quot;myFileName.avi&quot;, NULL);<br><br>/* Add a&nbsp; bus to catch Information */<br>&nbsp; bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
<br>&nbsp; gst_bus_add_watch (bus, cb_bus_call, loop);<br>&nbsp; gst_object_unref (bus);&nbsp; <br>&nbsp; bus = gst_pipeline_get_bus (GST_PIPELINE (pipeVideo));<br>&nbsp; gst_bus_add_watch (bus, cb_bus_call, loop);<br>&nbsp; gst_object_unref (bus);<br>
<br><br>/* Video pipeline */ <br>/* Add element in pipeline */<br>&nbsp; gst_bin_add_many (GST_BIN (pipeVideo), vqueue, vdecoder, vconv, vcapsfilter, vconv2, vfind, vsink, NULL);&nbsp; <br>&nbsp; /* Link element in pipeline */ <br>&nbsp; gst_element_link_many (vqueue, vdecoder,&nbsp; vconv, vcapsfilter, vconv2,&nbsp; vfind , vsink, NULL);
<br>&nbsp; /* Set the ghost pad for the viedo pipeline (pad for input)*/<br>&nbsp; pad = gst_element_get_pad (vqueue, &quot;sink&quot;);&nbsp; <br>&nbsp; gst_element_add_pad (pipeVideo, gst_ghost_pad_new (&quot;sink&quot;, pad));&nbsp; <br>&nbsp; gst_object_unref (GST_OBJECT (pad)); 
<br>&nbsp; <br>&nbsp; <br><br><br>/* Audio pipeline */ <br>&nbsp; gst_bin_add_many (GST_BIN (pipeAudio),aqueue, decoder, conv, aconv2, afind, sink, NULL);&nbsp;&nbsp; <br>&nbsp; gst_element_link_many (aqueue, decoder, conv, aconv2, afind, sink, NULL);
<br>&nbsp; pad = gst_element_get_pad (aqueue, &quot;sink&quot;);<br>&nbsp; gst_element_add_pad (pipeAudio, gst_ghost_pad_new (&quot;sink&quot;, pad));<br>&nbsp; gst_object_unref (GST_OBJECT (pad)); <br>&nbsp; <br>/* Main pipeline */ <br>&nbsp; gst_bin_add_many (GST_BIN (pipeline), source, parser, NULL);
<br>&nbsp; gst_element_link (source, parser);<br><br>&nbsp; /* link together - note that we cannot link the parser and<br>&nbsp;&nbsp; * decoder yet, because the parser uses dynamic pads. For that,GST_STATE_READY<br>&nbsp;&nbsp; * we set a pad-added signal handler. */
<br>&nbsp; g_signal_connect (parser, &quot;pad-added&quot;, G_CALLBACK (cb_new_pad), NULL);<br>&nbsp; <br>&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp; <br>&nbsp; /* Now set to playing and iterate. */<br>&nbsp; g_print (&quot;Setting to PLAYING\n&quot;);<br>&nbsp; gst_element_set_state (pipeline, GST_STATE_PLAYING);
<br>&nbsp; <br>&nbsp; g_print (&quot;Running\n&quot;);<br>&nbsp; g_main_loop_run (loop);<br></blockquote>