Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
First Ogg Theora Seek Attempt
Ogg Tidbits
Ogg lacks a seek table.
Timestamp exists on the ogg page with the closing packet stream.
Ogg_page_packets can discern which page has a timestamp.
Keyframes exist in pages with ogg_pages_packets(&og) == 1
Proposal
Split the file into BUFFERSIZE segments for binary searching and backtracking.
Algorithm
Binary Search Ogg Page Timestamps
Backtrack to Keyframe
Catch up to Seek
Section 1:
This section is implemented as nested loops. The inner loops finds an unprocessed buffer segment and retrieves the first ogg_page even if it spans across buffer segments.
The outer loop compares the ogg_page into an iterative binary search. Since ogg_page_packets can discern the granulepos or time stamp, no ogg_packet is inspected.
Section 2:
The section is implemented as a buffer sync step to combine all ogg_pages into one ogg_packet.
Section 3:
Submit the frames into the theora decoder and advance the video forward until the buffer catches up to the seek time.
Modified
Implemented Seek
Added BUFFERSIZE and remove the hard coded 4096
Known Bugs
Seek cannot find subsequent ogg_pages in the buffer segment. When a buffer section has two ogg_pages and the keyframe is encoded in the latter ogg_page. Seek will not find it.
VideoTheoraStreak is littered with time resets. Currently, seek only works during play mode.
Seek 0 does not work
Links
https://www.theora.org/doc/libtheora-1.0/group__decfuncs.html
https://xiph.org/oggz/doc/group__basics.html
Issue #14430
Seek works somewhat. I need to fix these three bugs.
https://download.blender.org/peach/bigbuckbunny_movies/big_buck_bunny_480p_stereo.ogg
I managed run big_buck_bunny.ogv