wip: More command handling

This commit is contained in:
Baud 2024-03-10 02:08:35 +00:00
parent 4a075c3d1e
commit 2bbf2c5c6b
24 changed files with 146 additions and 483 deletions

View File

@ -139,6 +139,7 @@ impl Atem {
status: &mut AtemConnectionStatus,
commands: VecDeque<Arc<dyn DeserializedCommand>>,
) {
let new_state = state.clone();
for command in commands {
match command.raw_name() {
DESERIALIZE_VERSION_RAW_NAME => {
@ -149,8 +150,15 @@ impl Atem {
DESERIALIZE_TIME_RAW_NAME => {
todo!("Time command")
}
_ => {}
_ => {
command.apply_to_state(state);
}
}
}
if new_state != *state {
*state = new_state;
todo!("Emit change");
}
}
}

View File

@ -4,7 +4,7 @@ use crate::{enums::ProtocolVersion, state::AtemState};
pub trait DeserializedCommand: Send + Sync + Debug {
fn raw_name(&self) -> &'static str;
fn apply_to_state(&self, state: &mut AtemState) -> Vec<String>;
fn apply_to_state(&self, state: &mut AtemState) -> bool;
}
pub trait CommandDeserializer: Send + Sync {

View File

@ -16,8 +16,8 @@ impl DeserializedCommand for VersionCommand {
DESERIALIZE_VERSION_RAW_NAME
}
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> Vec<String> {
todo!()
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> bool {
todo!("Apply to state: Version")
}
}

View File

@ -12,8 +12,8 @@ impl DeserializedCommand for InitComplete {
DESERIALIZE_INIT_COMPLETE_RAW_NAME
}
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> Vec<String> {
todo!()
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> bool {
todo!("Apply to state: Init Complete")
}
}

View File

@ -37,8 +37,8 @@ impl DeserializedCommand for ProgramInput {
DESERIALIZE_PROGRAM_INPUT_RAW_NAME
}
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> Vec<String> {
todo!()
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> bool {
todo!("Apply to state: Program Input")
}
}

View File

@ -20,8 +20,8 @@ impl DeserializedCommand for TallyBySource {
DESERIALIZE_TALLY_BY_SOURCE_RAW_NAME
}
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> Vec<String> {
todo!()
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> bool {
todo!("Apply to state: Tally By Source")
}
}

View File

@ -23,8 +23,8 @@ impl DeserializedCommand for Time {
DESERIALIZE_TIME_RAW_NAME
}
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> Vec<String> {
todo!()
fn apply_to_state(&self, state: &mut crate::state::AtemState) -> bool {
false
}
}

View File

@ -1,4 +1,4 @@
#[derive(Default)]
#[derive(Clone, Default, PartialEq)]
pub enum Model {
#[default]
Unknown = 0x00,
@ -21,7 +21,7 @@ pub enum Model {
MiniExtremeISO = 0x11,
}
#[derive(Debug, Default)]
#[derive(Debug, Default, Clone, PartialEq)]
pub enum ProtocolVersion {
#[default]
Unknown = 0,
@ -48,6 +48,7 @@ impl TryFrom<u32> for ProtocolVersion {
}
}
#[derive(Clone, PartialEq)]
pub enum TransitionStyle {
MIX = 0x00,
DIP = 0x01,
@ -56,6 +57,7 @@ pub enum TransitionStyle {
STING = 0x04,
}
#[derive(Clone, PartialEq)]
pub enum TransitionSelection {
Background = 1 << 0,
Key1 = 1 << 1,
@ -64,6 +66,7 @@ pub enum TransitionSelection {
Key4 = 1 << 4,
}
#[derive(Clone, PartialEq)]
pub enum DVEEffect {
SwooshTopLeft = 0,
SwooshTop = 1,
@ -106,6 +109,7 @@ pub enum DVEEffect {
GraphicLogoWipe = 34,
}
#[derive(Clone, PartialEq)]
pub enum MacroAction {
Run = 0,
Stop = 1,
@ -115,6 +119,7 @@ pub enum MacroAction {
Delete = 5,
}
#[derive(Clone, PartialEq)]
pub enum ExternalPortType {
Unknown = 0,
SDI = 1,
@ -131,6 +136,7 @@ pub enum ExternalPortType {
TRSJack = 2048,
}
#[derive(Clone, PartialEq)]
pub enum InternalPortType {
External = 0,
Black = 1,
@ -157,6 +163,8 @@ const SOURCE_AVAILABILITY_SUPERSOURCE_BOX: isize = 1 << 3;
const SOURCE_AVAILABILITY_KEY_SOURCE: isize = 1 << 4;
const SOURCE_AVAILABILITY_AUXILIARY_1: isize = 1 << 5;
const SOURCE_AVAILABILITY_AUXILIARY_2: isize = 1 << 6;
#[derive(Clone, PartialEq)]
pub enum SourceAvailability {
None = SOURCE_AVAILABILITY_NONE,
Auxiliary = SOURCE_AVAILABILITY_AUXILIARY,
@ -180,6 +188,8 @@ const ME_AVAILABILITY_ME_1: isize = 1 << 0;
const ME_AVAILABILITY_ME_2: isize = 1 << 1;
const ME_AVAILABILITY_ME_3: isize = 1 << 2;
const ME_AVAILABILITY_ME_4: isize = 1 << 3;
#[derive(Clone, PartialEq)]
pub enum MeAvailability {
None = ME_AVAILABILITY_NONE,
Me1 = ME_AVAILABILITY_ME_1,
@ -189,6 +199,7 @@ pub enum MeAvailability {
All = ME_AVAILABILITY_ME_1 | ME_AVAILABILITY_ME_2 | ME_AVAILABILITY_ME_3 | ME_AVAILABILITY_ME_4,
}
#[derive(Clone, PartialEq)]
pub enum BorderBevel {
None = 0,
InOut = 1,
@ -196,6 +207,7 @@ pub enum BorderBevel {
Out = 3,
}
#[derive(Clone, PartialEq)]
pub enum IsAtKeyFrame {
None = 0,
A = 1 << 0,
@ -203,6 +215,7 @@ pub enum IsAtKeyFrame {
RunToInfinite = 1 << 2,
}
#[derive(Clone, PartialEq)]
pub enum Pattern {
LeftToRightBar = 0,
TopToBottomBar = 1,
@ -224,7 +237,7 @@ pub enum Pattern {
TopRightDiagonal = 17,
}
#[derive(Clone, Copy)]
#[derive(Clone, Copy, PartialEq)]
pub enum MixEffectKeyType {
Luma = 0,
Chroma = 1,
@ -232,6 +245,7 @@ pub enum MixEffectKeyType {
DVE = 3,
}
#[derive(Clone, PartialEq)]
pub enum FlyKeyKeyFrame {
None = 0,
A = 1,
@ -240,6 +254,7 @@ pub enum FlyKeyKeyFrame {
RunToInfinite = 4,
}
#[derive(Clone, PartialEq)]
pub enum FlyKeyDirection {
CentreOfKey = 0,
TopLeft = 1,
@ -253,11 +268,13 @@ pub enum FlyKeyDirection {
BottomRight = 9,
}
#[derive(Clone, PartialEq)]
pub enum SuperSourceArtOption {
Background,
Foreground,
}
#[derive(Clone, PartialEq)]
pub enum TransferMode {
NoOp,
Write,
@ -265,7 +282,7 @@ pub enum TransferMode {
WriteAudio = 256,
}
#[derive(Default)]
#[derive(Clone, Default, PartialEq)]
pub enum VideoMode {
#[default]
N525i5994NTSC = 0,
@ -303,6 +320,7 @@ pub enum VideoMode {
N1080p60 = 27,
}
#[derive(Clone, PartialEq)]
pub enum TransferState {
Queued,
Locked,
@ -310,29 +328,34 @@ pub enum TransferState {
Finished,
}
#[derive(Clone, PartialEq)]
pub enum MediaSourceType {
Still = 1,
Clip,
}
#[derive(Clone, PartialEq)]
pub enum AudioMixOption {
Off = 0,
On = 1,
AudioFollowVideo = 2,
}
#[derive(Clone, PartialEq)]
pub enum AudioSourceType {
ExternalVideo,
MediaPlayer,
ExternalAudio,
}
#[derive(Clone, PartialEq)]
pub enum StreamingError {
None,
InvalidState = 1 << 4,
Unknown = 1 << 15,
}
#[derive(Clone, PartialEq)]
pub enum StreamingStatus {
Idle = 1 << 0,
Connecting = 1 << 1,
@ -340,6 +363,7 @@ pub enum StreamingStatus {
Stopping = 1 << 5, // + Streaming
}
#[derive(Clone, PartialEq)]
pub enum RecordingError {
None = 1 << 1,
NoMedia = 0,
@ -350,12 +374,14 @@ pub enum RecordingError {
Unknown = 1 << 15,
}
#[derive(Clone, PartialEq)]
pub enum RecordingStatus {
Idle = 0,
Recording = 1 << 0,
Stopping = 1 << 7,
}
#[derive(Clone, PartialEq)]
pub enum RecordingDiskStatus {
Idle = 1 << 0,
Unformatted = 1 << 1,
@ -365,18 +391,21 @@ pub enum RecordingDiskStatus {
Removed = 1 << 5,
}
#[derive(Clone, PartialEq)]
pub enum FairlightAudioMixOption {
Off = 1,
On = 2,
AudioFollowVideo = 4,
}
#[derive(Clone, PartialEq)]
pub enum FairlightInputConfiguration {
Mono = 1,
Stereo = 2,
DualMono = 4,
}
#[derive(Clone, PartialEq)]
pub enum FairlightAnalogInputLevel {
Microphone = 1,
ConsumerLine = 2,
@ -384,11 +413,13 @@ pub enum FairlightAnalogInputLevel {
ProLine = 4,
}
#[derive(Clone, PartialEq)]
pub enum FairlightAudioSourceType {
Mono = 0,
Stereo = 1,
}
#[derive(Clone, PartialEq)]
pub enum FairlightInputType {
EmbeddedWithVideo = 0,
MediaPlayer = 1,
@ -401,6 +432,8 @@ const MULTI_VIEWER_LAYOUT_TOP_LEFT_SMALL: isize = 1;
const MULTI_VIEWER_LAYOUT_TOP_RIGHT_SMALL: isize = 2;
const MULTI_VIEWER_LAYOUT_BOTTOM_LEFT_SMALL: isize = 4;
const MULTI_VIEWER_LAYOUT_BOTTOM_RIGHT_SMALL: isize = 8;
#[derive(Clone, PartialEq)]
pub enum MultiViewerLayout {
Default = MULTI_VIEWER_LAYOUT_DEFAULT,
TopLeftSmall = MULTI_VIEWER_LAYOUT_TOP_LEFT_SMALL,

View File

@ -1,4 +1,4 @@
#[derive(Getters, new, Default)]
#[derive(Clone, PartialEq, Getters, new, Default)]
pub struct MacroPlayerState {
pub is_running: bool,
pub is_waiting: bool,
@ -6,13 +6,13 @@ pub struct MacroPlayerState {
pub macro_index: u64,
}
#[derive(Getters, new, Default)]
#[derive(Clone, PartialEq, Getters, new, Default)]
pub struct MacroRecorderState {
pub is_recording: bool,
pub macro_index: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MacroPropertiesState {
is_used: bool,
has_unsupported_ops: bool,
@ -20,7 +20,7 @@ pub struct MacroPropertiesState {
pub description: String,
}
#[derive(Getters, new, Default)]
#[derive(Clone, PartialEq, Getters, new, Default)]
pub struct MacroState {
pub macro_player: MacroPlayerState,
pub macro_recorder: MacroRecorderState,

View File

@ -6,7 +6,7 @@ pub type AudioChannel = ClassicAudioChannel;
pub type AudioMasterChannel = ClassicAudioMasterChannel;
pub type AtemAudioState = AtemClassicAudioState;
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct ClassicAudioChannel {
source_type: AudioSourceType,
pub port_type: ExternalPortType,
@ -18,14 +18,14 @@ pub struct ClassicAudioChannel {
pub rca_to_xlr_enabled: bool,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct ClassicAudioMasterChannel {
pub gain: f64,
pub balance: f64,
pub follow_fade_to_black: bool,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct ClassicAudioMonitorChannel {
pub enabled: bool,
pub gain: f64,
@ -36,7 +36,7 @@ pub struct ClassicAudioMonitorChannel {
pub dim_level: f64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct ClassicAudioHeadphoneOutputChannel {
pub gain: f64,
pub program_out_gain: f64,
@ -44,11 +44,11 @@ pub struct ClassicAudioHeadphoneOutputChannel {
pub talkback_gain: f64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct AtemClassicAudioState {
number_of_channels: Option<f64>,
has_monitor: Option<bool>,
pub channels: HashMap<f64, ClassicAudioChannel>,
pub channels: HashMap<u64, ClassicAudioChannel>,
pub monitor: Option<ClassicAudioMonitorChannel>,
pub headphones: Option<ClassicAudioHeadphoneOutputChannel>,
pub master: Option<ClassicAudioMasterChannel>,

View File

@ -1,4 +1,4 @@
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct ColorGeneratorState {
pub hue: u64,
pub saturation: u64,

View File

@ -1,4 +1,4 @@
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct Timecode {
pub hours: u64,
pub minutes: u64,

View File

@ -5,7 +5,7 @@ use crate::enums::{
FairlightInputConfiguration, FairlightInputType,
};
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioDynamicsState {
pub make_up_gain: Option<u64>,
@ -14,7 +14,7 @@ pub struct FairlightAudioDynamicsState {
pub expander: Option<FairlightAudioExpanderState>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioLimiterState {
pub limiter_enabled: bool,
pub threshold: u64,
@ -23,7 +23,7 @@ pub struct FairlightAudioLimiterState {
pub release: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioCompressorState {
pub compressor_enabled: bool,
pub threshold: u64,
@ -33,7 +33,7 @@ pub struct FairlightAudioCompressorState {
pub release: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioExpanderState {
pub expander_enabled: bool,
pub gate_enabled: bool,
@ -45,7 +45,7 @@ pub struct FairlightAudioExpanderState {
pub release: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioEqualizerBandState {
pub band_enabled: bool,
@ -61,14 +61,14 @@ pub struct FairlightAudioEqualizerBandState {
pub q_factor: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioMasterChannelPropertiesState {
// Gain in decibel, -Infinity to +6dB
pub fader_gain: u64,
pub follow_fade_to_black: bool,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioMasterChannel {
pub properties: Option<FairlightAudioSourcePropertiesState>,
@ -76,7 +76,7 @@ pub struct FairlightAudioMasterChannel {
pub dynamicss: Option<FairlightAudioDynamicsState>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioMonitorChannel {
pub gain: u64,
pub input_master_gain: u64,
@ -84,21 +84,21 @@ pub struct FairlightAudioMonitorChannel {
pub input_sidetone_gain: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioSource {
pub properties: Option<FairlightAudioSourcePropertiesState>,
pub equalizer: Option<FairlightAudioEqualizerState>,
pub dynamics: Option<FairlightAudioDynamicsState>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioEqualizerState {
pub enabled: bool,
pub gain: u64,
bands: Vec<FairlightAudioEqualizerBandState>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioSourcePropertiesState {
source_type: FairlightAudioSourceType,
@ -116,13 +116,13 @@ pub struct FairlightAudioSourcePropertiesState {
pub mix_option: FairlightAudioMixOption,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioInput {
pub properties: Option<FairlightAudioInputProperties>,
pub sources: HashMap<String, FairlightAudioSource>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioInputProperties {
input_type: FairlightInputType,
external_port_type: ExternalPortType,
@ -134,7 +134,7 @@ pub struct FairlightAudioInputProperties {
pub active_input_level: FairlightAnalogInputLevel,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct AtemFairlightAudioState {
pub inputs: HashMap<u64, FairlightAudioInput>,
pub master: Option<FairlightAudioMasterChannel>,

View File

@ -1,6 +1,6 @@
use crate::enums::{Model, ProtocolVersion};
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct AtemCapabilites {
mix_effects: u64,
sources: u64,
@ -19,47 +19,47 @@ pub struct AtemCapabilites {
only_configurable_outputs: bool,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MixEffectInfo {
key_count: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct SuperSourceInfo {
box_count: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct AudioMixerInfo {
inputs: u64,
monitors: u64,
headphones: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FairlightAudioMixerInfo {
inputs: u64,
monitors: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MacroPoolInfo {
macro_count: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MediaPoolInfo {
still_count: u64,
clip_count: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MultiviewerInfo {
count: u64,
window_count: u64,
}
#[derive(new)]
#[derive(Clone, PartialEq, new)]
pub struct TimeInfo {
pub hour: u64,
pub minute: u64,
@ -68,7 +68,7 @@ pub struct TimeInfo {
pub drop_frame: bool,
}
#[derive(new, Default)]
#[derive(Clone, PartialEq, Getters, new, Default)]
pub struct DeviceInfo {
pub api_version: ProtocolVersion,
pub capabilities: Option<AtemCapabilites>,

View File

@ -1,6 +1,6 @@
use crate::enums::{ExternalPortType, InternalPortType, MeAvailability, SourceAvailability};
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct InputChannel {
input_id: u64,
pub long_name: String,

View File

@ -1,6 +1,6 @@
use crate::enums;
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MediaPlayer {
pub playing: bool,
pub is_loop: bool,
@ -8,7 +8,7 @@ pub struct MediaPlayer {
pub clip_frame: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MediaPlayerSource {
pub source_type: enums::MediaSourceType,
pub clip_index: u64,
@ -17,21 +17,21 @@ pub struct MediaPlayerSource {
pub type MediaPlayerState = (MediaPlayer, MediaPlayerSource);
#[derive(Getters, new, Default)]
#[derive(Clone, PartialEq, Getters, new, Default)]
pub struct MediaState {
still_pool: Vec<StillFrame>,
clip_pool: Vec<ClipBank>,
players: Vec<MediaPlayerState>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct StillFrame {
pub is_used: bool,
pub hash: String,
pub file_name: String,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct ClipBank {
pub is_used: bool,
pub name: String,

View File

@ -14,7 +14,7 @@ pub mod streaming;
pub mod util;
pub mod video;
#[derive(Default)]
#[derive(Default, Clone, PartialEq)]
pub struct AtemState {
info: info::DeviceInfo,
video: video::AtemVideoState,

View File

@ -4,7 +4,7 @@ use crate::enums::{RecordingDiskStatus, RecordingError, RecordingStatus};
use super::common::Timecode;
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct RecordingState {
pub status: Option<RecordingStateStatus>,
pub properties: RecordingStateProperties,
@ -14,7 +14,7 @@ pub struct RecordingState {
pub disks: HashMap<u64, RecordingDiskProperties>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct RecordingDiskProperties {
pub disk_id: u64,
pub volume_name: String,
@ -22,7 +22,7 @@ pub struct RecordingDiskProperties {
pub status: RecordingDiskStatus,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct RecordingStateStatus {
pub state: RecordingStatus,
pub error: RecordingError,
@ -30,7 +30,7 @@ pub struct RecordingStateStatus {
pub recording_time_available: u64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct RecordingStateProperties {
pub filename: String,

View File

@ -9,7 +9,7 @@ pub trait MultiViewerSourceState {
fn get_supports_safe_area(&self) -> bool;
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MultiViewerWindowState {
pub safe_title: Option<bool>,
pub audio_meter: Option<bool>,
@ -40,13 +40,13 @@ impl MultiViewerSourceState for MultiViewerWindowState {
}
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MultiViewerPropertiesState {
pub layout: MultiViewerLayout,
pub program_preview_swapped: bool,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MultiViewer {
index: u64,
windows: Vec<MultiViewerWindowState>,
@ -54,7 +54,7 @@ pub struct MultiViewer {
pub vu_opacity: Option<u64>,
}
#[derive(Getters, new, Default)]
#[derive(Clone, PartialEq, Getters, new, Default)]
pub struct SettingsState {
multi_viewers: Vec<MultiViewer>,
pub video_mode: VideoMode,

View File

@ -2,7 +2,7 @@ use crate::enums::{StreamingError, StreamingStatus};
use super::common::Timecode;
#[derive(Getters)]
#[derive(Clone, PartialEq, Getters)]
pub struct StreamingState {
pub status: Option<StreamingStateStatus>,
pub stats: Option<StreamingStateStats>,
@ -11,18 +11,19 @@ pub struct StreamingState {
pub duration: Option<Timecode>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct StreamingStateStatus {
state: StreamingStatus,
error: StreamingError,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct StreamingStateStats {
cache_used: u64,
encoding_bitrate: u64,
}
#[derive(Clone, PartialEq)]
pub struct StreamingServiceProperties {
pub service_name: String,
pub url: String,

View File

@ -9,7 +9,7 @@ pub trait DownstreamKeyerBase {
fn set_is_towards_on_air(&mut self, on_air: Option<bool>);
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct DownstreamKeyer {
pub sources: Option<DownstreamKeyerSources>,
pub properties: Option<DownstreamKeyerProperties>,
@ -57,7 +57,7 @@ pub trait DownstreamKeyerGeneral {
fn set_invert(&mut self, invert: bool);
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct DownstreamKeyerMask {
pub enabled: bool,
pub top: f64,
@ -66,7 +66,7 @@ pub struct DownstreamKeyerMask {
pub right: f64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct DownstreamKeyerProperties {
pub tie: bool,
pub rate: f64,
@ -104,7 +104,7 @@ impl DownstreamKeyerGeneral for DownstreamKeyerProperties {
}
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct DownstreamKeyerSources {
pub fill_source: f64,
pub cut_source: f64,

View File

@ -4,13 +4,13 @@ mod downstream_keyers;
mod super_source;
mod upstream_keyers;
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct DipTransitionSettings {
pub rate: f64,
pub input: f64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct DVETransitionSettings {
pub rate: f64,
pub logo_rate: f64,
@ -27,12 +27,12 @@ pub struct DVETransitionSettings {
pub flip_flop: bool,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MixTransitionSettings {
pub rate: f64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct StingerTransitionSettings {
pub source: f64,
pub pre_multiplied_key: bool,
@ -47,7 +47,7 @@ pub struct StingerTransitionSettings {
pub mix_rate: f64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct WipeTransitionSettings {
pub rate: f64,
pub pattern: f64,
@ -61,7 +61,7 @@ pub struct WipeTransitionSettings {
pub flip_flop: bool,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct TransitionProperties {
style: enums::TransitionStyle,
selection: Vec<enums::TransitionSelection>,
@ -69,7 +69,7 @@ pub struct TransitionProperties {
pub next_selection: Vec<enums::TransitionSelection>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct TransitionSettings {
pub dip: Option<DipTransitionSettings>,
pub dve: Option<DVETransitionSettings>,
@ -78,14 +78,14 @@ pub struct TransitionSettings {
pub wipe: Option<WipeTransitionSettings>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct TransitionPosition {
in_transition: bool,
remaining_frames: f64,
pub handle_position: f64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct MixEffect {
index: f64,
pub program_input: f64,
@ -98,7 +98,7 @@ pub struct MixEffect {
upstream_keyers: Vec<upstream_keyers::UpstreamKeyer>,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct FadeToBlackProperties {
is_fully_black: bool,
in_transition: bool,
@ -106,7 +106,7 @@ pub struct FadeToBlackProperties {
pub rate: f64,
}
#[derive(Getters, new, Default)]
#[derive(Clone, PartialEq, Getters, new, Default)]
pub struct AtemVideoState {
mix_effects: Vec<MixEffect>,
downstream_keyers: Vec<downstream_keyers::DownstreamKeyer>,

View File

@ -1,6 +1,6 @@
use crate::enums;
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct SuperSourceBox {
pub enabled: bool,
pub source: f64,
@ -14,7 +14,7 @@ pub struct SuperSourceBox {
pub crop_right: f64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct SuperSourceProperties {
pub art_fill_source: f64,
pub art_cut_source: f64,
@ -25,7 +25,7 @@ pub struct SuperSourceProperties {
pub art_invert_key: bool,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct SuperSourceBorder {
pub border_enabled: bool,
pub border_bevel: enums::BorderBevel,
@ -42,7 +42,7 @@ pub struct SuperSourceBorder {
pub border_light_source_altitude: f64,
}
#[derive(Getters, new)]
#[derive(Clone, PartialEq, Getters, new)]
pub struct SuperSource {
index: f64,
boxes: [Option<SuperSourceBox>; 4],

View File

@ -16,57 +16,7 @@ pub trait UpstreamKeyerTypeSettings {
fn set_fly_enabled(&mut self, enabled: bool);
}
pub trait UpstreamKeyerMaskSettings: Send {
fn get_mask_enabled(&self) -> bool;
fn set_mask_enabled(&mut self, enabled: bool);
fn get_mask_top(&self) -> f64;
fn set_mask_top(&mut self, mask: f64);
fn get_mask_bottom(&self) -> f64;
fn set_mask_bottom(&mut self, mask: f64);
fn get_mask_left(&self) -> f64;
fn set_mask_right(&mut self, mask: f64);
}
pub trait UpstreamKeyerDVEBase: UpstreamKeyerMaskSettings {
fn get_size_x(&self) -> f64;
fn set_size_x(&mut self, size_x: f64);
fn get_size_y(&self) -> f64;
fn set_size_y(&mut self, size_y: f64);
fn get_position_x(&self) -> f64;
fn set_position_x(&mut self, position_x: f64);
fn get_position_y(&self) -> f64;
fn set_position_y(&mut self, position_y: f64);
fn get_rotation(&self) -> f64;
fn set_rotation(&mut self, rotation: f64);
fn get_border_outer_width(&self) -> f64;
fn set_border_outer_width(&mut self, width: f64);
fn get_border_inner_width(&self) -> f64;
fn set_border_inner_width(&mut self, width: f64);
fn get_border_outer_softness(&self) -> f64;
fn set_border_outer_softness(&mut self, softness: f64);
fn get_border_inner_softness(&self) -> f64;
fn set_border_inner_softness(&mut self, softness: f64);
fn get_border_bevel_softness(&self) -> f64;
fn set_border_bevel_softness(&mut self, softness: f64);
fn get_border_bevel_position(&self) -> f64;
fn set_border_bevel_position(&mut self, position: f64);
fn get_border_opacity(&self) -> f64;
fn set_border_opacity(&mut self, opacity: f64);
fn get_border_hue(&self) -> f64;
fn set_border_hue(&mut self, hue: f64);
fn get_border_saturation(&self) -> f64;
fn set_border_saturation(&mut self, saturation: f64);
fn get_border_luma(&self) -> f64;
fn set_border_luma(&mut self, luma: f64);
fn get_light_source_direction(&self) -> f64;
fn set_light_source_direction(&mut self, direction: f64);
fn get_light_source_altitude(&self) -> f64;
fn set_light_source_altitude(&mut self, altitude: f64);
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyerDVESettings {
pub border_enabled: bool,
pub shadow_enabled: bool,
@ -101,178 +51,7 @@ pub struct UpstreamKeyerDVESettings {
pub light_source_altitude: f64,
}
impl UpstreamKeyerMaskSettings for UpstreamKeyerDVESettings {
fn get_mask_enabled(&self) -> bool {
self.mask_enabled
}
fn set_mask_enabled(&mut self, enabled: bool) {
self.mask_enabled = enabled
}
fn get_mask_top(&self) -> f64 {
self.mask_top
}
fn set_mask_top(&mut self, mask: f64) {
self.mask_top = mask
}
fn get_mask_bottom(&self) -> f64 {
self.mask_bottom
}
fn set_mask_bottom(&mut self, mask: f64) {
self.mask_bottom = mask
}
fn get_mask_left(&self) -> f64 {
self.mask_left
}
fn set_mask_right(&mut self, mask: f64) {
self.mask_left = mask
}
}
impl UpstreamKeyerDVEBase for UpstreamKeyerDVESettings {
fn get_size_x(&self) -> f64 {
self.size_x
}
fn set_size_x(&mut self, size_x: f64) {
self.size_x = size_x
}
fn get_size_y(&self) -> f64 {
self.size_y
}
fn set_size_y(&mut self, size_y: f64) {
self.size_y = size_y
}
fn get_position_x(&self) -> f64 {
self.position_x
}
fn set_position_x(&mut self, position_x: f64) {
self.position_x = position_x
}
fn get_position_y(&self) -> f64 {
self.position_y
}
fn set_position_y(&mut self, position_y: f64) {
self.position_y = position_y
}
fn get_rotation(&self) -> f64 {
self.rotation
}
fn set_rotation(&mut self, rotation: f64) {
self.rotation = rotation
}
fn get_border_outer_width(&self) -> f64 {
self.border_outer_width
}
fn set_border_outer_width(&mut self, width: f64) {
self.border_outer_width = width
}
fn get_border_inner_width(&self) -> f64 {
self.border_inner_width
}
fn set_border_inner_width(&mut self, width: f64) {
self.border_inner_width = width
}
fn get_border_outer_softness(&self) -> f64 {
self.border_outer_softness
}
fn set_border_outer_softness(&mut self, softness: f64) {
self.border_outer_softness = softness
}
fn get_border_inner_softness(&self) -> f64 {
self.border_inner_softness
}
fn set_border_inner_softness(&mut self, softness: f64) {
self.border_inner_softness = softness
}
fn get_border_bevel_softness(&self) -> f64 {
self.border_bevel_softness
}
fn set_border_bevel_softness(&mut self, softness: f64) {
self.border_bevel_softness = softness
}
fn get_border_bevel_position(&self) -> f64 {
self.border_bevel_position
}
fn set_border_bevel_position(&mut self, position: f64) {
self.border_bevel_position = position
}
fn get_border_opacity(&self) -> f64 {
self.border_opacity
}
fn set_border_opacity(&mut self, opacity: f64) {
self.border_opacity = opacity
}
fn get_border_hue(&self) -> f64 {
self.border_hue
}
fn set_border_hue(&mut self, hue: f64) {
self.border_hue = hue
}
fn get_border_saturation(&self) -> f64 {
self.border_saturation
}
fn set_border_saturation(&mut self, saturation: f64) {
self.border_saturation = saturation
}
fn get_border_luma(&self) -> f64 {
self.border_luma
}
fn set_border_luma(&mut self, luma: f64) {
self.border_luma = luma
}
fn get_light_source_direction(&self) -> f64 {
self.light_source_direction
}
fn set_light_source_direction(&mut self, direction: f64) {
self.light_source_direction = direction
}
fn get_light_source_altitude(&self) -> f64 {
self.light_source_altitude
}
fn set_light_source_altitude(&mut self, altitude: f64) {
self.light_source_altitude = altitude
}
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyerFlyKeyFrame {
key_frame_id: f64,
@ -304,178 +83,13 @@ pub struct UpstreamKeyerFlyKeyFrame {
pub light_source_altitude: f64,
}
impl UpstreamKeyerMaskSettings for UpstreamKeyerFlyKeyFrame {
fn get_mask_enabled(&self) -> bool {
self.mask_enabled
}
fn set_mask_enabled(&mut self, enabled: bool) {
self.mask_enabled = enabled
}
fn get_mask_top(&self) -> f64 {
self.mask_top
}
fn set_mask_top(&mut self, mask: f64) {
self.mask_top = mask
}
fn get_mask_bottom(&self) -> f64 {
self.mask_bottom
}
fn set_mask_bottom(&mut self, mask: f64) {
self.mask_bottom = mask
}
fn get_mask_left(&self) -> f64 {
self.mask_left
}
fn set_mask_right(&mut self, mask: f64) {
self.mask_left = mask
}
}
impl UpstreamKeyerDVEBase for UpstreamKeyerFlyKeyFrame {
fn get_size_x(&self) -> f64 {
self.size_x
}
fn set_size_x(&mut self, size_x: f64) {
self.size_x = size_x
}
fn get_size_y(&self) -> f64 {
self.size_y
}
fn set_size_y(&mut self, size_y: f64) {
self.size_y = size_y
}
fn get_position_x(&self) -> f64 {
self.position_x
}
fn set_position_x(&mut self, position_x: f64) {
self.position_x = position_x
}
fn get_position_y(&self) -> f64 {
self.position_y
}
fn set_position_y(&mut self, position_y: f64) {
self.position_y = position_y
}
fn get_rotation(&self) -> f64 {
self.rotation
}
fn set_rotation(&mut self, rotation: f64) {
self.rotation = rotation
}
fn get_border_outer_width(&self) -> f64 {
self.border_outer_width
}
fn set_border_outer_width(&mut self, width: f64) {
self.border_outer_width = width
}
fn get_border_inner_width(&self) -> f64 {
self.border_inner_width
}
fn set_border_inner_width(&mut self, width: f64) {
self.border_inner_width = width
}
fn get_border_outer_softness(&self) -> f64 {
self.border_outer_softness
}
fn set_border_outer_softness(&mut self, softness: f64) {
self.border_outer_softness = softness
}
fn get_border_inner_softness(&self) -> f64 {
self.border_inner_softness
}
fn set_border_inner_softness(&mut self, softness: f64) {
self.border_inner_softness = softness
}
fn get_border_bevel_softness(&self) -> f64 {
self.border_bevel_softness
}
fn set_border_bevel_softness(&mut self, softness: f64) {
self.border_bevel_softness = softness
}
fn get_border_bevel_position(&self) -> f64 {
self.border_bevel_position
}
fn set_border_bevel_position(&mut self, position: f64) {
self.border_bevel_position = position
}
fn get_border_opacity(&self) -> f64 {
self.border_opacity
}
fn set_border_opacity(&mut self, opacity: f64) {
self.border_opacity = opacity
}
fn get_border_hue(&self) -> f64 {
self.border_hue
}
fn set_border_hue(&mut self, hue: f64) {
self.border_hue = hue
}
fn get_border_saturation(&self) -> f64 {
self.border_saturation
}
fn set_border_saturation(&mut self, saturation: f64) {
self.border_saturation = saturation
}
fn get_border_luma(&self) -> f64 {
self.border_luma
}
fn set_border_luma(&mut self, luma: f64) {
self.border_luma = luma
}
fn get_light_source_direction(&self) -> f64 {
self.light_source_direction
}
fn set_light_source_direction(&mut self, direction: f64) {
self.light_source_direction = direction
}
fn get_light_source_altitude(&self) -> f64 {
self.light_source_altitude
}
fn set_light_source_altitude(&mut self, altitude: f64) {
self.light_source_altitude = altitude
}
#[derive(Clone, PartialEq)]
enum UpstreamKeyerMaskSettings {
DVE(UpstreamKeyerDVESettings),
FlyKeyFrame(UpstreamKeyerFlyKeyFrame),
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyerChromaSettings {
pub hue: f64,
pub gain: f64,
@ -484,11 +98,13 @@ pub struct UpstreamKeyerChromaSettings {
pub narrow: bool,
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyerAdvancedChromaSettings {
pub properties: Option<UpstreamKeyerAdvancedChromaProperties>,
pub sample: Option<UpstreamKeyerAdvancedChromaSample>,
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyerAdvancedChromaProperties {
pub foreground_level: f64,
pub background_level: f64,
@ -505,6 +121,7 @@ pub struct UpstreamKeyerAdvancedChromaProperties {
pub blue: f64,
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyerAdvancedChromaSample {
pub enable_cursor: bool,
pub preview: bool,
@ -516,6 +133,7 @@ pub struct UpstreamKeyerAdvancedChromaSample {
pub sampled_cr: f64,
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyerLumaSettings {
pub pre_multiplied: bool,
pub clip: f64,
@ -523,6 +141,7 @@ pub struct UpstreamKeyerLumaSettings {
pub invert: bool,
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyerPatternSettings {
pub style: enums::Pattern,
pub size: f64,
@ -533,6 +152,7 @@ pub struct UpstreamKeyerPatternSettings {
pub invert: bool,
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyerFlySettings {
is_a_set: bool,
is_b_set: bool,
@ -540,6 +160,7 @@ pub struct UpstreamKeyerFlySettings {
run_to_infinite_index: f64,
}
#[derive(Clone, PartialEq)]
pub struct UpstreamKeyer {
pub mix_effect_key_type: enums::MixEffectKeyType,
pub fly_enabled: bool,
@ -556,7 +177,7 @@ pub struct UpstreamKeyer {
pub pattern_settings: Option<UpstreamKeyerPatternSettings>,
pub fly_keyframes: [Option<UpstreamKeyerFlyKeyFrame>; 2],
pub fly_properties: Option<UpstreamKeyerFlySettings>,
pub mask_settings: Box<dyn UpstreamKeyerMaskSettings>,
pub mask_settings: UpstreamKeyerMaskSettings,
pub on_air: bool,
pub mask_enabled: bool,