RustAudio / lewton

Rust vorbis decoder
Other
259 stars 26 forks source link

Manually construct headers #102

Open tversteeg opened 2 years ago

tversteeg commented 2 years ago

I would like to be able to manually construct the vorbis headers without reading them from a byte stream. I'm reading the vorbis data from a custom format which encodes the headers differently, but the rest of the data is still the same.

As of now some parts of the header creation process in this library are only public within the crate. I can submit a PR making them all public, but I'm not sure if that would allow me to create them manually.

est31 commented 2 years ago

I'm not sure how to progress here...

fundamentally the internals of the headers are supposed to be unstable, while the public API is supposed to be more stable. I do want to help with your feature request however, as it seems weird to me that you should be required to convert the headers into the standard vorbis format in order to use this library.

Which headers are we talking about? All three of them? Or just a subset?

tversteeg commented 2 years ago

I'm talking about all three headers yeah.

My current workaround solution for this problem is recreating the headers as raw bytes myself. I've succesfully created the identifier and the (empty) comment headers, which was quite easy to do. The setup looks a lot harder so I'll give that a proper shot later this week.

For my use case this solution works out well enough although it is quite an ugly workaround.