RustAudio / ogg

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

Add method to retrieve the checksum of the end page for a `Packet` #38

Closed AlexTMjugador closed 1 year ago

AlexTMjugador commented 1 year ago

The Ogg specification demands that each Ogg page has a checksum of its data for error detection and correction purposes. Logically, this checksum is an implementation detail of the Ogg transport, and higher-level decoders need not know it to parse logical bitstreams. However, specialized decoders may want to efficiently use it to compute a checksum of the data that flows through it, avoiding hashing packet data again (this is my concrete use case for that). In addition, testing code may also find use in a checksum to assert that the data of the page a packet belongs to is reasonably similar to what's expected.

Given that the Ogg parsing code already reads and compares page checksums, exposing them in the public Packet API, which already allows users to retrieve Ogg encapsulation data such as the granule position, comes at practically no additional cost.

AlexTMjugador commented 1 year ago

It looks like a CI checks fail due to a transitive dependency on socket2 expecting a higher MSRV than 1.56.1. Please let me know if I should bother with this before merging this PR!

est31 commented 1 year ago

Yeah ideally one would add sth like cargo update -p socket2 --precise <last version still working> to the CI script.

AlexTMjugador commented 1 year ago

CI is green now! :tada: