<br> 4) Subtract 1 from the keyframe, then repeat step 3).<br> <br> 5) Begin reading from the frame discovered in step 4. Drop any packets<br> which are output on the first page. Count down until we reach the<br> keyframe, dropping packets until then.<br> <br> 6) Continue counting down until we reach the target frame, we are now<br> decoding each frame/packet. At the target frame produce the YUV<br> output.<br><br>Steps 4 and 5 are necessary because ogg only tells you where a frame ends, not where it starts.<br><br><br><br>My code has two further optimisations:<br>- if playing sequentially (current_frame - last_frame < threshold), you don't need to seek again (from trial and error I found threshold is best if it is around 1/4 of the keyframe_granule_shift). Just continue decoding.<br> <br>- I create a hash table of largest granule pos -> keyframe as this is discovered. Doing a binary tree search of this first can help narrow the initial search range for keyframes which have already been discovered<br> <br>It's all in the code here:<br><a href=3D"http://lives.svn.sourceforge.net/viewvc/lives/trunk/lives-plugins/plugins/decoders/ogg_theora_decoder.c">http://lives.svn.sourceforge.net/viewvc/lives/trunk/lives-plugins/plugins/decoders/ogg_theora_decoder.c</a><br> <br>The only function to really consider is get_frame() which takes a (const) char *URI (actually the current version really only takes a local file name), and an int64_t frame number and returns the output in void *pixel_data[3] which should be pre-allocated to take a correctly sized YUV420 frame. The rest is just internal functions or decoration, apart from get_clip_data() which returns a struct with all the details about (const) char *URI. I only implemented video (theora) decoding, but it should be fairly easy to implement audio decoding from the same pages.<br> <br>Yes, it is a bit complicated, but it really is the only way if you want 100% accurate seeking in an ogg container.<br><br><br><br>Salsaman.<br><br clear=3D"all"><br><a href=3D"http://lives.sourceforge.net">http://lives.sourceforge.net</a><br> <a href=3D"https://www.ohloh.net/accounts/salsaman">https://www.ohloh.net/accounts/salsaman</a><br><br> <br><br><div class=3D"gmail_quote">On Mon, Mar 15, 2010 at 4:22 PM, Nigel Simpson <span dir=3D"ltr"><<a href=3D"mailto:nigel at matsuplace.com">nigel@matsuplace.com</a>></span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"> <div bgcolor=3D"#FFFFFF"><div>I know of a bunch of developers and students who might be available to help out. I figure this issue needs Cortado experts rather than lots of developers, though. If that's not the case and you need some help, I can send some people to the project.</div> <div><br></div><font color=3D"#888888"><div>Nigel=A0</div></font><div><div></div><div class=3D"h5"><div><br></div><div>On Mar 15, 2010, at 12:08 PM, "<a href=3D"mailto:ozemale at ozemail.com.au" target=3D"_blank">ozemale at ozemail.com.au</a>" <<a href=3D"mailto:ozemale at ozemail.com.au" target=3D"_blank">ozemale at ozemail.com.au</a>> wrote:<br> <br></div><div></div><blockquote type=3D"cite"><div><br> I also have a pressing need to have the seeking/pausing issues in Cortado resolved.<br> <br> What do we need to do to get these issues addressed and resolved?<br> <br> Thanks,<br> <br> John<br> <br> <span style=3D"font-weight: bold;">On Mon Mar 15 11:54 , Nigel Simpson sent:<br> <br> </span><blockquote style=3D"border-left: 2px solid rgb(245, 245, 245); margin-left: 5px; margin-right: 0px; padding-left: 5px; padding-right: 0px;">On Mar 15, 2010, at 3:59 AM, "<a></a><a href=3D"mailto:ogg.k.ogg.k at googlemail.com" target=3D"_blank">ogg.k.ogg.k at googlemail.com</a>" <<a></a><a href=3D"mailto:ogg.k.ogg.k at googlemail.com" target=3D"_blank">ogg.k.ogg.k at googlemail.com</a> <br> > wrote:<br> <br> >> When I play the converted video using cortado 0.5.2, seeking still <br> >> seems to<br> >> be broken. For example: play a video, pause and then press play, <br> >> the player<br> >> resumes several seconds after the paused position. Also, pause and <br> >> drag the<br> >> time slider. The slider jumps to a new position after you release <br> >> the drag<br> >> rather than where the slider was dragged.<br> >><br> >> Does cortado support OggIndex?<br> ><br> > No. The index is a very new addition and is still being worked on.<br> > Support at the moment is limited to ffmpeg2theora and OggIndex (plus<br> > patches for Firefox). It is expected that various players will be<br> > patched to support the index, however. Cortado would probably be one<br> > of them.<br> <br> That would be great to see in Cortado.<br> <br> >> Are there any workarounds for reliably getting and setting the <br> >> playback<br> >> position?<br> ><br> > Seeking is known to have problems in Cortado. They're fixed as <br> > they're found.<br> > Also, a recently released version of Cortado had a non-working<br> > playback position access from Javascript, in case you're also seeing<br> > this problem. I'm unsure whether there was a release since this was<br> > found.<br> <br> I'm using Cortado in a Java application, and have been trying to <br> figure out why Cortado can seek reliably (well, reproducibly perhaps) <br> but doesn't reliably report the current position, or resume from pause <br> properly. It sounds like these are known issues though. Is there any <br> way to raise the priority of these issues?<br> <br> Nigel<br> _______________________________________________<br> theora-dev mailing list<br> <a></a><a href=3D"mailto:theora-dev at xiph.org" target=3D"_blank">theora-dev@xiph.org</a><br> <a href=3D"http://parse.pl?redirect=3Dhttp%3A%2F%2Flists.xiph.org%2Fmailman%2Flistinfo%2Ftheora-dev" target=3D"_blank"><span style=3D"color: red;">http://lists.xiph.org/mailman/listinfo/theora-dev</span></a><br> )<br> </blockquote> <br></div></blockquote></div></div></div><br>_______________________________________________<br> theora-dev mailing list<br> <a href=3D"mailto:theora-dev at xiph.org">theora-dev at xiph.org</a><br> <a href=3D"http://lists.xiph.org/mailman/listinfo/theora-dev" target=3D"_blank">http://lists.xiph.org/mailman/listinfo/theora-dev</a><br> <br></blockquote></div><br> --00504502d3bcaab7500481dcf5d6--