Compare commits

..
26 Commits
Author SHA1 Message Date
sbaudlr 8a3b535856 feat: _MeC 2024-03-19 23:19:07 +00:00
sbaudlr 5e5d3508f0 feat: _top 2024-03-19 20:40:51 +00:00
sbaudlr 25460d77cd feat: Handle version command 2024-03-19 20:31:25 +00:00
sbaudlr d2f41821c0 wip: _top 2024-03-18 19:23:28 +00:00
sbaudlr 493bf7a6e8 feat: _pin command 2024-03-17 14:16:00 +00:00
sbaudlr c5ed966070 fix: Panic more! 2024-03-16 17:59:12 +00:00
sbaudlr 7e973af192 fix: Not ticking 2024-03-16 17:41:16 +00:00
sbaudlr 689138b282 chore: Begone &Box<T> 2024-03-16 17:14:31 +00:00
sbaudlr 2325645bb5 feat: Handle program input 2024-03-11 00:30:16 +00:00
sbaudlr 46cca11e00 chore: More cleanups 2024-03-11 00:04:05 +00:00
sbaudlr 90b2cfd984 chore: Various cleanups 2024-03-10 21:53:30 +00:00
sbaudlr 2bbf2c5c6b wip: More command handling 2024-03-10 02:08:35 +00:00
sbaudlr 4a075c3d1e wip: handle received commands 2024-03-08 17:43:53 +00:00
sbaudlr 9dd8cc0574 chore: motd 2024-03-07 22:35:10 +00:00
sbaudlr 676ff7630e feat: Wait for connect 2024-03-04 21:33:46 +00:00
sbaudlr 4a41d1f5d7 feat: Atem wrapper 2024-03-01 17:11:57 +00:00
sbaudlr 5db8843ce7 feat: Use AtemPacket struct 2024-02-28 18:43:21 +00:00
sbaudlr 34a268f0bf chore: Stubs for tally events 2024-02-27 10:19:17 +00:00
sbaudlr e3a0d7973d fix: Don't spawn threads 2024-02-27 10:15:44 +00:00
sbaudlr c30913f823 feat: Deserializing commands 2024-02-24 17:01:28 +00:00
sbaudlr c80d7643ca feat: Program Input deserialization 2024-02-23 11:40:57 +00:00
sbaudlr 9d872eecc9 feat: Very basic tally parsing 2024-02-12 22:53:55 +00:00
sbaudlr 2ee3d71e78 feat: IP arg 2024-02-05 21:34:03 +00:00
sbaudlr 80b73922ac chore: Some logging 2024-02-05 21:33:48 +00:00
sbaudlr de6f4b2a4d chore: Derive default 2024-02-05 21:13:53 +00:00
sbaudlr 621b085381 chore: cargo fmt 2024-02-05 21:12:17 +00:00
9 changed files with 116 additions and 215 deletions
@@ -1,7 +1,4 @@
pub mod audio_mixer_config;
pub mod media_pool_config;
pub mod mix_effect_block_config; pub mod mix_effect_block_config;
pub mod multiviewer_config;
pub mod product_identifier; pub mod product_identifier;
pub mod topology; pub mod topology;
pub mod version; pub mod version;
@@ -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],
})
}
}
@@ -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],
})
}
}
@@ -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],
})
}
}
}
@@ -51,14 +51,15 @@ impl DeserializedCommand for Topology {
self.advanced_chroma_keyers, self.advanced_chroma_keyers,
self.only_configurable_outputs, self.only_configurable_outputs,
)); ));
if let Some(multiviewers) = self.multiviewers {
let window_count = if let Some(mv) = &state.info.multiviewer { let window_count = if let Some(mv) = &state.info.multiviewer {
*mv.window_count() *mv.window_count()
} else { } else {
10 10
}; };
state.info.multiviewer = Some(MultiviewerInfo::new(self.multiviewers, window_count)); state.info.multiviewer = Some(MultiviewerInfo::new(multiviewers, window_count))
}
} }
} }
@@ -8,12 +8,9 @@ use crate::{
use super::{ use super::{
command_base::{CommandDeserializer, DeserializedCommand}, command_base::{CommandDeserializer, DeserializedCommand},
device_profile::{ device_profile::{
audio_mixer_config::{AudioMixerConfigDeserializer, DESERIALIZE_AUDIO_MIXER_CONFIG_NAME},
media_pool_config::{MediaPoolConfigDeserializer, DESERIALIZE_MEDIA_POOL_CONFIG_NAME},
mix_effect_block_config::{ mix_effect_block_config::{
MixEffectBlockConfigDeserializer, DESERIALIZE_MIX_EFFECT_BLOCK_CONFIG_NAME, MixEffectBlockConfigDeserializer, DESERIALIZE_MIX_EFFECT_BLOCK_CONFIG_NAME,
}, },
multiviewer_config::{MultiviewerConfigDeserializer, DESERIALIZE_MULTIVIEWER_NAME},
product_identifier::{ product_identifier::{
ProductIdentifierDeserializer, DESERIALIZE_PRODUCT_IDENTIFIER_RAW_NAME, 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 => { DESERIALIZE_PRODUCT_IDENTIFIER_RAW_NAME => {
Some(Box::<ProductIdentifierDeserializer>::default()) 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, _ => None,
} }
} }
+4 -18
View File
@@ -44,28 +44,14 @@ pub struct ClassicAudioHeadphoneOutputChannel {
pub talkback_gain: f64, pub talkback_gain: f64,
} }
#[derive(Clone, PartialEq, Getters)] #[derive(Clone, PartialEq, Getters, new)]
pub struct AtemClassicAudioState { pub struct AtemClassicAudioState {
number_of_channels: u8, number_of_channels: Option<f64>,
has_monitor: bool, has_monitor: Option<bool>,
pub channels: HashMap<u64, ClassicAudioChannel>, pub channels: HashMap<u64, ClassicAudioChannel>,
pub monitor: Option<ClassicAudioMonitorChannel>, pub monitor: Option<ClassicAudioMonitorChannel>,
pub headphones: Option<ClassicAudioHeadphoneOutputChannel>, pub headphones: Option<ClassicAudioHeadphoneOutputChannel>,
pub master: Option<ClassicAudioMasterChannel>, pub master: Option<ClassicAudioMasterChannel>,
pub audio_follow_video_crossfade_transition_enabled: bool, pub audio_follow_video_crossfade_transition_enabled: Option<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)] #[derive(Clone, PartialEq, Getters, new)]
pub struct AudioMixerInfo { pub struct AudioMixerInfo {
inputs: u8, inputs: u64,
monitors: u8, monitors: u64,
headphones: u8, headphones: u64,
} }
#[derive(Clone, PartialEq, Getters, new)] #[derive(Clone, PartialEq, Getters, new)]
@@ -49,13 +49,13 @@ pub struct MacroPoolInfo {
#[derive(Clone, PartialEq, Getters, new)] #[derive(Clone, PartialEq, Getters, new)]
pub struct MediaPoolInfo { pub struct MediaPoolInfo {
still_count: u8, still_count: u64,
clip_count: u8, clip_count: u64,
} }
#[derive(Clone, PartialEq, Getters, new)] #[derive(Clone, PartialEq, Getters, new)]
pub struct MultiviewerInfo { pub struct MultiviewerInfo {
count: Option<u8>, count: u8,
window_count: u8, window_count: u8,
} }
Generated
+98 -30
View File
@@ -2,14 +2,15 @@
"nodes": { "nodes": {
"devshell": { "devshell": {
"inputs": { "inputs": {
"flake-utils": "flake-utils",
"nixpkgs": "nixpkgs" "nixpkgs": "nixpkgs"
}, },
"locked": { "locked": {
"lastModified": 1741473158, "lastModified": 1705332421,
"narHash": "sha256-kWNaq6wQUbUMlPgw8Y+9/9wP0F8SHkjy24/mN3UAppg=", "narHash": "sha256-USpGLPme1IuqG78JNqSaRabilwkCyHmVWY0M9vYyqEA=",
"owner": "numtide", "owner": "numtide",
"repo": "devshell", "repo": "devshell",
"rev": "7c9e793ebe66bcba8292989a68c0419b737a22a0", "rev": "83cb93d6d063ad290beee669f4badf9914cc16ec",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -18,16 +19,52 @@
"type": "github" "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": { "naersk": {
"inputs": { "inputs": {
"nixpkgs": "nixpkgs_2" "nixpkgs": "nixpkgs_2"
}, },
"locked": { "locked": {
"lastModified": 1745925850, "lastModified": 1698420672,
"narHash": "sha256-cyAAMal0aPrlb1NgzMxZqeN1mAJ2pJseDhm2m6Um8T0=", "narHash": "sha256-/TdeHMPRjjdJub7p7+w55vyABrsJlt5QkznPYy55vKA=",
"owner": "nix-community", "owner": "nix-community",
"repo": "naersk", "repo": "naersk",
"rev": "38bc60bbc157ae266d4a0c96671c6c742ee17a5f", "rev": "aeb58d5e8faead8980a807c840232697982d47b9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -38,11 +75,11 @@
}, },
"nixpkgs": { "nixpkgs": {
"locked": { "locked": {
"lastModified": 1722073938, "lastModified": 1704161960,
"narHash": "sha256-OpX0StkL8vpXyWOGUD6G+MA26wAXK6SpT94kLJXo6B4=", "narHash": "sha256-QGua89Pmq+FBAro8NriTuoO/wNaUtugt29/qqA8zeeM=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "e36e9f57337d0ff0cf77aceb58af4c805472bfae", "rev": "63143ac2c9186be6d9da6035fa22620018c85932",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -54,26 +91,26 @@
}, },
"nixpkgs_2": { "nixpkgs_2": {
"locked": { "locked": {
"lastModified": 1749401433, "lastModified": 1705883077,
"narHash": "sha256-HXIQzULIG/MEUW2Q/Ss47oE3QrjxvpUX7gUl4Xp6lnc=", "narHash": "sha256-ByzHHX3KxpU1+V0erFy8jpujTufimh6KaS/Iv3AciHk=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "08fcb0dcb59df0344652b38ea6326a2d8271baff", "rev": "5f5210aa20e343b7e35f40c033000db0ef80d7b9",
"type": "github" "type": "github"
}, },
"original": { "original": {
"owner": "NixOS", "id": "nixpkgs",
"ref": "nixpkgs-unstable", "type": "indirect"
"repo": "nixpkgs",
"type": "github"
} }
}, },
"nixpkgs_3": { "nixpkgs_3": {
"locked": { "locked": {
"lastModified": 0, "lastModified": 1705883077,
"narHash": "sha256-DDe16FJk18sadknQKKG/9FbwEro7A57tg9vB5kxZ8kY=", "narHash": "sha256-ByzHHX3KxpU1+V0erFy8jpujTufimh6KaS/Iv3AciHk=",
"path": "/nix/store/2d1ahim48jhzg4bbm97mvjlb4p7fpan3-source", "owner": "NixOS",
"type": "path" "repo": "nixpkgs",
"rev": "5f5210aa20e343b7e35f40c033000db0ef80d7b9",
"type": "github"
}, },
"original": { "original": {
"id": "nixpkgs", "id": "nixpkgs",
@@ -82,11 +119,11 @@
}, },
"nixpkgs_4": { "nixpkgs_4": {
"locked": { "locked": {
"lastModified": 1744536153, "lastModified": 1681358109,
"narHash": "sha256-awS2zRgF4uTwrOKwwiJcByDzDOdo3Q1rPZbiHQg/N38=", "narHash": "sha256-eKyxW4OohHQx9Urxi7TQlFBTDWII+F+x2hklDOQPB50=",
"owner": "NixOS", "owner": "NixOS",
"repo": "nixpkgs", "repo": "nixpkgs",
"rev": "18dd725c29603f582cf1900e0d25f9f1063dbf11", "rev": "96ba1c52e54e74c3197f4d43026b3f3d92e83ff9",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -107,14 +144,15 @@
}, },
"rust-overlay": { "rust-overlay": {
"inputs": { "inputs": {
"flake-utils": "flake-utils_2",
"nixpkgs": "nixpkgs_4" "nixpkgs": "nixpkgs_4"
}, },
"locked": { "locked": {
"lastModified": 1749436897, "lastModified": 1705976279,
"narHash": "sha256-OkDtaCGQQVwVFz5HWfbmrMJR99sFIMXHCHEYXzUJEJY=", "narHash": "sha256-Zx97bJ3+O8IP70uJPD//rRsr8bcxICISMTZUT/L9eFk=",
"owner": "oxalica", "owner": "oxalica",
"repo": "rust-overlay", "repo": "rust-overlay",
"rev": "e7876c387e35dc834838aff254d8e74cf5bd4f19", "rev": "f889dc31ef97835834bdc3662394ebdb3c96b974",
"type": "github" "type": "github"
}, },
"original": { "original": {
@@ -138,16 +176,46 @@
"type": "github" "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": { "utils": {
"inputs": { "inputs": {
"systems": "systems" "systems": "systems_3"
}, },
"locked": { "locked": {
"lastModified": 1731533236, "lastModified": 1705309234,
"narHash": "sha256-l0KFg5HjrsfsO/JpG+r7fRrqm12kzFHyUHqHCVpMMbI=", "narHash": "sha256-uNRRNRKmJyCRC/8y1RqBkqWBLM034y4qN7EprSdmgyA=",
"owner": "numtide", "owner": "numtide",
"repo": "flake-utils", "repo": "flake-utils",
"rev": "11707dc2f618dd54ca8739b309ec4fc024de578b", "rev": "1ef2e671c3b0c19053962c07dbda38332dcebf26",
"type": "github" "type": "github"
}, },
"original": { "original": {