RustAudio / rodio

Rust audio playback library
Apache License 2.0
1.66k stars 214 forks source link

(Issue and Proposal) Rodio's features can be confusing #539

Open dvdsk opened 5 months ago

dvdsk commented 5 months ago

Background

Terminology

An audio file is a container (mp4/mkv etc). A container contains one or more streams and possibly metadata. Those streams are encoded with a codec. For audio those streams are usually multiple tracks. Rodio currently has no way to deal with multiple tracks in one file/container.

Some containers are special and can contain only a stream encoded with one specific codec. For example mp3 contains only MPEG-1 Audio Layer 3 encoded stream. Flac is another of these.

Features in rodio

Features in rodio can have two functions:

Right now there is no structure to the symphonia related features. There are features which

Right now (cause of #516 and probably #527) we can not play ogg files. While there is a feature to enable the vorbis codec usually used in an ogg there is no feature to enable support for the ogg container. This will be addressed shortly.

Issue

This can be pretty confusing to users not familiar with the difference between codecs and decoders (such as me this morning). The errors you get if you fail to enable a codec feature can be puzzling. Without looking at the source code it is not possible to predict what a feature combination will do.

Proposal

  1. Document how enabled features determines the decoder used by rodio. Using different decoders for different streams in the same container will only be possible when specifying enabled codec and containers separately. As an example, it will be possible to configure rodio such that it uses lewton for ogg containing a vorbis stream while decoding ogg containing flac with symphonia.

    1. Make the current container features (for example symphonia-isomp4) enable all codecs. This removes the pitfall of #516.

    2. Add features that only enable a container without enabling any codecs to facilitate 1. and allow speeding up compilation.


Please let me know what you (the rodio user) think.