Compare commits

..
1 Commits
Author SHA1 Message Date
sbaudlr 65ffc9e809 Merge branch feat/tally into main 2025-06-10 12:01:20 +01:00
9 changed files with 215 additions and 116 deletions
@@ -1,4 +1,7 @@
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;
@@ -0,0 +1,47 @@
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],
})
}
}
@@ -0,0 +1,40 @@
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],
})
}
}
@@ -0,0 +1,58 @@
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],
})
}
}
}
@@ -51,15 +51,14 @@ 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
};
state.info.multiviewer = Some(MultiviewerInfo::new(multiviewers, window_count))
}
state.info.multiviewer = Some(MultiviewerInfo::new(self.multiviewers, window_count));
}
}
@@ -8,9 +8,12 @@ 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,
},
@@ -77,6 +80,9 @@ 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,
}
}
+18 -4
View File
@@ -44,14 +44,28 @@ pub struct ClassicAudioHeadphoneOutputChannel {
pub talkback_gain: f64,
}
#[derive(Clone, PartialEq, Getters, new)]
#[derive(Clone, PartialEq, Getters)]
pub struct AtemClassicAudioState {
number_of_channels: Option<f64>,
has_monitor: Option<bool>,
number_of_channels: u8,
has_monitor: 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: Option<bool>,
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,
}
}
}
+6 -6
View File
@@ -31,9 +31,9 @@ pub struct SuperSourceInfo {
#[derive(Clone, PartialEq, Getters, new)]
pub struct AudioMixerInfo {
inputs: u64,
monitors: u64,
headphones: u64,
inputs: u8,
monitors: u8,
headphones: u8,
}
#[derive(Clone, PartialEq, Getters, new)]
@@ -49,13 +49,13 @@ pub struct MacroPoolInfo {
#[derive(Clone, PartialEq, Getters, new)]
pub struct MediaPoolInfo {
still_count: u64,
clip_count: u64,
still_count: u8,
clip_count: u8,
}
#[derive(Clone, PartialEq, Getters, new)]
pub struct MultiviewerInfo {
count: u8,
count: Option<u8>,
window_count: u8,
}
Generated
+30 -98
View File
@@ -2,15 +2,14 @@
"nodes": {
"devshell": {
"inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs"
},
"locked": {
"lastModified": 1705332421,
"narHash": "sha256-USpGLPme1IuqG78JNqSaRabilwkCyHmVWY0M9vYyqEA=",
"lastModified": 1741473158,
"narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=",
"owner": "numtide",
"repo": "devshell",
"rev": "83cb93d6d063ad290beee669f4badf9914cc16ec",
"rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0",
"type": "github"
},
"original": {
@@ -19,52 +18,16 @@
"type": "github"
}
},
"flake-utils": {
"inputs": {
"systems": "systems"
},
"locked": {
"lastModified": 1701680307,
"narHash": "sha256-kAuep2h5ajznlPMD9rnQyffWG8EM/C73lejGofXvdM8=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "4022d587cbbfd70fe950c1e2083a02621806a725",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"flake-utils_2": {
"inputs": {
"systems": "systems_2"
},
"locked": {
"lastModified": 1681202837,
"narHash": "sha256-H+Rh19JDwRtpVPAWp64F+rlEtxUWBAQW28eAi3SRSzg=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "cfacdce06f30d2b68473a46042957675eebb3401",
"type": "github"
},
"original": {
"owner": "numtide",
"repo": "flake-utils",
"type": "github"
}
},
"naersk": {
"inputs": {
"nixpkgs": "nixpkgs_2"
},
"locked": {
"lastModified": 1698420672,
"narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=",
"lastModified": 1745925850,
"narHash": "sha256-cyAAMal0aPrlb1NgzMxZqeN1mAJ2pJseDhm2m6Um8T0=",
"owner": "nix-community",
"repo": "naersk",
"rev": "aeb58d5e8faead8980a807c840232697982d47b9",
"rev": "38bc60bbc157ae266d4a0c96671c6c742ee17a5f",
"type": "github"
},
"original": {
@@ -75,11 +38,11 @@
},
"nixpkgs": {
"locked": {
"lastModified": 1704161960,
"narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=",
"lastModified": 1722073938,
"narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "63143ac2c9186be6d9da6035fa22620018c85932",
"rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae",
"type": "github"
},
"original": {
@@ -91,26 +54,26 @@
},
"nixpkgs_2": {
"locked": {
"lastModified": 1705883077,
"narHash": "sha256-ByzHHX3KxpU1+V0erFy8jpujTufimh6KaS/Iv3AciHk=",
"lastModified": 1749401433,
"narHash": "sha256-HXIQzULIG/MEUW2Q/Ss47oE3QrjxvpUX7gUl4Xp6lnc=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5f5210aa20e343b7e35f40c033000db0ef80d7b9",
"rev": "08fcb0dcb59df0344652b38ea6326a2d8271baff",
"type": "github"
},
"original": {
"id": "nixpkgs",
"type": "indirect"
"owner": "NixOS",
"ref": "nixpkgs-unstable",
"repo": "nixpkgs",
"type": "github"
}
},
"nixpkgs_3": {
"locked": {
"lastModified": 1705883077,
"narHash": "sha256-ByzHHX3KxpU1+V0erFy8jpujTufimh6KaS/Iv3AciHk=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "5f5210aa20e343b7e35f40c033000db0ef80d7b9",
"type": "github"
"lastModified": 0,
"narHash": "sha256-DDe16FJk18sadknQKKG/9FbwEro7A57tg9vB5kxZ8kY=",
"path": "/nix/store/2d1ahim48jhzg4bbm97mvjlb4p7fpan3-source",
"type": "path"
},
"original": {
"id": "nixpkgs",
@@ -119,11 +82,11 @@
},
"nixpkgs_4": {
"locked": {
"lastModified": 1681358109,
"narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
"lastModified": 1744536153,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=",
"owner": "NixOS",
"repo": "nixpkgs",
"rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11",
"type": "github"
},
"original": {
@@ -144,15 +107,14 @@
},
"rust-overlay": {
"inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_4"
},
"locked": {
"lastModified": 1705976279,
"narHash": "sha256-Zx97bJ3+O8IP70uJPD//rRsr8bcxICISMTZUT/L9eFk=",
"lastModified": 1749436897,
"narHash": "sha256-OkDtaCGQQVwVFz5HWfbmrMJR99sFIMXHCHEYXzUJEJY=",
"owner": "oxalica",
"repo": "rust-overlay",
"rev": "f889dc31ef97835834bdc3662394ebdb3c96b974",
"rev": "e7876c387e35dc834838aff254d8e74cf5bd4f19",
"type": "github"
},
"original": {
@@ -176,46 +138,16 @@
"type": "github"
}
},
"systems_2": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"systems_3": {
"locked": {
"lastModified": 1681028828,
"narHash": "sha256-Vy1rq5AaRuLzOxct8nz4T6wlgyUR7zLU309k9mBC768=",
"owner": "nix-systems",
"repo": "default",
"rev": "da67096a3b9bf56a91d16901293e51ba5b49a27e",
"type": "github"
},
"original": {
"owner": "nix-systems",
"repo": "default",
"type": "github"
}
},
"utils": {
"inputs": {
"systems": "systems_3"
"systems": "systems"
},
"locked": {
"lastModified": 1705309234,
"narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"lastModified": 1731533236,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=",
"owner": "numtide",
"repo": "flake-utils",
"rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b",
"type": "github"
},
"original": {