Distribute responses into separate modules

v5-api
Dominik Nakamura 2 years ago
parent 9ac385c646
commit 663fd66bb6
No known key found for this signature in database
GPG Key ID: E4C6A749B2491910

@ -3,7 +3,8 @@ use serde::{de::DeserializeOwned, Serialize};
use super::Client;
use crate::{
requests::config::{Realm, Request, SetPersistentData, SetVideoSettings},
responses, Error, Result,
responses::config as responses,
Error, Result,
};
/// API functions related to OBS configuration.

@ -6,7 +6,8 @@ use crate::{
Create, CreateInternal, Request, SetEnabled, SetIndex, SetName, SetSettings,
SetSettingsInternal,
},
responses, Error, Result,
responses::filters as responses,
Error, Result,
};
/// API functions related to filters.

@ -3,7 +3,8 @@ use serde::{de::DeserializeOwned, Serialize};
use super::Client;
use crate::{
requests::general::{CallVendorRequest, CallVendorRequestInternal, Request},
responses, Error, Result,
responses::general as responses,
Error, Result,
};
/// General functions of the API.

@ -1,7 +1,8 @@
use super::Client;
use crate::{
requests::hotkeys::{KeyModifiers, Request},
responses, Result,
responses::hotkeys as responses,
Result,
};
/// API functions related to hotkeys.
@ -18,7 +19,7 @@ impl<'a> Hotkeys<'a> {
.map(|h| h.hotkeys)
}
/// Triggers a hotkey using its name. See [`General::list_hotkeys`].
/// Triggers a hotkey using its name. See [`Self::list`].
pub async fn trigger_by_name(&self, name: &str) -> Result<()> {
self.client
.send_message(Request::TriggerByName { name })

@ -7,7 +7,8 @@ use crate::{
requests::inputs::{
Create, CreateInputInternal, Request, SetSettings, SetSettingsInternal, Volume,
},
responses, Error, Result,
responses::inputs as responses,
Error, Result,
};
/// API functions related to inputs.

@ -1,7 +1,10 @@
use time::Duration;
use super::Client;
use crate::{common::MediaAction, requests::media_inputs::Request, responses, Result};
use crate::{
common::MediaAction, requests::media_inputs::Request, responses::media_inputs as responses,
Result,
};
/// API functions related to media inputs.
pub struct MediaInputs<'a> {

@ -1,7 +1,8 @@
use super::Client;
use crate::{
requests::profiles::{Request, SetParameter},
responses, Result,
responses::profiles as responses,
Result,
};
/// API functions related to profiles.

@ -1,5 +1,5 @@
use super::Client;
use crate::{requests::recording::Request, responses, Result};
use crate::{requests::recording::Request, responses::recording as responses, Result};
/// API functions related to recording.
pub struct Recording<'a> {

@ -1,5 +1,5 @@
use super::Client;
use crate::{requests::replay_buffer::Request, responses, Result};
use crate::{requests::replay_buffer::Request, responses::replay_buffer as responses, Result};
/// API functions related to the replay buffer.
pub struct ReplayBuffer<'a> {

@ -1,5 +1,7 @@
use super::Client;
use crate::{requests::scene_collections::Request, responses, Result};
use crate::{
requests::scene_collections::Request, responses::scene_collections as responses, Result,
};
/// API functions related to scene collections.
pub struct SceneCollections<'a> {

@ -6,7 +6,8 @@ use crate::{
CreateSceneItem, Duplicate, Id, Request, SetEnabled, SetIndex, SetLocked,
SetPrivateSettings, SetPrivateSettingsInternal, SetTransform,
},
responses, Error, Result,
responses::scene_items as responses,
Error, Result,
};
/// API functions related to scene items.

@ -1,7 +1,8 @@
use super::Client;
use crate::{
requests::scenes::{Request, SetTransitionOverride},
responses, Result,
responses::scenes as responses,
Result,
};
/// API functions related to scenes.

@ -1,7 +1,8 @@
use super::Client;
use crate::{
requests::sources::{Request, SaveScreenshot, TakeScreenshot},
responses, Result,
responses::sources as responses,
Result,
};
/// API functions related to sources.

@ -1,5 +1,5 @@
use super::Client;
use crate::{requests::streaming::Request, responses, Result};
use crate::{requests::streaming::Request, responses::streaming as responses, Result};
/// API functions related to streaming.
pub struct Streaming<'a> {

@ -2,7 +2,7 @@ use serde::Serialize;
use time::Duration;
use super::Client;
use crate::{requests::transitions::Request, responses, Error, Result};
use crate::{requests::transitions::Request, responses::transitions as responses, Error, Result};
/// API functions related to transitions.
pub struct Transitions<'a> {

@ -1,5 +1,5 @@
use super::Client;
use crate::{requests::ui::Request, responses, Result};
use crate::{requests::ui::Request, responses::ui as responses, Result};
/// API functions related to the user interface.
pub struct Ui<'a> {

@ -1,5 +1,5 @@
use super::Client;
use crate::{requests::virtual_cam::Request, responses, Result};
use crate::{requests::virtual_cam::Request, responses::virtual_cam as responses, Result};
/// API functions related to the virtual camera.
pub struct VirtualCam<'a> {

@ -1,5 +1,4 @@
//! Common data structures shared between [`requests`](crate::requests),
//! [`responses`](crate::responses) and [`events`](crate::events).
//! Common data structures shared between requests, responses and events.
use bitflags::bitflags;
use serde::{Deserialize, Serialize};

