Struct ObsOutputRef

Source
pub struct ObsOutputRef { /* private fields */ }
Expand description

A reference to an OBS output.

This struct represents an output in OBS, which is responsible for outputting encoded audio and video data to a destination such as:

  • A file (recording)
  • A streaming service (RTMP, etc.)
  • A replay buffer

The output is associated with video and audio encoders that convert raw media to the required format before sending/storing.

Implementations§

Source§

impl ObsOutputRef

Source

pub fn settings(&self) -> &Arc<RwLock<Option<ObsData>>>

Source

pub fn hotkey_data(&self) -> &Arc<RwLock<Option<ObsData>>>

Source

pub fn video_encoders(&self) -> &Arc<RwLock<Vec<Arc<ObsVideoEncoder>>>>

Source

pub fn audio_encoders(&self) -> &Arc<RwLock<Vec<Arc<ObsAudioEncoder>>>>

Source

pub fn id(&self) -> &ObsString

Source

pub fn name(&self) -> &ObsString

Source

pub fn signal_manager(&self) -> &Arc<ObsOutputSignals>

Source

pub fn video_encoders_mut( &mut self, ) -> &mut Arc<RwLock<Vec<Arc<ObsVideoEncoder>>>>

Source

pub fn audio_encoders_mut( &mut self, ) -> &mut Arc<RwLock<Vec<Arc<ObsAudioEncoder>>>>

Source§

impl ObsOutputRef

Source

pub async fn get_video_encoders(&self) -> Vec<Arc<ObsVideoEncoder>>

Returns a list of all video encoders attached to this output.

§Returns

A vector of Arc-wrapped ObsVideoEncoder instances

Source

pub async fn video_encoder( &mut self, info: VideoEncoderInfo, handler: Sendable<*mut video_output>, ) -> Result<Arc<ObsVideoEncoder>, ObsError>

Creates and attaches a new video encoder to this output.

This method creates a new video encoder using the provided information, sets up the video handler, and attaches it to this output.

§Arguments
  • info - Information for creating the video encoder
  • handler - The video output handler
§Returns

A Result containing an Arc-wrapped ObsVideoEncoder or an error

Source

pub async fn set_video_encoder( &mut self, encoder: ObsVideoEncoder, ) -> Result<(), ObsError>

Attaches an existing video encoder to this output.

§Arguments
  • encoder - The video encoder to attach
§Returns

A Result indicating success or an error

Source

pub async fn update_settings( &mut self, settings: ObsData, ) -> Result<(), ObsError>

Updates the settings of this output.

Note: This can only be done when the output is not active.

§Arguments
  • settings - The new settings to apply
§Returns

A Result indicating success or an error

Source

pub async fn audio_encoder( &mut self, info: AudioEncoderInfo, mixer_idx: usize, handler: Sendable<*mut audio_output>, ) -> Result<Arc<ObsAudioEncoder>, ObsError>

Creates and attaches a new audio encoder to this output.

This method creates a new audio encoder using the provided information, sets up the audio handler, and attaches it to this output at the specified mixer index.

§Arguments
  • info - Information for creating the audio encoder
  • mixer_idx - The mixer index to use (typically 0 for primary audio)
  • handler - The audio output handler
§Returns

A Result containing an Arc-wrapped ObsAudioEncoder or an error

Source

pub async fn set_audio_encoder( &mut self, encoder: ObsAudioEncoder, mixer_idx: usize, ) -> Result<(), ObsError>

Attaches an existing audio encoder to this output at the specified mixer index.

§Arguments
  • encoder - The audio encoder to attach
  • mixer_idx - The mixer index to use (typically 0 for primary audio)
§Returns

A Result indicating success or an error

Source

pub async fn start(&self) -> Result<(), ObsError>

Starts the output.

This begins the encoding and streaming/recording process.

§Returns

A Result indicating success or an error (e.g., if the output is already active)

Source

pub async fn stop(&mut self) -> Result<(), ObsError>

Stops the output.

This ends the encoding and streaming/recording process. The method waits for a stop signal and returns the result.

§Returns

A Result indicating success or an error with details about why stopping failed

Source

pub fn as_ptr(&self) -> Sendable<*mut obs_output>

Trait Implementations§

Source§

impl Clone for ObsOutputRef

Source§

fn clone(&self) -> ObsOutputRef

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ObsOutputRef

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl ObsPropertyObject for ObsOutputRef

Source§

fn get_properties<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Vec<ObsProperty>, ObsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Returns the properties of the object
Source§

fn get_properties_by_id<'life0, 'async_trait, T>( id: T, runtime: &'life0 ObsRuntime, ) -> Pin<Box<dyn Future<Output = Result<Vec<ObsProperty>, ObsError>> + Send + 'async_trait>>
where T: 'async_trait + Into<ObsString> + Sync + Send, Self: Send + 'async_trait, 'life0: 'async_trait,

Source§

impl ObsPropertyObjectPrivate for ObsOutputRef

Source§

fn get_properties_raw<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Sendable<*mut obs_properties_t>, ObsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Source§

fn get_properties_by_id_raw<'async_trait, T>( id: T, runtime: ObsRuntime, ) -> Pin<Box<dyn Future<Output = Result<Sendable<*mut obs_properties_t>, ObsError>> + Send + 'async_trait>>
where T: 'async_trait + Into<ObsString> + Sync + Send,

Source§

impl ReplayBufferOutput for ObsOutputRef

Implementation of the ReplayBufferOutput trait for ObsOutputRef.

This implementation allows any ObsOutputRef configured as a replay buffer to save its content to disk via a simple API call.

Source§

fn save_buffer<'life0, 'async_trait>( &'life0 self, ) -> Pin<Box<dyn Future<Output = Result<Box<Path>, ObsError>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Saves the current replay buffer content to disk.

§Implementation Details

This method:

  1. Accesses the OBS procedure handler for the output
  2. Calls the “save” procedure to trigger saving the replay
  3. Calls the “get_last_replay” procedure to retrieve the saved file path
  4. Extracts the path string from the calldata and returns it
§Returns
  • Ok(Box<Path>) - The path to the saved replay file
  • Err(ObsError) - Various errors that might occur during the saving process:
    • Failure to get procedure handler
    • Failure to call “save” procedure
    • Failure to call “get_last_replay” procedure
    • Failure to extract the path from calldata

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided [Span], returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a [WithDispatch] wrapper. Read more
§

impl<T> ErasedDestructor for T
where T: 'static,

§

impl<T> MaybeSendSync for T