<br><br><div class="gmail_quote">On Tue, Nov 18, 2008 at 12:27 AM, Ralph Giles <span dir="ltr"><<a href="mailto:giles@xiph.org">giles@xiph.org</a>></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 <<a href="mailto:salsaman@gmail.com">salsaman@gmail.com</a>> wrote:<br>
<br>
> I am finding something very strange in my test ogg files.<br>
><br>
> For example: I have a shift of 64, and I get a granulepos of 5130.<br>
><br>
> 5130 == 80*64 + 10<br>
><br>
> which suggests that frame 80 is a keyframe.<br>
<br>
</div>That's right.<br>
<div class="Ih2E3d"><br>
> However, if I start decoding from the beginning, the 81st frame is a<br>
> keyframe.<br>
<br>
</div>Really? Someone has an off-by-one somewhere.<br>
<div class="Ih2E3d"><br>
> This suggests that the first frame should be 0. But if I try to search for<br>
> 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>
...<br>
80th frame 80:0 (keyframe)<br>
81st frame 80:1<br>
...<br>
90th frame 80:10<br>
<br>
> Any suggestions ?<br>
<br>
Are you counting frames from 0 instead of 1 somewhere? I try to think<br>
of 'frame index' which starts from zero and 'frame count' which starts<br>
from 1, similar to the normal index and bounds in C 'for' loops. The<br>
granulepos records the count, not the index.<br>
<br>
FWIW,<br>
<font color="#888888"> -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>