feat: _mpl

This commit is contained in:
Baud 2024-04-08 20:12:26 +01:00
parent 8a3b535856
commit 34ff52c65c
4 changed files with 45 additions and 2 deletions

View File

@ -1,3 +1,4 @@
pub mod media_pool_config;
pub mod mix_effect_block_config;
pub mod product_identifier;
pub mod topology;

View File

@ -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],
})
}
}

View File

@ -8,6 +8,7 @@ use crate::{
use super::{
command_base::{CommandDeserializer, DeserializedCommand},
device_profile::{
media_pool_config::{MediaPoolConfigDeserializer, DESERIALIZE_MEDIA_POOL_CONFIG_NAME},
mix_effect_block_config::{
MixEffectBlockConfigDeserializer, DESERIALIZE_MIX_EFFECT_BLOCK_CONFIG_NAME,
},
@ -77,6 +78,7 @@ 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()),
_ => None,
}
}

View File

@ -49,8 +49,8 @@ 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)]