projects
/
nihav.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
205d69b
)
format: add channel map conversion from M$ WAVE bitmask
author
Kostya Shishkov
<kostya.shishkov@gmail.com>
Thu, 11 Oct 2018 15:57:31 +0000
(17:57 +0200)
committer
Kostya Shishkov
<kostya.shishkov@gmail.com>
Thu, 11 Oct 2018 15:57:31 +0000
(17:57 +0200)
src/formats.rs
patch
|
blob
|
blame
|
history
diff --git
a/src/formats.rs
b/src/formats.rs
index 5481c760ca4c5670f13611a964f1dfb12d238042..b72cd1a23bae262950abce483caecc5a226f2956 100644
(file)
--- a/
src/formats.rs
+++ b/
src/formats.rs
@@
-175,6
+175,20
@@
pub struct NAChannelMap {
ids: Vec<NAChannelType>,
}
ids: Vec<NAChannelType>,
}
+const MS_CHANNEL_MAP: [NAChannelType; 11] = [
+ NAChannelType::L,
+ NAChannelType::R,
+ NAChannelType::C,
+ NAChannelType::LFE,
+ NAChannelType::Ls,
+ NAChannelType::Rs,
+ NAChannelType::Lss,
+ NAChannelType::Rss,
+ NAChannelType::Cs,
+ NAChannelType::Lc,
+ NAChannelType::Rc,
+];
+
impl NAChannelMap {
pub fn new() -> Self { NAChannelMap { ids: Vec::new() } }
pub fn add_channel(&mut self, ch: NAChannelType) {
impl NAChannelMap {
pub fn new() -> Self { NAChannelMap { ids: Vec::new() } }
pub fn add_channel(&mut self, ch: NAChannelType) {
@@
-197,6
+211,15
@@
impl NAChannelMap {
}
None
}
}
None
}
+ pub fn from_ms_mapping(chmap: u32) -> Self {
+ let mut cm = NAChannelMap::new();
+ for i in 0..MS_CHANNEL_MAP.len() {
+ if ((chmap >> i) & 1) != 0 {
+ cm.add_channel(MS_CHANNEL_MAP[i]);
+ }
+ }
+ cm
+ }
}
impl fmt::Display for NAChannelMap {
}
impl fmt::Display for NAChannelMap {