encoder/audio: add set_channels()

For this a method for `ChannelLayout` to retrieve the number of channels was
also added.
This commit is contained in:
lummax 2015-08-31 22:53:23 +02:00 committed by meh
parent 5332dabffa
commit 0e83f8a0c4
2 changed files with 14 additions and 0 deletions

View File

@ -66,6 +66,12 @@ impl Audio {
(*self.as_mut_ptr()).channel_layout = value.bits();
}
}
pub fn set_channels(&mut self, value: i32) {
unsafe {
(*self.as_mut_ptr()).channels = value;
}
}
}
impl Deref for Audio {

View File

@ -59,3 +59,11 @@ bitflags! {
const STEREO_DOWNMIX = STEREO_LEFT.bits | STEREO_RIGHT.bits,
}
}
impl ChannelLayout {
pub fn channels(&self) -> i32 {
unsafe {
av_get_channel_layout_nb_channels(self.bits())
}
}
}