<br><br><div class="gmail_quote">On Wed, Nov 12, 2008 at 6:36 PM, 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 Wed, Nov 12, 2008 at 1:13 PM, salsaman <<a href="mailto:salsaman@gmail.com">salsaman@gmail.com</a>> wrote:<br>
<br>
> suppose I start decoding from a page with granulepos (kframe=x, frame =y)<br>
> and I continue decoding in sequence until I reach the next page with a<br>
> non-negative granulepos (kframe=a, frame=b). Is it possible that there could<br>
> be another keyframe between x and a ? In other words, do "hidden" keyframes<br>
> exist in the ogg stream, or is it safe to assume that every keyframe has at<br>
> least one (non-negative) granulepos ?<br>
<br>
</div>It's possible, though unlikely.<br>
<div class="Ih2E3d"><br>
> Let me give an example. Suppose I am seeking for frame 20. I find a<br>
> granulepos of (18,22). Good, so I know that the keyframe is 18 + an offset<br>
> of 2. So now I seek again to find the largest granulepos before 18. I find<br>
> (10,12). Great.<br>
> So I start decoding from (10,12) and I reach a keyframe. Can I assume this<br>
> keyframe is 18, and then just decode two more frames ?<br>
<br>
</div>In this case, you know the answer, because if you know by counting<br>
whether the keyframe you just found is frame 18, no? Or are you<br>
worried about having the backpropagate the (10,12) to earlier packets<br>
in that (10,12) page? You do have to do that, you can't assume there<br>
isn't a 9,9 in there too.<br>
<div class="Ih2E3d"></div></blockquote><div><br>No, I am not worried about that. But the first keyframe I find could be 14 instead of 18, for example. Then I count two frames, I would end up at 16 instead of 20.<br><br>The only way I can see to be sure is to decode right up to the (18,22) page and make sure there are no more keyframes until then.<br>
<br>This would occur for example, if there were continuation packets up to frame 13, then on the same page 14 (keyframe in this example) begins and the packet continues until we get to 18, then 18 continues until 18,22.<br>
<br>So what I really need to know, if a frame/packet completes on a page, and then another frame/packet begins on the same page, but continues, would the granulepos be for the completed frame, or would it be a continuation ? If it's the former then I think I am OK because in case of a keyframe before 18, there should always be a completed frame (e.g. 17 with a granulepos of 14,17) before 18 starts, right ?<br>
<br>The other example I can think of is if 17 is a keyframe, and it completes on the same page as 18, also a keyframe, completes. I guess this might be possible for very small, rapidly changing frames, right ? In this case I would only need to decode to the end of the page where a keyframe first appears, and make sure I got the last keyframe on that page.<br>
<br>I hope this makes some sense.<br><br>Regards,<br>Gabriel.<br><br></div></div>