Compare commits

..

No commits in common. "535529dc3a11a573ec535b0dc0f33fc124e80afa" and "8a3b535856f199be1b75563dfb443cb21be369af" have entirely different histories.

8 changed files with 18 additions and 185 deletions

View File

@ -1,7 +1,4 @@
pub mod audio_mixer_config;
pub mod media_pool_config;
pub mod mix_effect_block_config;
pub mod multiviewer_config;
pub mod product_identifier;
pub mod topology;
pub mod version;

View File

@ -1,47 +0,0 @@
use std::sync::Arc;
use crate::{
commands::command_base::{CommandDeserializer, DeserializedCommand},
state::{audio::AtemClassicAudioState, info::AudioMixerInfo},
};
pub const DESERIALIZE_AUDIO_MIXER_CONFIG_NAME: &str = "_AMC";
#[derive(Debug)]
pub struct AudioMixerConfig {
inputs: u8,
monitors: u8,
headphones: u8,
}
impl DeserializedCommand for AudioMixerConfig {
fn raw_name(&self) -> &'static str {
DESERIALIZE_AUDIO_MIXER_CONFIG_NAME
}
fn apply_to_state(&self, state: &mut crate::state::AtemState) {
state.info.audio_mixer = Some(AudioMixerInfo::new(
self.inputs,
self.monitors,
self.headphones,
));
state.audio = Some(AtemClassicAudioState::new(self.inputs, self.monitors != 0))
}
}
#[derive(Default)]
pub struct AudioMixerConfigDeserializer {}
impl CommandDeserializer for AudioMixerConfigDeserializer {
fn deserialize(
&self,
buffer: &[u8],
version: &crate::enums::ProtocolVersion,
) -> std::sync::Arc<dyn DeserializedCommand> {
Arc::new(AudioMixerConfig {
inputs: buffer[0],
monitors: buffer[1],
headphones: buffer[2],
})
}
}

View File

@ -1,40 +0,0 @@
use std::sync::Arc;
use crate::{
commands::command_base::{CommandDeserializer, DeserializedCommand},
state::info::MediaPoolInfo,
};
pub const DESERIALIZE_MEDIA_POOL_CONFIG_NAME: &str = "_mpl";
#[derive(Debug)]
pub struct MediaPoolConfig {
still_count: u8,
clip_count: u8,
}
impl DeserializedCommand for MediaPoolConfig {
fn raw_name(&self) -> &'static str {
DESERIALIZE_MEDIA_POOL_CONFIG_NAME
}
fn apply_to_state(&self, state: &mut crate::state::AtemState) {
state.info.media_pool = Some(MediaPoolInfo::new(self.still_count, self.clip_count))
}
}
#[derive(Default)]
pub struct MediaPoolConfigDeserializer {}
impl CommandDeserializer for MediaPoolConfigDeserializer {
fn deserialize(
&self,
buffer: &[u8],
_version: &crate::enums::ProtocolVersion,
) -> std::sync::Arc<dyn DeserializedCommand> {
Arc::new(MediaPoolConfig {
still_count: buffer[0],
clip_count: buffer[1],
})
}
}

View File

@ -1,58 +0,0 @@
use std::sync::Arc;
use crate::{
commands::command_base::{CommandDeserializer, DeserializedCommand},
enums::ProtocolVersion,
state::info::MultiviewerInfo,
};
pub const DESERIALIZE_MULTIVIEWER_NAME: &str = "_MvC";
#[derive(Debug)]
pub struct MultiviewerConfig {
count: Option<u8>,
window_count: u8,
}
impl DeserializedCommand for MultiviewerConfig {
fn raw_name(&self) -> &'static str {
DESERIALIZE_MULTIVIEWER_NAME
}
fn apply_to_state(&self, state: &mut crate::state::AtemState) {
// TODO: This can't be right...
let existing_count = match &state.info.multiviewer {
Some(multiviewer) => multiviewer.count().as_ref().copied(),
None => None,
};
let count = match self.count {
Some(count) => Some(count),
None => existing_count,
};
state.info.multiviewer = Some(MultiviewerInfo::new(count, self.window_count));
}
}
#[derive(Default)]
pub struct MultiviewerConfigDeserializer {}
impl CommandDeserializer for MultiviewerConfigDeserializer {
fn deserialize(
&self,
buffer: &[u8],
version: &crate::enums::ProtocolVersion,
) -> std::sync::Arc<dyn DeserializedCommand> {
if *version >= ProtocolVersion::V8_1_1 {
Arc::new(MultiviewerConfig {
count: None,
window_count: buffer[1],
})
} else {
Arc::new(MultiviewerConfig {
count: Some(buffer[0]),
window_count: buffer[1],
})
}
}
}