@ -1,5 +1,4 @@
//! Custom deserializers that are used in both the [`events`](crate::events) and
//! [`responses`](crate::responses) modules.
//! Custom deserializers that are used in both the `events` and `responses` modules.
use std::{
convert::TryFrom,

@ -7,7 +7,7 @@ use time::Duration;
use crate::{
common::{MediaAction, MonitorType},
responses::{SceneItemTransform, SourceFilter},
responses::{filters::SourceFilter, scene_items::SceneItemTransform},
};
/// All possible event types that can occur while the user interacts with OBS.

@ -93,8 +93,8 @@ pub struct SetVideoSettings {
pub output_height: Option<u32>,
}
impl From<crate::responses::VideoSettings> for SetVideoSettings {
fn from(v: crate::responses::VideoSettings) -> Self {
impl From<crate::responses::config::VideoSettings> for SetVideoSettings {
fn from(v: crate::responses::config::VideoSettings) -> Self {
Self {
fps_numerator: Some(v.fps_numerator),
fps_denominator: Some(v.fps_denominator),

@ -32,7 +32,7 @@ impl<'a> From<Request<'a>> for super::RequestType<'a> {
}
/// Request information for
/// [`crate::client::General::trigger_hotkey_by_key_sequence`].
/// [`crate::client::Hotkeys::trigger_by_sequence`].
#[derive(Default, Serialize)]
pub struct KeyModifiers {
/// Press Shift.

@ -45,7 +45,7 @@ impl<'a> From<Request<'a>> for super::RequestType<'a> {
}
}
/// Request information for [`crate::client::Config::set_profile_parameter`].
/// Request information for [`crate::client::Profiles::set_parameter`].
#[skip_serializing_none]
#[derive(Default, Serialize)]
pub struct SetParameter<'a> {

@ -184,8 +184,8 @@ pub struct SceneItemTransform {
pub crop: Option<Crop>,
}
impl From<crate::responses::SceneItemTransform> for SceneItemTransform {
fn from(t: crate::responses::SceneItemTransform) -> Self {
impl From<crate::responses::scene_items::SceneItemTransform> for SceneItemTransform {
fn from(t: crate::responses::scene_items::SceneItemTransform) -> Self {
Self {
position: Some(Position {
x: Some(t.position_x),

@ -0,0 +1,40 @@
//! Responses related to the OBS configuration.
use serde::Deserialize;
/// Response value for [`crate::client::Config::video_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VideoSettings {
/// Numerator of the fractional FPS value.
pub fps_numerator: u32,
/// Denominator of the fractional FPS value.
pub fps_denominator: u32,
/// Width of the base (canvas) resolution in pixels.
pub base_width: u32,
/// Height of the base (canvas) resolution in pixels.
pub base_height: u32,
/// Width of the output resolution in pixels.
pub output_width: u32,
/// Height of the output resolution in pixels.
pub output_height: u32,
}
/// Response value for [`crate::client::Config::stream_service_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StreamServiceSettings<T> {
/// Stream service type, like `rtmp_custom` or `rtmp_common`.
#[serde(rename = "streamServiceType")]
pub r#type: String,
/// Stream service settings.
#[serde(rename = "streamServiceSettings")]
pub settings: T,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct RecordDirectory {
/// Output directory.
pub record_directory: String,
}

@ -0,0 +1,40 @@
//! Responses related to filters.
use serde::Deserialize;
/// Response value for [`crate::client::Filters::get_source_filter_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Filters {
/// Array of filters.
pub filters: Vec<SourceFilter>,
}
/// Response value for [`crate::client::Filters::list`] and [`crate::client::Filters::get`].
#[derive(Clone, Debug, Deserialize)]
pub struct SourceFilter {
/// Whether the filter is enabled.
#[serde(rename = "filterEnabled")]
pub enabled: bool,
/// Index of the filter in the list, beginning at 0.
#[serde(rename = "filterIndex")]
pub index: u32,
/// The kind of filter.
#[serde(rename = "filterKind")]
pub kind: String,
/// name of the filter.
#[serde(rename = "filterName", default)]
pub name: String,
/// Settings object associated with the filter.
#[serde(rename = "filterSettings")]
pub settings: serde_json::Value,
}
/// Response value for
/// [`crate::client::Filters::get_source_filter_default_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct DefaultFilterSettings<T> {
/// Object of default settings for the filter kind.
pub default_filter_settings: T,
}

@ -0,0 +1,60 @@
//! General responses, not fitting into any category.
use serde::Deserialize;
/// Response value for [`crate::client::General::version`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Version {
/// Current OBS Studio version.
pub obs_version: semver::Version,
/// Current obs-websocket version.
pub obs_web_socket_version: semver::Version,
/// Current latest obs-websocket RPC version.
pub rpc_version: u32,
/// Array of available RPC requests for the currently negotiated RPC version.
pub available_requests: Vec<String>,
/// Image formats available in `GetSourceScreenshot` and `SaveSourceScreenshot` requests.
pub supported_image_formats: Vec<String>,
/// Name of the platform. Usually `windows`, `macos`, or `ubuntu` (Linux flavor). Not guaranteed
/// to be any of those.
pub platform: String,
/// Description of the platform, like `Windows 10 (10.0)`.
pub platform_description: String,
}
/// Response value for [`crate::client::General::stats`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Stats {
/// Current CPU usage in percent.
pub cpu_usage: f64,
/// Amount of memory in MB currently being used by OBS.
pub memory_usage: f64,
/// Available disk space on the device being used for recording storage.
pub available_disk_space: f64,
/// Current FPS being rendered.
pub active_fps: f64,
/// Average time in milliseconds that OBS is taking to render a frame.
pub average_frame_render_time: f64,
/// Number of frames skipped by OBS in the render thread.
pub render_skipped_frames: u32,
/// Total number of frames outputted by the render thread.
pub render_total_frames: u32,
/// Number of frames skipped by OBS in the output thread.
pub output_skipped_frames: u32,
/// Total number of frames outputted by the output thread.
pub output_total_frames: u32,
/// Total number of messages received by obs-websocket from the client.
pub web_socket_session_incoming_messages: u64,
/// Total number of messages sent by obs-websocket to the client.
pub web_socket_session_outgoing_messages: u64,
}
/// Response value for [`crate::client::General::call_vendor_request`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CallVendorResponse<T> {
/// Object containing appropriate response data.
pub response_data: T,
}

@ -0,0 +1,11 @@
//! Responses related to hotkeys.
use serde::Deserialize;
/// Response value for [`crate::client::General::get_hotkey_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Hotkeys {
/// Array of hotkey names.
pub hotkeys: Vec<String>,
}

@ -0,0 +1,122 @@
//! Responses related to inputs.
use serde::Deserialize;
use time::Duration;
use crate::common::MonitorType;
/// Response value for [`crate::client::Inputs::get_input_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Inputs {
/// Array of inputs.
pub inputs: Vec<Input>,
}
/// Response value for [`crate::client::Inputs::list`].
#[derive(Debug, Deserialize)]
pub struct Input {
/// Name of the input source.
#[serde(rename = "inputName")]
pub name: String,
/// Version input kind.
#[serde(rename = "inputKind")]
pub kind: String,
/// Kind of input, without the version part.
#[serde(rename = "unversionedInputKind")]
pub unversioned_kind: String,
}
/// Response value for [`crate::client::Inputs::get_input_kind_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct InputKinds {
/// Array of input kinds.
pub input_kinds: Vec<String>,
}
/// Response value for
/// [`crate::client::Inputs::get_input_default_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct DefaultInputSettings<T> {
/// Object of default settings for the input kind.
pub default_input_settings: T,
}
/// Response value for [`crate::client::Inputs::settings`].
#[derive(Debug, Deserialize)]
pub struct InputSettings<T> {
/// Object of settings for the input.
#[serde(rename = "inputSettings")]
pub settings: T,
/// The kind of the input.
#[serde(rename = "inputKind")]
pub kind: String,
}
/// Response value for [`crate::client::Inputs::get_input_mute`] and
/// [`crate::client::Inputs::toggle_input_mute`].
#[derive(Debug, Deserialize)]
pub(crate) struct InputMuted {
/// Whether the input is muted.
#[serde(rename = "inputMuted")]
pub muted: bool,
}
/// Response value for [`crate::client::Inputs::volume`].
#[derive(Debug, Deserialize)]
pub struct InputVolume {
/// Volume setting in mul.
#[serde(rename = "inputVolumeMul")]
pub mul: f32,
/// Volume setting in dB.
#[serde(rename = "inputVolumeDb")]
pub db: f32,
}
/// Response value for [`crate::client::Inputs::get_audio_sync_offset`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct AudioSyncOffset {
/// Audio sync offset in milliseconds.
#[serde(deserialize_with = "crate::de::duration_millis")]
pub input_audio_sync_offset: Duration,
}
/// Response value for [`crate::client::Inputs::get_audio_monitor_type`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct AudioMonitorType {
/// Audio monitor type.
pub monitor_type: MonitorType,
}
/// Response value for [`crate::client::Inputs::get_properties_list_property_items`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ListPropertyItems {
/// Array of items in the list property.
pub property_items: Vec<ListPropertyItem>,
}
/// Response value for [`crate::client::Inputs::properties_list_property_items`].
#[derive(Debug, Deserialize)]
pub struct ListPropertyItem {
/// Name of the item.
#[serde(rename = "itemName")]
pub name: String,
/// Whether this item is enabled in the UI.
#[serde(rename = "itemEnabled")]
pub enabled: bool,
/// Content of the item, depending on what it represents.
#[serde(rename = "itemValue")]
pub value: serde_json::Value,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemId {
/// Numeric ID of the scene item.
pub scene_item_id: i64,
}

@ -0,0 +1,56 @@
//! Responses related to media inputs.
use serde::Deserialize;
use time::Duration;
/// Response value for [`crate::client::MediaInputs::status`].
#[derive(Debug, Deserialize)]
pub struct MediaStatus {
/// State of the media input.
#[serde(rename = "mediaState")]
pub state: MediaState,
/// Total duration of the playing media. [`None`] if not playing.
#[serde(
rename = "mediaDuration",
deserialize_with = "crate::de::duration_millis_opt"
)]
pub duration: Option<Duration>,
/// Position of the cursor. [`None`] if not playing.
#[serde(
rename = "mediaCursor",
deserialize_with = "crate::de::duration_millis_opt"
)]
pub cursor: Option<Duration>,
}
/// Response value for [`crate::client::MediaInputs::status`] as part of [`MediaStatus`].
#[derive(Copy, Clone, Debug, Deserialize)]
pub enum MediaState {
/// No state.
#[serde(rename = "OBS_MEDIA_STATE_NONE")]
None,
/// Media is playing.
#[serde(rename = "OBS_MEDIA_STATE_PLAYING")]
Playing,
/// Opening file for replay.
#[serde(rename = "OBS_MEDIA_STATE_OPENING")]
Opening,
/// Buffering data for replay.
#[serde(rename = "OBS_MEDIA_STATE_BUFFERING")]
Buffering,
/// Media is paused.
#[serde(rename = "OBS_MEDIA_STATE_PAUSED")]
Paused,
/// Media stopped.
#[serde(rename = "OBS_MEDIA_STATE_STOPPED")]
Stopped,
/// All media in the play-list played.
#[serde(rename = "OBS_MEDIA_STATE_ENDED")]
Ended,
/// Error occurred while trying to play the media.
#[serde(rename = "OBS_MEDIA_STATE_ERROR")]
Error,
/// Unknown state.
#[serde(other)]
Unknown,
}

