-
Notifications
You must be signed in to change notification settings - Fork 26
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Finer seeking support #16
Comments
I'm not really familiar with ogg and vorbis, what sort of granularity do pages offer ? Thanks |
The granularity depends on many factors. How well the stream is compressed, for example, but also on encoder choice (whether to put as many packets into a page as possible, or fewer). It would be cool if you could try it out, and I could get feedback whether its enough for you or not.
The absolute granule position is in our case just the (per channel) sample count, see also section A.2 of the vorbis spec. It can also be used for displaying how far one has progressed in the stream ( |
Hi! Some (hopefully) helpful suggestions:
A use-case for exact seek might be if someone requires seamless looping of sections of an ogg vorbis file. In such a scenario, being out by just a few tens of samples can result in audible clicks and pops. For my particular use-case, having accurate whole file looping is adequate. Thus, so long as one can seek the stream from the beginning, and so long as this seek results in the exact same samples being returned as were returned when first playing through, it would work for me. Thanks for adding the seek functionality. The prior lack of seek drove me to use libvorbisfile, but in the future I'll probably reevaluate that decision. |
@mark-buer thanks for the interesting comment! What do you mean with "non-quantised" seek? |
By "quantised seek", I mean "per page granularity level seek". |
Hmmm this makes me remember, I probably need to make sure that seeking to the beginning is okay... |
@est31 I've given it a try, and it works well for my usecase, and with this lewton has everything I need to replace libvorbis. Thanks for your work ! As a suggestion, could the
|
Great to hear!
What do you mean by position that was seeked at? The byte offset, or the resulting absgp? |
AFAIU, What I'd like is for
|
Really? Nice to hear, but from knowing the code I was expecting an
Right. If you want to know the details, its a bit more complicated with continued packets (packets that span multiple page boundaries). Here if you seeked for the absgp 42, and page A had absgp 38, and page B had absgp 50, and a packet would span the boundary between A and B, you'd get to page A. At least this is what the code is supposed to do, no idea whether it actually does it.
I see. What would you do with that value if you had it? The issue is that obtaining the offset between the end of the page and its start where the next call to read a packet will return a value is almost as hard as actually putting you closest to the requested absgp on a per packet basis. |
Actually I do. The files I'm decoding are a bit weird, with some proprietary/undocumented extensions. With libvorbis I always get a
Send it back to the controlling thread, and fix the position in the GUI. This isn't too important since the seeking error is small enough and I can update the position after the next packet read using |
The changes in RustAudio/ogg@1e54824 were originally meant to enable dbfaae5 but they also allow for more precise seeking, provided further work in lewton. |
Precise seeking is very important for my project. Probably I can contribute to this feature. (Writing here just in case) |
Precise seeking support would be really nice to have. My usecase is a rhythm game, where I need to keep gameplay in sync with the audio when seeking :\ |
Commit 5748b26 has implemented seeking support on a per page granularity level.
For some use cases this is not fine enough.
Please, if you use this library and the granularity is not fine enough for you, tell me so in this thread.
The text was updated successfully, but these errors were encountered: