Add ChannelLayout API (#38)

* Create channel_layout directory

* Rename ChannelLayout -> ChannelLayoutMask

* Add enum Channel (<-> AVChannel)

* Add struct ChannelCustom (<-> AVChannelCustom)

* Add enum ChannelOrder (<-> AVChannelOrder)

* Add struct ChannelLayout

- Smart copy-on-write pointer to AVChannelLayout
- idiomatic Rust API wrapping around FFmpeg APIs
- no Ambisonic support (yet)
- consts will need to be manually updated

* Add ChannelLayoutIter (iterator over all standard layouts)

* Add codec/Audio::ch_layouts

* Add ch_layout API to Audio-related structs
This commit is contained in:
FreezyLemon
2024-04-23 14:59:15 +02:00
committed by GitHub
parent 3a9f4584a0
commit 3206eedcf0
19 changed files with 1115 additions and 47 deletions

View File

@ -2,7 +2,7 @@ use std::marker::PhantomData;
use super::{Sink, Source};
use crate::ffi::*;
use crate::{format, option, ChannelLayout};
use crate::{format, option, ChannelLayoutMask};
use libc::c_void;
pub struct Context<'a> {
@ -49,7 +49,7 @@ impl<'a> Context<'a> {
let _ = option::Settable::set(self, "sample_rates", &i64::from(value));
}
pub fn set_channel_layout(&mut self, value: ChannelLayout) {
pub fn set_channel_layout(&mut self, value: ChannelLayoutMask) {
let _ = option::Settable::set(self, "channel_layouts", &value.bits());
}
}