@ -1,11 +1,25 @@
//! All responses that can be received from the API.
pub use semver::Version as SemVerVersion;
pub mod config;
pub mod filters;
pub mod general;
pub(crate) mod hotkeys;
pub mod inputs;
pub mod media_inputs;
pub mod profiles;
pub mod recording;
pub(crate) mod replay_buffer;
pub mod scene_collections;
pub mod scene_items;
pub mod scenes;
pub mod sources;
pub mod streaming;
pub mod transitions;
pub mod ui;
pub(crate) mod virtual_cam;
use serde::{de, Deserialize, Deserializer};
use serde_repr::Deserialize_repr;
use time::Duration;
use crate::common::{Alignment, BoundsType, MonitorType};
#[derive(Debug)]
pub(crate) enum ServerMessage {
@ -94,7 +108,7 @@ impl<'de> Deserialize<'de> for ServerMessage {
#[serde(rename_all = "camelCase")]
pub(crate) struct Hello {
#[allow(dead_code)]
pub obs_web_socket_version: SemVerVersion,
pub obs_web_socket_version: semver::Version,
/// version number which gets incremented on each **breaking change** to the obs-websocket
/// protocol. Its usage in this context is to provide the current RPC version that the server
/// would like to use.
@ -243,761 +257,3 @@ pub enum StatusCode {
/// The combination of request fields cannot be used to perform an action.
CannotAct = 703,
}
/// Response value for [`crate::client::Config::list_scene_collections`].
#[derive(Debug, Deserialize)]
pub struct SceneCollections {
/// The name of the current scene collection.
#[serde(rename = "currentSceneCollectionName")]
pub current: String,
/// Array of all available scene collections.
#[serde(rename = "sceneCollections")]
pub collections: Vec<String>,
}
/// Response value for [`crate::client::Config::list_profiles`].
#[derive(Debug, Deserialize)]
pub struct Profiles {
/// The name of the current profile.
#[serde(rename = "currentProfileName")]
pub current: String,
/// Array of all available profiles.
pub profiles: Vec<String>,
}
/// Response value for [`crate::client::Config::get_profile_parameter`].
#[derive(Debug, Deserialize)]
pub struct ProfileParameter {
/// Value associated with the parameter.
#[serde(rename = "parameterValue")]
pub value: Option<String>,
/// Default value associated with the parameter.
#[serde(rename = "defaultParameterValue")]
pub default_value: Option<String>,
}
/// Response value for [`crate::client::Config::video_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct VideoSettings {
/// Numerator of the fractional FPS value.
pub fps_numerator: u32,
/// Denominator of the fractional FPS value.
pub fps_denominator: u32,
/// Width of the base (canvas) resolution in pixels.
pub base_width: u32,
/// Height of the base (canvas) resolution in pixels.
pub base_height: u32,
/// Width of the output resolution in pixels.
pub output_width: u32,
/// Height of the output resolution in pixels.
pub output_height: u32,
}
/// Response value for [`crate::client::Config::stream_service_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StreamServiceSettings<T> {
/// Stream service type, like `rtmp_custom` or `rtmp_common`.
#[serde(rename = "streamServiceType")]
pub r#type: String,
/// Stream service settings.
#[serde(rename = "streamServiceSettings")]
pub settings: T,
}
/// Response value for [`crate::client::Filters::get_source_filter_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Filters {
/// Array of filters.
pub filters: Vec<SourceFilter>,
}
/// Response value for [`crate::client::Filters::list`] and [`crate::client::Filters::get`].
#[derive(Clone, Debug, Deserialize)]
pub struct SourceFilter {
/// Whether the filter is enabled.
#[serde(rename = "filterEnabled")]
pub enabled: bool,
/// Index of the filter in the list, beginning at 0.
#[serde(rename = "filterIndex")]
pub index: u32,
/// The kind of filter.
#[serde(rename = "filterKind")]
pub kind: String,
/// name of the filter.
#[serde(rename = "filterName", default)]
pub name: String,
/// Settings object associated with the filter.
#[serde(rename = "filterSettings")]
pub settings: serde_json::Value,
}
/// Response value for
/// [`crate::client::Filters::get_source_filter_default_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct DefaultFilterSettings<T> {
/// Object of default settings for the filter kind.
pub default_filter_settings: T,
}
/// Response value for [`crate::client::General::version`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Version {
/// Current OBS Studio version.
pub obs_version: SemVerVersion,
/// Current obs-websocket version.
pub obs_web_socket_version: SemVerVersion,
/// Current latest obs-websocket RPC version.
pub rpc_version: u32,
/// Array of available RPC requests for the currently negotiated RPC version.
pub available_requests: Vec<String>,
/// Image formats available in `GetSourceScreenshot` and `SaveSourceScreenshot` requests.
pub supported_image_formats: Vec<String>,
/// Name of the platform. Usually `windows`, `macos`, or `ubuntu` (Linux flavor). Not guaranteed
/// to be any of those.
pub platform: String,
/// Description of the platform, like `Windows 10 (10.0)`.
pub platform_description: String,
}
/// Response value for [`crate::client::General::stats`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Stats {
/// Current CPU usage in percent.
pub cpu_usage: f64,
/// Amount of memory in MB currently being used by OBS.
pub memory_usage: f64,
/// Available disk space on the device being used for recording storage.
pub available_disk_space: f64,
/// Current FPS being rendered.
pub active_fps: f64,
/// Average time in milliseconds that OBS is taking to render a frame.
pub average_frame_render_time: f64,
/// Number of frames skipped by OBS in the render thread.
pub render_skipped_frames: u32,
/// Total number of frames outputted by the render thread.
pub render_total_frames: u32,
/// Number of frames skipped by OBS in the output thread.
pub output_skipped_frames: u32,
/// Total number of frames outputted by the output thread.
pub output_total_frames: u32,
/// Total number of messages received by obs-websocket from the client.
pub web_socket_session_incoming_messages: u64,
/// Total number of messages sent by obs-websocket to the client.
pub web_socket_session_outgoing_messages: u64,
}
/// Response value for [`crate::client::General::get_hotkey_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Hotkeys {
/// Array of hotkey names.
pub hotkeys: Vec<String>,
}
/// Response value for [`crate::client::Ui::get_studio_mode_enabled`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct StudioModeEnabled {
/// Whether studio mode is enabled.
#[serde(rename = "studioModeEnabled")]
pub enabled: bool,
}
/// Response value for [`crate::client::General::call_vendor_request`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CallVendorResponse<T> {
/// Object containing appropriate response data.
pub response_data: T,
}
/// Response value for [`crate::client::Inputs::get_input_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Inputs {
/// Array of inputs.
pub inputs: Vec<Input>,
}
/// Response value for [`crate::client::Inputs::list`].
#[derive(Debug, Deserialize)]
pub struct Input {
/// Name of the input source.
#[serde(rename = "inputName")]
pub name: String,
/// Version input kind.
#[serde(rename = "inputKind")]
pub kind: String,
/// Kind of input, without the version part.
#[serde(rename = "unversionedInputKind")]
pub unversioned_kind: String,
}
/// Response value for [`crate::client::Inputs::get_input_kind_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct InputKinds {
/// Array of input kinds.
pub input_kinds: Vec<String>,
}
/// Response value for
/// [`crate::client::Inputs::get_input_default_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct DefaultInputSettings<T> {
/// Object of default settings for the input kind.
pub default_input_settings: T,
}
/// Response value for [`crate::client::Inputs::settings`].
#[derive(Debug, Deserialize)]
pub struct InputSettings<T> {
/// Object of settings for the input.
#[serde(rename = "inputSettings")]
pub settings: T,
/// The kind of the input.
#[serde(rename = "inputKind")]
pub kind: String,
}
/// Response value for [`crate::client::Inputs::get_input_mute`] and
/// [`crate::client::Inputs::toggle_input_mute`].
#[derive(Debug, Deserialize)]
pub(crate) struct InputMuted {
/// Whether the input is muted.
#[serde(rename = "inputMuted")]
pub muted: bool,
}
/// Response value for [`crate::client::Inputs::volume`].
#[derive(Debug, Deserialize)]
pub struct InputVolume {
/// Volume setting in mul.
#[serde(rename = "inputVolumeMul")]
pub mul: f32,
/// Volume setting in dB.
#[serde(rename = "inputVolumeDb")]
pub db: f32,
}
/// Response value for [`crate::client::MediaInputs::status`].
#[derive(Debug, Deserialize)]
pub struct MediaStatus {
/// State of the media input.
#[serde(rename = "mediaState")]
pub state: MediaState,
/// Total duration of the playing media. [`None`] if not playing.
#[serde(
rename = "mediaDuration",
deserialize_with = "crate::de::duration_millis_opt"
)]
pub duration: Option<Duration>,
/// Position of the cursor. [`None`] if not playing.
#[serde(
rename = "mediaCursor",
deserialize_with = "crate::de::duration_millis_opt"
)]
pub cursor: Option<Duration>,
}
/// Response value for [`crate::client::MediaInputs::status`] as part of [`MediaStatus`].
#[derive(Copy, Clone, Debug, Deserialize)]
pub enum MediaState {
/// No state.
#[serde(rename = "OBS_MEDIA_STATE_NONE")]
None,
/// Media is playing.
#[serde(rename = "OBS_MEDIA_STATE_PLAYING")]
Playing,
/// Opening file for replay.
#[serde(rename = "OBS_MEDIA_STATE_OPENING")]
Opening,
/// Buffering data for replay.
#[serde(rename = "OBS_MEDIA_STATE_BUFFERING")]
Buffering,
/// Media is paused.
#[serde(rename = "OBS_MEDIA_STATE_PAUSED")]
Paused,
/// Media stopped.
#[serde(rename = "OBS_MEDIA_STATE_STOPPED")]
Stopped,
/// All media in the play-list played.
#[serde(rename = "OBS_MEDIA_STATE_ENDED")]
Ended,
/// Error occurred while trying to play the media.
#[serde(rename = "OBS_MEDIA_STATE_ERROR")]
Error,
/// Unknown state.
#[serde(other)]
Unknown,
}
/// Response value for [`crate::client::Recording::status`].
#[derive(Debug, Deserialize)]
pub struct RecordStatus {
/// Whether the output is active.
#[serde(rename = "outputActive")]
pub active: bool,
/// Whether the output is paused.
#[serde(rename = "outputPaused")]
pub paused: bool,
/// Current formatted time code string for the output.
#[serde(
rename = "outputTimecode",
deserialize_with = "crate::de::duration_timecode"
)]
pub timecode: Duration,
/// Current duration in milliseconds for the output.
#[serde(
rename = "outputDuration",
deserialize_with = "crate::de::duration_millis"
)]
pub duration: Duration,
/// Number of bytes sent by the output.
#[serde(rename = "outputBytes")]
pub bytes: u64,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct OutputActive {
/// New state of the stream output.
#[serde(rename = "outputActive")]
pub active: bool,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct OutputPaused {
#[serde(rename = "outputPaused")]
pub paused: bool,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct RecordDirectory {
/// Output directory.
pub record_directory: String,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SavedReplayPath {
pub saved_replay_path: String,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemId {
/// Numeric ID of the scene item.
pub scene_item_id: i64,
}
/// Response value for
/// [`crate::client::SceneItems::get_scene_item_transform`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct GetSceneItemTransform {
pub scene_item_transform: SceneItemTransform,
}
/// Response value for [`crate::client::SceneItems::transform`].
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SceneItemTransform {
/// Base width (without scaling) of the source.
pub source_width: f32,
/// Base height (without scaling) of the source.
pub source_height: f32,
/// The x position of the source from the left.
pub position_x: f32,
/// The y position of the source from the top.
pub position_y: f32,
/// The clockwise rotation of the scene item in degrees around the point of alignment.
pub rotation: f32,
/// The x-scale factor of the source.
pub scale_x: f32,
/// The y-scale factor of the source.
pub scale_y: f32,
/// Scene item width (base source width multiplied by the horizontal scaling factor).
pub width: f32,
/// Scene item height (base source height multiplied by the vertical scaling factor).
pub height: f32,
/// The point on the source that the item is manipulated from.
#[serde(deserialize_with = "crate::de::bitflags_u8")]
pub alignment: Alignment,
/// Type of bounding box.
pub bounds_type: BoundsType,
/// Alignment of the bounding box.
#[serde(deserialize_with = "crate::de::bitflags_u8")]
pub bounds_alignment: Alignment,
/// Width of the bounding box.
pub bounds_width: f32,
/// Height of the bounding box.
pub bounds_height: f32,
/// The number of pixels cropped off the left of the source before scaling.
pub crop_left: u32,
/// The number of pixels cropped off the right of the source before scaling.
pub crop_right: u32,
/// The number of pixels cropped off the top of the source before scaling.
pub crop_top: u32,
/// The number of pixels cropped off the bottom of the source before scaling.
pub crop_bottom: u32,
}
/// Response value for [`crate::client::SceneItems::get_enabled`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemEnabled {
/// Whether the scene item is enabled.
pub scene_item_enabled: bool,
}
/// Response value for [`crate::client::SceneItems::get_locked`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemLocked {
/// Whether the scene item is locked.
pub scene_item_locked: bool,
}
/// Response value for [`crate::client::SceneItems::get_index`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemIndex {
/// Index position of the scene item.
pub scene_item_index: u32,
}
/// Response value for [`crate::client::SceneItems::get_private_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemSettings<T> {
pub scene_item_settings: T,
}
/// Response value for [`crate::client::Inputs::get_audio_sync_offset`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct AudioSyncOffset {
/// Audio sync offset in milliseconds.
#[serde(deserialize_with = "crate::de::duration_millis")]
pub input_audio_sync_offset: Duration,
}
/// Response value for [`crate::client::Inputs::get_audio_monitor_type`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct AudioMonitorType {
/// Audio monitor type.
pub monitor_type: MonitorType,
}
/// Response value for [`crate::client::Inputs::get_properties_list_property_items`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ListPropertyItems {
/// Array of items in the list property.
pub property_items: Vec<ListPropertyItem>,
}
/// Response value for [`crate::client::Inputs::properties_list_property_items`].
#[derive(Debug, Deserialize)]
pub struct ListPropertyItem {
/// Name of the item.
#[serde(rename = "itemName")]
pub name: String,
/// Whether this item is enabled in the UI.
#[serde(rename = "itemEnabled")]
pub enabled: bool,
/// Content of the item, depending on what it represents.
#[serde(rename = "itemValue")]
pub value: serde_json::Value,
}
/// Response value for [`crate::client::SceneItems::get_list`] and
/// [`crate::client::SceneItems::get_group_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemList {
/// Array of scene items in the scene or group.
pub scene_items: Vec<SceneItem>,
}
/// Response value for [`crate::client::SceneItems::list`] and
/// [`crate::client::SceneItems::list_group`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SceneItem {
/// Identifier of the scene item.
#[serde(rename = "sceneItemId")]
pub id: i64,
/// Positional index within a scene.
#[serde(rename = "sceneItemIndex")]
pub index: u32,
/// Name of this source.
pub source_name: String,
/// The kind of source this item represents.
pub source_type: SourceType,
/// Kind of input. Only present if this is a [`SourceType::Input`].
pub input_kind: Option<String>,
/// Whether this item is a group. Only present if this is a [`SourceType::Scene`].
pub is_group: Option<bool>,
}
/// Kind of source that is represented by a [`SceneItem`].
#[derive(Copy, Clone, Debug, Deserialize)]
pub enum SourceType {
/// Input source from outside of OBS.
#[serde(rename = "OBS_SOURCE_TYPE_INPUT")]
Input,
/// Filter applied to other items.
#[serde(rename = "OBS_SOURCE_TYPE_FILTER")]
Filter,
/// Transition when switching scenes.
#[serde(rename = "OBS_SOURCE_TYPE_TRANSITION")]
Transition,
/// Scene in OBS.
#[serde(rename = "OBS_SOURCE_TYPE_SCENE")]
Scene,
}
/// Response value for [`crate::client::Scenes::list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Scenes {
/// Current program scene.
pub current_program_scene_name: Option<String>,
/// Current preview scene. [`None`] if not in studio mode.
pub current_preview_scene_name: Option<String>,
/// Array of scenes in OBS.
pub scenes: Vec<Scene>,
}
/// Response value for [`crate::client::Scenes::list`] as part of [`Scenes`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Scene {
/// Name of the scene.
#[serde(rename = "sceneName")]
pub name: String,
/// Positional index in the list of scenes.
#[serde(rename = "sceneIndex")]
pub index: usize,
}
/// Response value for [`crate::client::Scenes::get_group_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Groups {
/// Array of group names.
pub groups: Vec<String>,
}
/// Response value for
/// [`crate::client::Scenes::get_current_program_scene`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CurrentProgramScene {
/// Current program scene.
pub current_program_scene_name: String,
}
/// Response value for
/// [`crate::client::Scenes::get_current_preview_scene`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CurrentPreviewScene {
/// Current preview scene.
pub current_preview_scene_name: String,
}
/// Response value for [`crate::client::Scenes::transition_override`].
#[derive(Debug, Deserialize)]
pub struct SceneTransitionOverride {
/// Name of the overridden scene transition.
#[serde(rename = "transitionName")]
pub name: Option<String>,
/// Duration of the overridden scene transition.
#[serde(
rename = "transitionDuration",
deserialize_with = "crate::de::duration_millis_opt"
)]
pub duration: Option<Duration>,
}
/// Response value for [`crate::client::Sources::active`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceActive {
/// Whether the source is showing in program.
#[serde(rename = "videoActive")]
pub active: bool,
/// Whether the source is showing in the UI (preview, projector, properties).
#[serde(rename = "videoShowing")]
pub showing: bool,
}
/// Response value for [`crate::client::Sources::get_screenshot`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ImageData {
/// Base64-encoded screenshot.
pub image_data: String,
}
/// Response value for [`crate::client::Streaming::status`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StreamStatus {
/// Whether the output is active.
#[serde(rename = "outputActive")]
pub active: bool,
/// Whether the output is currently reconnecting.
#[serde(rename = "outputReconnecting")]
pub reconnecting: bool,
/// Current time code for the output.
#[serde(
rename = "outputTimecode",
deserialize_with = "crate::de::duration_timecode"
)]
pub timecode: Duration,
/// Current duration for the output.
#[serde(
rename = "outputDuration",
deserialize_with = "crate::de::duration_millis"
)]
pub duration: Duration,
/// Number of bytes sent by the output.
#[serde(rename = "outputBytes")]
pub bytes: u64,
/// Number of frames skipped by the output's process.
#[serde(rename = "outputSkippedFrames")]
pub skipped_frames: u32,
/// Total number of frames delivered by the output's process.
#[serde(rename = "outputTotalFrames")]
pub total_frames: u32,
}
/// Response value for
/// [`crate::client::Transitions::get_transition_kind_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct TransitionKinds {
/// Array of transition kinds.
pub transition_kinds: Vec<String>,
}
/// Response value for [`crate::client::Transitions::list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SceneTransitionList {
/// Name of the current scene transition.
pub current_scene_transition_name: Option<String>,
/// Kind of the current scene transition.
pub current_scene_transition_kind: Option<String>,
/// Array of transitions.
pub transitions: Vec<Transition>,
}
/// Response value for [`crate::client::Transitions::list`] as part of [`SceneTransitionList`].
#[derive(Debug, Deserialize)]
pub struct Transition {
/// Name of the transition.
#[serde(rename = "transitionName")]
pub name: String,
/// Kind of the transition.
#[serde(rename = "transitionKind")]
pub kind: String,
/// Whether the transition uses a fixed (non-configurable) duration.
#[serde(rename = "transitionFixed")]
pub fixed: bool,
/// Whether the transition supports being configured.
#[serde(rename = "transitionConfigurable")]
pub configurable: bool,
}
/// Response value for [`crate::client::Transitions::current`].
#[derive(Debug, Deserialize)]
pub struct CurrentSceneTransition {
/// Name of the transition.
#[serde(rename = "transitionName")]
pub name: String,
/// Kind of the transition.
#[serde(rename = "transitionKind")]
pub kind: String,
/// Whether the transition uses a fixed (non-configurable) duration.
#[serde(rename = "transitionFixed")]
pub fixed: bool,
/// Configured transition duration in milliseconds.
#[serde(
rename = "transitionDuration",
deserialize_with = "crate::de::duration_millis_opt"
)]
pub duration: Option<Duration>,
/// Whether the transition supports being configured.
#[serde(rename = "transitionConfigurable")]
pub configurable: bool,
/// Object of settings for the transition.
#[serde(rename = "transitionSettings")]
pub settings: Option<serde_json::Value>,
}
/// Response value for
/// [`crate::client::Transitions::get_current_scene_transition_cursor`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct TransitionCursor {
/// Cursor position, between `0.0` and `1.0`.
pub transition_cursor: f32,
}
/// Response value for [`crate::client::Ui::get_monitor_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct MonitorList {
pub monitors: Vec<Monitor>,
}
/// Response value for [`crate::client::Ui::list_monitors`].
#[derive(Debug, Deserialize)]
pub struct Monitor {
/// Name of this monitor.
#[serde(rename = "monitorName")]
pub name: String,
/// Pixel size.
#[serde(flatten)]
pub size: MonitorSize,
/// Position on the screen.
#[serde(flatten)]
pub position: MonitorPosition,
}
/// Response value for [`crate::client::Ui::list_monitors`] as part of [`Monitor`].
#[derive(Debug, Deserialize)]
pub struct MonitorSize {
/// Pixel width.
#[serde(rename = "monitorWidth")]
pub width: u16,
/// Pixel height.
#[serde(rename = "monitorHeight")]
pub height: u16,
}
/// Response value for [`crate::client::Ui::list_monitors`] as part of [`Monitor`].
#[derive(Debug, Deserialize)]
pub struct MonitorPosition {
/// Horizontal position on the screen.
#[serde(rename = "monitorPositionX")]
pub x: u16,
/// Vertical position on the screen.
#[serde(rename = "monitorPositionY")]
pub y: u16,
}

