Hi all,<br>I have been working on an ogg/theora demuxer/decoder plugin for LiVES (<a href="http://lives.sourceforge.net">http://lives.sourceforge.net</a>). The decoder has a very simple interface, in fact there are only two major functions: - a function to get details (frame size, fps, palette, etc) from a URL; - a function to get a given frame from a specified URL and copy the resulting frame into memory buffers.<br>
<br>The code can be seen here:<br><br><a href="http://lives.cvs.sourceforge.net/viewvc/lives/lives-plugins/plugins/decoders/ogg_theora_decoder.c?view=log">http://lives.cvs.sourceforge.net/viewvc/lives/lives-plugins/plugins/decoders/ogg_theora_decoder.c?view=log</a><br>
<br>The function which is causing problems is get_frame(). Here the first pass will seek to the keyframe before the target frame, then decode until we reach the target frame, at which point the frame is output. The output is done by way of ogg_data_process() which in turn calls ogg_theora_read().<br>
<br>So far so good. However, on the second and subsequent frames, assuming we are playing forwards sequentially, a shortcut is taken - at line 960:<br><font size="4"><br></font><pre><font size="4"><span class="hl kwa">if</span> <span class="hl sym">(</span>tframe<span class="hl sym">></span>last_frame<span class="hl sym">&&((</span>tframe<span class="hl sym">-</span>last_frame<span class="hl sym"><=</span>max_frame_diff<span class="hl sym">||</span>kframe<span class="hl sym">==</span>last_kframe<span class="hl sym">))) {</span></font></pre>
here, tframe is our target frame, (static) last_frame is the last frame output, and max_frame_diff is the keyframe skip / 2<br>If we are playing sequentially, then this shortcut will be taken - it sets cont(inue) to TRUE and drops back into ogg_data_process(), and processing should continue exactly where we left off last time. However what I see is this - I am using 3 test clips. On one of the clips, playbck works perfectly; however, on the other two clips, it looks like frames are being skipped - the clip plays back too fast, with distortion, and we reach EOF too soon.<br>
<br>Maybe somebody can take a quick look at the code and tell me where I am going wrong ?<br><br>Thanks in advance,<br>Gabriel<br><a href="http://lives.sourceforge.net">lives.sourceforge.net</a><br><br>