RustAudio / ogg

Ogg container decoder and encoder written in pure Rust
Other
113 stars 21 forks source link

Allow usage without `Seek`: `RevReader` approach #36

Open florian1345 opened 2 years ago

florian1345 commented 2 years ago

Implemented my proposal to resolve #12 .

Instead of Seek, the (non-seeking) functionality of the PacketReader now requires a new trait RevRead which allows making a single reversible read operation. This is blanket-implemented for all types implementing Read + Seek, so business as usual is possible. Beyond that, I added the RevReader which implements RevRead solely on the basis of Read. This allows usage of the PacketReader with underlying readers that do not implement Seek.

The tests seem to pass (on my machine), but I have not yet tried to apply this to an OGG file where seeking is actually necessary. Do the tests cover that scenario?

Potential Drawbacks