@ -0,0 +1,24 @@
//! Responses related to profiles.
use serde::Deserialize;
/// Response value for [`crate::client::Profiles::list`].
#[derive(Debug, Deserialize)]
pub struct Profiles {
/// The name of the current profile.
#[serde(rename = "currentProfileName")]
pub current: String,
/// Array of all available profiles.
pub profiles: Vec<String>,
}
/// Response value for [`crate::client::Profiles::parameter`].
#[derive(Debug, Deserialize)]
pub struct ProfileParameter {
/// Value associated with the parameter.
#[serde(rename = "parameterValue")]
pub value: Option<String>,
/// Default value associated with the parameter.
#[serde(rename = "defaultParameterValue")]
pub default_value: Option<String>,
}

@ -0,0 +1,45 @@
//! Responses related to recording.
use serde::Deserialize;
use time::Duration;
/// Response value for [`crate::client::Recording::status`].
#[derive(Debug, Deserialize)]
pub struct RecordStatus {
/// Whether the output is active.
#[serde(rename = "outputActive")]
pub active: bool,
/// Whether the output is paused.
#[serde(rename = "outputPaused")]
pub paused: bool,
/// Current formatted time code string for the output.
#[serde(
rename = "outputTimecode",
deserialize_with = "crate::de::duration_timecode"
)]
pub timecode: Duration,
/// Current duration in milliseconds for the output.
#[serde(
rename = "outputDuration",
deserialize_with = "crate::de::duration_millis"
)]
pub duration: Duration,
/// Number of bytes sent by the output.
#[serde(rename = "outputBytes")]
pub bytes: u64,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct OutputActive {
/// New state of the stream output.
#[serde(rename = "outputActive")]
pub active: bool,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct OutputPaused {
#[serde(rename = "outputPaused")]
pub paused: bool,
}

@ -0,0 +1,17 @@
//! Responses related to the replay buffer.
use serde::Deserialize;
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct OutputActive {
/// New state of the stream output.
#[serde(rename = "outputActive")]
pub active: bool,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SavedReplayPath {
pub saved_replay_path: String,
}

@ -0,0 +1,14 @@
//! Responses related to scene collections.
use serde::Deserialize;
/// Response value for [`crate::client::SceneCollections::list`].
#[derive(Debug, Deserialize)]
pub struct SceneCollections {
/// The name of the current scene collection.
#[serde(rename = "currentSceneCollectionName")]
pub current: String,
/// Array of all available scene collections.
#[serde(rename = "sceneCollections")]
pub collections: Vec<String>,
}

@ -0,0 +1,142 @@
//! Responses related to scene items.
use serde::Deserialize;
use crate::common::{Alignment, BoundsType};
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemId {
/// Numeric ID of the scene item.
pub scene_item_id: i64,
}
/// Response value for [`crate::client::SceneItems::get_list`] and
/// [`crate::client::SceneItems::get_group_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemList {
/// Array of scene items in the scene or group.
pub scene_items: Vec<SceneItem>,
}
/// Response value for [`crate::client::SceneItems::list`] and
/// [`crate::client::SceneItems::list_group`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SceneItem {
/// Identifier of the scene item.
#[serde(rename = "sceneItemId")]
pub id: i64,
/// Positional index within a scene.
#[serde(rename = "sceneItemIndex")]
pub index: u32,
/// Name of this source.
pub source_name: String,
/// The kind of source this item represents.
pub source_type: SourceType,
/// Kind of input. Only present if this is a [`SourceType::Input`].
pub input_kind: Option<String>,
/// Whether this item is a group. Only present if this is a [`SourceType::Scene`].
pub is_group: Option<bool>,
}
/// Kind of source that is represented by a [`SceneItem`].
#[derive(Copy, Clone, Debug, Deserialize)]
pub enum SourceType {
/// Input source from outside of OBS.
#[serde(rename = "OBS_SOURCE_TYPE_INPUT")]
Input,
/// Filter applied to other items.
#[serde(rename = "OBS_SOURCE_TYPE_FILTER")]
Filter,
/// Transition when switching scenes.
#[serde(rename = "OBS_SOURCE_TYPE_TRANSITION")]
Transition,
/// Scene in OBS.
#[serde(rename = "OBS_SOURCE_TYPE_SCENE")]
Scene,
}
/// Response value for
/// [`crate::client::SceneItems::get_scene_item_transform`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct GetSceneItemTransform {
pub scene_item_transform: SceneItemTransform,
}
/// Response value for [`crate::client::SceneItems::transform`].
#[derive(Clone, Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SceneItemTransform {
/// Base width (without scaling) of the source.
pub source_width: f32,
/// Base height (without scaling) of the source.
pub source_height: f32,
/// The x position of the source from the left.
pub position_x: f32,
/// The y position of the source from the top.
pub position_y: f32,
/// The clockwise rotation of the scene item in degrees around the point of alignment.
pub rotation: f32,
/// The x-scale factor of the source.
pub scale_x: f32,
/// The y-scale factor of the source.
pub scale_y: f32,
/// Scene item width (base source width multiplied by the horizontal scaling factor).
pub width: f32,
/// Scene item height (base source height multiplied by the vertical scaling factor).
pub height: f32,
/// The point on the source that the item is manipulated from.
#[serde(deserialize_with = "crate::de::bitflags_u8")]
pub alignment: Alignment,
/// Type of bounding box.
pub bounds_type: BoundsType,
/// Alignment of the bounding box.
#[serde(deserialize_with = "crate::de::bitflags_u8")]
pub bounds_alignment: Alignment,
/// Width of the bounding box.
pub bounds_width: f32,
/// Height of the bounding box.
pub bounds_height: f32,
/// The number of pixels cropped off the left of the source before scaling.
pub crop_left: u32,
/// The number of pixels cropped off the right of the source before scaling.
pub crop_right: u32,
/// The number of pixels cropped off the top of the source before scaling.
pub crop_top: u32,
/// The number of pixels cropped off the bottom of the source before scaling.
pub crop_bottom: u32,
}
/// Response value for [`crate::client::SceneItems::get_enabled`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemEnabled {
/// Whether the scene item is enabled.
pub scene_item_enabled: bool,
}
/// Response value for [`crate::client::SceneItems::get_locked`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemLocked {
/// Whether the scene item is locked.
pub scene_item_locked: bool,
}
/// Response value for [`crate::client::SceneItems::get_index`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemIndex {
/// Index position of the scene item.
pub scene_item_index: u32,
}
/// Response value for [`crate::client::SceneItems::get_private_settings`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct SceneItemSettings<T> {
pub scene_item_settings: T,
}

