-
Notifications
You must be signed in to change notification settings - Fork 239
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
Implements Seek #513
Implements Seek #513
Conversation
Note: this is currently still a draft, early reviews are welcome though :) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yet another thought, now we've got them implemented everywhere can_seek
and try_seek
should get default implementations. That way this wont break the build for everyone implementing Source
on their own type.
So the motivation behind A better approach is to use #510 to seek back in A if B returns a (non critical) error while seeking. Such an error could be our |
d7012ae
to
b2940a2
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your work!
I lack the expertise to give a thorough review of the actual implementation, so these are mostly typos I've noticed.
I applied all the spelling/grammar suggestions directly, thanks a lot for them! The others are great too they just require a little more attention. I will apply them tomorrow! |
ab2d6f1
to
afa1b76
Compare
…named the trait to SeekableSource
… decoderimpl a bit
add todo about can_seek to mix Co-authored-by: naglis <[email protected]>
document why Sink::can_seek does not exist
This reverts commit 80add81.
seek is broken, RustAudio/lewton#73. We could work around it by: - using unsafe to create an instance of Self - use mem::swap to turn the &mut self into a mut self - take out the underlying Read+Seek - make a new self and seek If this issue is fixed use the implementation in commit: 3bafe32
This adds two dependencies, they are only needed for the test suite. Compile time will not increase for users. The extra overhead when running the test suite is worth it imho. The test file is significantly shorter and there is less code duplication. A run time solution would decrease the test interface (you would have to manually find out which params caused the test).
More readable, prep for using the same lines in new refine_position fn. Since that is already pretty complex this needed to be made simpler. This code retries on all errors not only decode errors. Retries will not work on anything else then a decode error however they also wont cause any problems. Not checking the result does however make the code simpler.
Just wanted to drop props for @dvdsk and everyone else who has reviewed this, this is great work and I'll be excited to see this land! |
Was needed before a cargo update call. Update to cpal made the type copy though.
Thanks to @Rintse for his extensive review! We caught a few cases where seek could be extended. The review also inspired me to extend the test suite with as result a ton of bugs discovered 😄. Those have now all been fixed! Time to merge this PR 🎉 🥳 🎈. Whats next?In a few days I plan to cut a new release and push that to crates.io and maybe an announcement on users.rust-lang.org and the reddit. In the long term I am planning a few other features to make rodio more suitable as a backend for music players. They will land over the next year probably (no promises). Meanwhile I'll be spending a little time every week to work through the PR backlog. So if you see anything you would like in rodio, do not hesitate to open an issue. If it fits for rodio we can work on it together. |
Adresses #176, see #176 (comment) for the motivations behind the design.
Adds a fail-able method
fn try_seek(&mut self, pos: Duration) -> Result<(), SeekNotSupported>
to all sources and decoders. The error structSeekNotSupported
contains the type name of the source that did not support seek. This is particularly useful when you have a chain of sources.I commented out some working functionality that could not be merged yet: