<br><br><div class="gmail_quote">On Tue, Nov 18, 2008 at 12:27 AM, Ralph Giles <span dir="ltr">&lt;<a href="mailto:giles@xiph.org">giles@xiph.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div class="Ih2E3d">On Sun, Nov 16, 2008 at 5:54 PM, salsaman &lt;<a href="mailto:salsaman@gmail.com">salsaman@gmail.com</a>&gt; wrote:<br>
<br>
&gt; I am finding something very strange in my test ogg files.<br>
&gt;<br>
&gt; For example: I have a shift of 64, and I get a granulepos of 5130.<br>
&gt;<br>
&gt; 5130 == 80*64 + 10<br>
&gt;<br>
&gt; which suggests that frame 80 is a keyframe.<br>
<br>
</div>That&#39;s right.<br>
<div class="Ih2E3d"><br>
&gt; However, if I start decoding from the beginning, the 81st frame is a<br>
&gt; keyframe.<br>
<br>
</div>Really? Someone has an off-by-one somewhere.<br>
<div class="Ih2E3d"><br>
&gt; This suggests that the first frame should be 0. But if I try to search for<br>
&gt; frame 0, it fails.<br>
<br>
</div>Correct. The granulepos is derived from the count of decodeable<br>
frames. So the granulepos is:<br>
<br>
first frame 1:0 (keyframe)<br>
second frame 1:1<br>
third frame 1:2<br>
&nbsp;...<br>
80th frame 80:0 (keyframe)<br>
81st frame 80:1<br>
&nbsp;...<br>
90th frame 80:10<br>
<br>
&gt; Any suggestions ?<br>
<br>
Are you counting frames from 0 instead of 1 somewhere? I try to think<br>
of &#39;frame index&#39; which starts from zero and &#39;frame count&#39; which starts<br>
from 1, similar to the normal index and bounds in C &#39;for&#39; loops. The<br>
granulepos records the count, not the index.<br>
<br>
FWIW,<br>
<font color="#888888">&nbsp;-r<br>
</font></blockquote></div><br><br>Right, that is what I would expect. I think I will write an ogg file checker that checks all granulepos and keyframes to make sure the problem is not in my test files. Some of the files were created with older versions of the encoder. For example I have one file where I need to subtract 2 from all keyframe values in order for it to decode properly.<br>
<br>Regards,<br>Gabriel.<br><a href="http://lives.sourceforge.net">http://lives.sourceforge.net</a><br><br>