@ -0,0 +1,68 @@
//! Responses related to scenes.
use serde::Deserialize;
use time::Duration;
/// Response value for [`crate::client::Scenes::list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Scenes {
/// Current program scene.
pub current_program_scene_name: Option<String>,
/// Current preview scene. [`None`] if not in studio mode.
pub current_preview_scene_name: Option<String>,
/// Array of scenes in OBS.
pub scenes: Vec<Scene>,
}
/// Response value for [`crate::client::Scenes::list`] as part of [`Scenes`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct Scene {
/// Name of the scene.
#[serde(rename = "sceneName")]
pub name: String,
/// Positional index in the list of scenes.
#[serde(rename = "sceneIndex")]
pub index: usize,
}
/// Response value for [`crate::client::Scenes::get_group_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct Groups {
/// Array of group names.
pub groups: Vec<String>,
}
/// Response value for
/// [`crate::client::Scenes::get_current_program_scene`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CurrentProgramScene {
/// Current program scene.
pub current_program_scene_name: String,
}
/// Response value for
/// [`crate::client::Scenes::get_current_preview_scene`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct CurrentPreviewScene {
/// Current preview scene.
pub current_preview_scene_name: String,
}
/// Response value for [`crate::client::Scenes::transition_override`].
#[derive(Debug, Deserialize)]
pub struct SceneTransitionOverride {
/// Name of the overridden scene transition.
#[serde(rename = "transitionName")]
pub name: Option<String>,
/// Duration of the overridden scene transition.
#[serde(
rename = "transitionDuration",
deserialize_with = "crate::de::duration_millis_opt"
)]
pub duration: Option<Duration>,
}

