<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=us-ascii">
<meta name="Generator" content="Microsoft Exchange Server">
<!-- converted from rtf -->
<style><!-- .EmailQuote { margin-left: 1pt; padding-left: 4pt; border-left: #800000 2px solid; } --></style>
</head>
<body>
<font face="Calibri" size="2"><span style="font-size:11pt;">
<div>I try to understand how frame-wise stepping could work, but I can’t figure it out properly. </div>
<div>Maybe some wise man/woman can shed more light on my problem.</div>
<div> </div>
<div>I use lib version 1.10.3 on Windows 8.1 (VS2013) to create a pipeline in my C++ app that looks like</div>
<div><font face="Consolas" size="2" color="#A31515"><span style="font-size:9.5pt;">filesrc location=d:/testvideo.mp4 ! decodebin ! videoconvert ! <font color="green">autovideosink</font> name=video-sink</span></font></div>
<div><font face="Consolas" size="2" color="#A31515"><span style="font-size:9.5pt;">which plays a video containing 300 frames with 30 fps.</span></font></div>
<div> </div>
<div>In my code, I set the pipeline into PLAY mode, check if the pipeline is prerolled, and then I call</div>
<div> </div>
<div><font face="Consolas" size="2" color="blue"><span style="font-size:9.5pt;">if<font color="black">(</font>this<font color="black">->syncmode == </font><font color="#2B91AF">SyncMode</font><font color="black">::</font><font color="#2B91AF">type</font><font color="black">::</font><font color="darkslategray">AsFastAsPossible</font><font color="black">)</font></span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;">{</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> cout << <font color="#A31515">"Start single step events"</font> << endl;</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="blue">if</font>(<font color="blue">this</font>->singlestepsink == <font color="blue">nullptr</font>)</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> {</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="blue">this</font>->singlestepsink = (<font color="#2B91AF">GstElement</font>*)gst_bin_get_by_name((<font color="#2B91AF">GstBin</font>*)<font color="blue">this</font>->pipeline,
<font color="#A31515">"video-sink"</font>);</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="blue">if</font>(<font color="blue">this</font>->singlestepsink == <font color="blue">nullptr</font>)</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> {</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="blue">this</font>->singlestepsink == <font color="blue">this</font>->pipeline;</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> }</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> }</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> gst_element_send_event(<font color="blue">this</font>->singlestepsink, gst_event_new_step(<font color="darkslategray">GST_FORMAT_BUFFERS</font>, 1, <font color="blue">this</font>->rate,
<font color="#6F008A">TRUE</font>, <font color="#6F008A">FALSE</font>));</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;">}</span></font></div>
<div> </div>
<div>In my event message loop I check, if the step has been completed and trigger the next step if possible:</div>
<div> </div>
<div><font face="Consolas" size="2" color="blue"><span style="font-size:9.5pt;">case<font color="black"> </font><font color="darkslategray">GST_MESSAGE_STEP_DONE</font><font color="black">:</font></span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;">{</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="#2B91AF">gdouble</font> rate;</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="#2B91AF">GstFormat</font> format;</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="#2B91AF">guint64</font> amount, duration;</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="#2B91AF">gboolean</font> flush, intermediate, eos;</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> </span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> gst_message_parse_step_done(message, &format, &amount, &rate, &flush, &intermediate, &duration, &eos);</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> </span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="blue">if</font>(<font color="blue">this</font>->isopen && <font color="blue">this</font>->syncmode == <font color="#2B91AF">SyncMode</font>::<font color="#2B91AF">type</font>::<font color="darkslategray">AsFastAsPossible</font>
&& !eos)</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> {</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> cout << <font color="#A31515">"Send next step event, </font><font color="#A31515">f</font><font color="#A31515">ramecounter = "</font><< ++framecounter << endl;</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> <font color="blue">if</font>(<font color="blue">this</font>->singlestepsink != <font color="blue">nullptr</font>)</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> {</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> gst_element_send_event(<font color="blue">this</font>->singlestepsink, gst_event_new_step(<font color="darkslategray">GST_FORMAT_BUFFERS</font>, 1, <font color="blue">this</font>->rate,
<font color="#6F008A">TRUE</font>, <font color="#6F008A">FALSE</font>));</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> }</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;"> }</span></font></div>
<div><font face="Consolas" size="2"><span style="font-size:9.5pt;">}</span></font></div>
<div><font face="Consolas" size="2" color="blue"><span style="font-size:9.5pt;">break<font color="black">;</font></span></font></div>
<div> </div>
<div>In general, it works, but the number of frames that are handled are not always 300.</div>
<div>So the pipeline drops frames, e.g. with this pipeline:</div>
<div><font face="Consolas" size="2" color="#A31515"><span style="font-size:9.5pt;">filesrc location=d:/testvideo.mp4 ! decodebin ! videoconvert ! fakesink name=video-sink</span></font></div>
<div> </div>
<div>only 16 of the 300 frames are done.</div>
<div>The number of stepped frames is also rate-dependent</div>
<div>if <font face="Consolas" size="2" color="blue"><span style="font-size:9.5pt;">this</span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;">->rate</span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;"> is 1.0 then
only 200 frames of the 300 are done.</span></font></div>
<div>if <font face="Consolas" size="2" color="blue"><span style="font-size:9.5pt;">this</span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;">->rate</span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;"> is 1</span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;">0</span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;">.0
then </span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;">all 3</span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;">00 frames</span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;"> </span></font><font face="Consolas" size="2"><span style="font-size:9.5pt;">are
done.</span></font></div>
<div> </div>
<div>So can someone please tell me, what’s required to reliably step through all frames?</div>
<div> </div>
<div>Cheers,</div>
<div>Hermann</div>
<div> </div>
</span></font>
</body>
</html>