use std::path::Path;
use rgb::RGBA8;
use serde::Serialize;
pub const TYPE_SWIPE: &str = "swipe_transition";
pub const TYPE_SLIDE: &str = "slide_transition";
pub const TYPE_STINGER: &str = "obs_stinger_transition";
pub const TYPE_FADE_TO_COLOR: &str = "fade_to_color_transition";
pub const TYPE_WIPE: &str = "wipe_transition";
#[derive(Debug, Default, Serialize)]
#[cfg_attr(feature = "builder", derive(bon::Builder))]
pub struct Swipe {
pub direction: Direction,
pub swipe_in: bool,
}
#[derive(Debug, Default, Serialize)]
#[cfg_attr(feature = "builder", derive(bon::Builder))]
pub struct Slide {
pub direction: Direction,
}
#[derive(Clone, Copy, Debug, Default, Serialize)]
#[serde(rename_all = "lowercase")]
#[non_exhaustive]
pub enum Direction {
#[default]
Left,
Right,
Up,
Down,
}
#[derive(Serialize)]
#[cfg_attr(feature = "builder", derive(bon::Builder))]
pub struct Stinger<'a> {
pub path: &'a Path,
pub tp_type: TransitionPointType,
pub transition_point: u32,
pub audio_monitoring: AudioMonitoring,
pub audio_fade_style: AudioFadeStyle,
}
#[derive(Clone, Copy, Debug, Default, Serialize)]
#[serde(into = "u8")]
#[repr(u8)]
#[non_exhaustive]
pub enum TransitionPointType {
#[default]
Time = 0,
Frame = 1,
}
impl From<TransitionPointType> for u8 {
fn from(value: TransitionPointType) -> Self {
value as Self
}
}
#[derive(Clone, Copy, Debug, Default, Serialize)]
#[serde(into = "u8")]
#[repr(u8)]
#[non_exhaustive]
pub enum AudioMonitoring {
#[default]
MonitorOff = 0,
MonitorOnly = 1,
MonitorAndOutput = 2,
}
impl From<AudioMonitoring> for u8 {
fn from(value: AudioMonitoring) -> Self {
value as Self
}
}
#[derive(Clone, Copy, Debug, Default, Serialize)]
#[serde(into = "u8")]
#[repr(u8)]
#[non_exhaustive]
pub enum AudioFadeStyle {
#[default]
FadeOutFadeIn = 0,
Crossfade = 1,
}
impl From<AudioFadeStyle> for u8 {
fn from(value: AudioFadeStyle) -> Self {
value as Self
}
}
#[derive(Serialize)]
#[cfg_attr(feature = "builder", derive(bon::Builder))]
pub struct FadeToColor {
#[serde(with = "crate::serde::rgba8_inverse")]
pub color: RGBA8,
pub switch_point: u8,
}
#[derive(Serialize)]
#[cfg_attr(feature = "builder", derive(bon::Builder))]
pub struct Wipe {
pub luma_image: LumaImage,
pub luma_invert: bool,
pub luma_softness: f64,
}
#[derive(Default, Serialize)]
#[non_exhaustive]
pub enum LumaImage {
#[serde(rename = "barndoor-botleft.png")]
BarndoorBottomLeft,
#[serde(rename = "barndoor-h.png")]
BarndoorHorizontal,
#[serde(rename = "barndoor-topleft.png")]
BarndoorTopLeft,
#[serde(rename = "barndoor-v.png")]
BarndoorVertical,
#[serde(rename = "blinds-h.png")]
BlindsHorizontal,
#[serde(rename = "box-botleft.png")]
BoxBottomLeft,
#[serde(rename = "box-botright.png")]
BoxBottomRight,
#[serde(rename = "box-topleft.png")]
BoxTopLeft,
#[serde(rename = "box-topright.png")]
BoxTopRight,
#[serde(rename = "burst.png")]
Burst,
#[serde(rename = "checkerboard-small.png")]
CheckerboardSmall,
#[serde(rename = "circles.png")]
Circles,
#[serde(rename = "clock.png")]
Clock,
#[serde(rename = "cloud.png")]
Cloud,
#[serde(rename = "curtain.png")]
Curtain,
#[serde(rename = "fan.png")]
Fan,
#[serde(rename = "fractal.png")]
Fractal,
#[serde(rename = "iris.png")]
Iris,
#[default]
#[serde(rename = "linear-h.png")]
LinearHorizontal,
#[serde(rename = "linear-topleft.png")]
LinearTopLeft,
#[serde(rename = "linear-topright.png")]
LinearTopRight,
#[serde(rename = "linear-v.png")]
LinearVertical,
#[serde(rename = "parallel-zigzag-h.png")]
ParallelZigzagHorizontal,
#[serde(rename = "parallel-zigzag-v.png")]
ParallelZigzagVertical,
#[serde(rename = "sinus9.png")]
Sinus9,
#[serde(rename = "spiral.png")]
Spiral,
#[serde(rename = "square.png")]
Square,
#[serde(rename = "squares.png")]
Squares,
#[serde(rename = "stripes.png")]
Stripes,
#[serde(rename = "strips-h.png")]
StripsHorizontal,
#[serde(rename = "strips-v.png")]
StripsVertical,
#[serde(rename = "watercolor.png")]
Watercolor,
#[serde(rename = "zigzag-h.png")]
ZigzagHorizontal,
#[serde(rename = "zigzag-v.png")]
ZigzagVertical,
}