@ -0,0 +1,23 @@
//! Responses related to sources.
use serde::Deserialize;
/// Response value for [`crate::client::Sources::active`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SourceActive {
/// Whether the source is showing in program.
#[serde(rename = "videoActive")]
pub active: bool,
/// Whether the source is showing in the UI (preview, projector, properties).
#[serde(rename = "videoShowing")]
pub showing: bool,
}
/// Response value for [`crate::client::Sources::get_screenshot`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct ImageData {
/// Base64-encoded screenshot.
pub image_data: String,
}

@ -0,0 +1,45 @@
//! Responses related to streaming.
use serde::Deserialize;
use time::Duration;
/// Response value for [`crate::client::Streaming::status`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct StreamStatus {
/// Whether the output is active.
#[serde(rename = "outputActive")]
pub active: bool,
/// Whether the output is currently reconnecting.
#[serde(rename = "outputReconnecting")]
pub reconnecting: bool,
/// Current time code for the output.
#[serde(
rename = "outputTimecode",
deserialize_with = "crate::de::duration_timecode"
)]
pub timecode: Duration,
/// Current duration for the output.
#[serde(
rename = "outputDuration",
deserialize_with = "crate::de::duration_millis"
)]
pub duration: Duration,
/// Number of bytes sent by the output.
#[serde(rename = "outputBytes")]
pub bytes: u64,
/// Number of frames skipped by the output's process.
#[serde(rename = "outputSkippedFrames")]
pub skipped_frames: u32,
/// Total number of frames delivered by the output's process.
#[serde(rename = "outputTotalFrames")]
pub total_frames: u32,
}
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct OutputActive {
/// New state of the stream output.
#[serde(rename = "outputActive")]
pub active: bool,
}

