Open StefH opened 5 years ago
Yeah the implementation is about as bare-bones as possible. See this TODO where I punted a refactor of this whole interface.
Seeking in Ogg by itself can be a bit complicated when you have to reconcile file, stream, and granule positions, the fact that there is no global index, and the code also has to handle forwards-only streams of indeterminate length for streaming scenarios. But if you have ideas for a better implementation then I am all ears.
Would a simple option be to:
Just jump to a location in the (readable) stream, say at 50%.
Start decoding from that point on, which will probably fail. However I don't know the Opus Codec at all, but is it possible to find the next valid frame from that point on?
If the next valid frame is found, just start decoding as usual?
That would work as a simple option. You could just reset the opus decoder, seek to an arbitrary point, and then start searching for the next ogg page. But of course the reality is more complicated.
Perhaps a quick breakdown of OggOpus would help:
So, there's a few wrenches that this can throw into the design for seeking:
When using code like:
it's not possible to just jump or seek to a position in the file?