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:
parent
5332dabffa
commit
0e83f8a0c4
@ -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 {
|
||||
|
@ -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())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user