@ -0,0 +1,77 @@
//! Responses related to transitions.
use serde::Deserialize;
use time::Duration;
/// Response value for
/// [`crate::client::Transitions::get_transition_kind_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct TransitionKinds {
/// Array of transition kinds.
pub transition_kinds: Vec<String>,
}
/// Response value for [`crate::client::Transitions::list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub struct SceneTransitionList {
/// Name of the current scene transition.
pub current_scene_transition_name: Option<String>,
/// Kind of the current scene transition.
pub current_scene_transition_kind: Option<String>,
/// Array of transitions.
pub transitions: Vec<Transition>,
}
/// Response value for [`crate::client::Transitions::list`] as part of [`SceneTransitionList`].
#[derive(Debug, Deserialize)]
pub struct Transition {
/// Name of the transition.
#[serde(rename = "transitionName")]
pub name: String,
/// Kind of the transition.
#[serde(rename = "transitionKind")]
pub kind: String,
/// Whether the transition uses a fixed (non-configurable) duration.
#[serde(rename = "transitionFixed")]
pub fixed: bool,
/// Whether the transition supports being configured.
#[serde(rename = "transitionConfigurable")]
pub configurable: bool,
}
/// Response value for [`crate::client::Transitions::current`].
#[derive(Debug, Deserialize)]
pub struct CurrentSceneTransition {
/// Name of the transition.
#[serde(rename = "transitionName")]
pub name: String,
/// Kind of the transition.
#[serde(rename = "transitionKind")]
pub kind: String,
/// Whether the transition uses a fixed (non-configurable) duration.
#[serde(rename = "transitionFixed")]
pub fixed: bool,
/// Configured transition duration in milliseconds.
#[serde(
rename = "transitionDuration",
deserialize_with = "crate::de::duration_millis_opt"
)]
pub duration: Option<Duration>,
/// Whether the transition supports being configured.
#[serde(rename = "transitionConfigurable")]
pub configurable: bool,
/// Object of settings for the transition.
#[serde(rename = "transitionSettings")]
pub settings: Option<serde_json::Value>,
}
/// Response value for
/// [`crate::client::Transitions::get_current_scene_transition_cursor`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct TransitionCursor {
/// Cursor position, between `0.0` and `1.0`.
pub transition_cursor: f32,
}

