rodio icon indicating copy to clipboard operation
rodio copied to clipboard

Feature: Channel bitmasks

Open iluvcapra opened this issue 1 year ago • 7 comments

Create a channel bitmask mechanism to allow sources to tell their consumers how their channels may map to speakers.

iluvcapra avatar Dec 08 '24 02:12 iluvcapra

Might need an example since I do not completely get how this will work.

Is the idea that decoders are going to implement the new trait? In that case: https://docs.rs/symphonia-core/0.5.4/symphonia_core/codecs/struct.CodecParameters.html#structfield.channel_layout might be relevant. This matches the order assumed by channelcountconverter. I do not know what the other decoders do...

yara-blue avatar Dec 10 '24 09:12 yara-blue

Oh good, I was looking for a file source that made this information available.

Wave files should make this available if they have > 2 channels, and the channel bitmaps are based on what Wave uses, but Hound doesn't seem to make this information available. I see what struct would have it and they just don't have a slot for it.

iluvcapra avatar Dec 10 '24 16:12 iluvcapra

In fact this works almost exactly like symphonia's Channels type, I've just defined more values. https://docs.rs/symphonia-core/0.5.4/src/symphonia_core/audio.rs.html#29-90

iluvcapra avatar Dec 10 '24 16:12 iluvcapra

Channel name mapping (name->channel_number) can be part of the stream format (it's metadata), so filters can use it if they need. We may require that filters pass it through. Just saying...

PetrGlad avatar Dec 11 '24 21:12 PetrGlad

Channel name mapping (name->channel_number) can be part of the stream format (it's metadata), so filters can use it if they need. We may require that filters pass it through. Just saying...

I'd see this PR as "transitional" but yes channel_bitmask() needs to be part of trait Source, and should be, it's very necessary for working with multichannel audio.

iluvcapra avatar Dec 13 '24 15:12 iluvcapra

I'd see this PR as "transitional" but yes channel_bitmask() needs to be part of trait Source, and should be, it's very necessary for working with multichannel audio.

I'm okay with that, is there a default implementation you could give Source?

yara-blue avatar Dec 13 '24 16:12 yara-blue

let me know if this is ready for review.

yara-blue avatar Jan 02 '25 10:01 yara-blue