View File

@ -51,14 +51,15 @@ impl DeserializedCommand for Topology {
self.advanced_chroma_keyers,
self.only_configurable_outputs,
));
if let Some(multiviewers) = self.multiviewers {
let window_count = if let Some(mv) = &state.info.multiviewer {
*mv.window_count()
} else {
10
};
let window_count = if let Some(mv) = &state.info.multiviewer {
*mv.window_count()
} else {
10
};
state.info.multiviewer = Some(MultiviewerInfo::new(self.multiviewers, window_count));
state.info.multiviewer = Some(MultiviewerInfo::new(multiviewers, window_count))
}
}
}

View File

@ -8,12 +8,9 @@ use crate::{
use super::{
command_base::{CommandDeserializer, DeserializedCommand},
device_profile::{
audio_mixer_config::{AudioMixerConfigDeserializer, DESERIALIZE_AUDIO_MIXER_CONFIG_NAME},
media_pool_config::{MediaPoolConfigDeserializer, DESERIALIZE_MEDIA_POOL_CONFIG_NAME},
mix_effect_block_config::{
MixEffectBlockConfigDeserializer, DESERIALIZE_MIX_EFFECT_BLOCK_CONFIG_NAME,
},
multiviewer_config::{MultiviewerConfigDeserializer, DESERIALIZE_MULTIVIEWER_NAME},
product_identifier::{
ProductIdentifierDeserializer, DESERIALIZE_PRODUCT_IDENTIFIER_RAW_NAME,
},
@ -80,9 +77,6 @@ fn command_deserializer_from_string(command_str: &str) -> Option<Box<dyn Command
DESERIALIZE_PRODUCT_IDENTIFIER_RAW_NAME => {
Some(Box::<ProductIdentifierDeserializer>::default())
}
DESERIALIZE_MEDIA_POOL_CONFIG_NAME => Some(Box::<MediaPoolConfigDeserializer>::default()),
DESERIALIZE_MULTIVIEWER_NAME => Some(Box::<MultiviewerConfigDeserializer>::default()),
DESERIALIZE_AUDIO_MIXER_CONFIG_NAME => Some(Box::<AudioMixerConfigDeserializer>::default()),
_ => None,
}
}

View File

@ -44,28 +44,14 @@ pub struct ClassicAudioHeadphoneOutputChannel {
pub talkback_gain: f64,
}
#[derive(Clone, PartialEq, Getters)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct AtemClassicAudioState {
number_of_channels: u8,
has_monitor: bool,
number_of_channels: Option<f64>,
has_monitor: Option<bool>,
pub channels: HashMap<u64, ClassicAudioChannel>,
pub monitor: Option<ClassicAudioMonitorChannel>,
pub headphones: Option<ClassicAudioHeadphoneOutputChannel>,
pub master: Option<ClassicAudioMasterChannel>,
pub audio_follow_video_crossfade_transition_enabled: bool,
}
impl AtemClassicAudioState {
pub fn new(number_of_channels: u8, has_monitor: bool) -> Self {
Self {
number_of_channels,
has_monitor,
channels: Default::default(),
monitor: Default::default(),
headphones: Default::default(),
master: Default::default(),
audio_follow_video_crossfade_transition_enabled: false,
}
}
pub audio_follow_video_crossfade_transition_enabled: Option<bool>,
}

View File

@ -31,9 +31,9 @@ pub struct SuperSourceInfo {
#[derive(Clone, PartialEq, Getters, new)]
pub struct AudioMixerInfo {
inputs: u8,
monitors: u8,
headphones: u8,
inputs: u64,
monitors: u64,
headphones: u64,
}
#[derive(Clone, PartialEq, Getters, new)]
@ -49,13 +49,13 @@ pub struct MacroPoolInfo {
#[derive(Clone, PartialEq, Getters, new)]
pub struct MediaPoolInfo {
still_count: u8,
clip_count: u8,
still_count: u64,
clip_count: u64,
}
#[derive(Clone, PartialEq, Getters, new)]
pub struct MultiviewerInfo {
count: Option<u8>,
count: u8,
window_count: u8,
}