@ -0,0 +1,55 @@
//! Responses related to the user interface.
use serde::Deserialize;
/// Response value for [`crate::client::Ui::get_studio_mode_enabled`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct StudioModeEnabled {
/// Whether studio mode is enabled.
#[serde(rename = "studioModeEnabled")]
pub enabled: bool,
}
/// Response value for [`crate::client::Ui::get_monitor_list`].
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct MonitorList {
pub monitors: Vec<Monitor>,
}
/// Response value for [`crate::client::Ui::list_monitors`].
#[derive(Debug, Deserialize)]
pub struct Monitor {
/// Name of this monitor.
#[serde(rename = "monitorName")]
pub name: String,
/// Pixel size.
#[serde(flatten)]
pub size: MonitorSize,
/// Position on the screen.
#[serde(flatten)]
pub position: MonitorPosition,
}
/// Response value for [`crate::client::Ui::list_monitors`] as part of [`Monitor`].
#[derive(Debug, Deserialize)]
pub struct MonitorSize {
/// Pixel width.
#[serde(rename = "monitorWidth")]
pub width: u16,
/// Pixel height.
#[serde(rename = "monitorHeight")]
pub height: u16,
}
/// Response value for [`crate::client::Ui::list_monitors`] as part of [`Monitor`].
#[derive(Debug, Deserialize)]
pub struct MonitorPosition {
/// Horizontal position on the screen.
#[serde(rename = "monitorPositionX")]
pub x: u16,
/// Vertical position on the screen.
#[serde(rename = "monitorPositionY")]
pub y: u16,
}

@ -0,0 +1,11 @@
//! Responses related to the virtual camera.
use serde::Deserialize;
#[derive(Debug, Deserialize)]
#[serde(rename_all = "camelCase")]
pub(crate) struct OutputActive {
/// New state of the stream output.
#[serde(rename = "outputActive")]
pub active: bool,
}

@ -2,7 +2,7 @@ use std::{env, sync::Once};
use anyhow::{ensure, Result};
use obws::{
responses::{Input, Scene, SourceFilter},
responses::{filters::SourceFilter, inputs::Input, scenes::Scene},
Client,
};

@ -1,7 +1,7 @@
use std::time::Duration;
use anyhow::Result;
use obws::{requests::profiles::SetParameter, responses::Profiles};
use obws::{requests::profiles::SetParameter, responses::profiles::Profiles};
use tokio::time;
use crate::common;

@ -1,7 +1,7 @@
use std::time::Duration;
use anyhow::Result;
use obws::responses::SceneCollections;
use obws::responses::scene_collections::SceneCollections;
use tokio::time;
use crate::common;

Loading…
Cancel
Save