ObsOutputRef

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§

impl ObsOutputRef

Source

pub fn get_current_video_encoder( &self, ) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError>

Returns the current video encoder attached to this output, if any.

Source

pub fn create_and_set_video_encoder( &mut self, info: VideoEncoderInfo, ) -> Result<Arc<ObsVideoEncoder>, ObsError>

Creates and attaches a new audio encoder to this output.

This method creates a new audio encoder using the provided information 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)
§Returns

A Result containing an Arc-wrapped ObsAudioEncoder or an error

Source

pub fn set_video_encoder( &mut self, encoder: Arc<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 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 fn create_and_set_audio_encoder( &mut self, info: AudioEncoderInfo, mixer_idx: usize, ) -> 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 fn set_audio_encoder( &mut self, encoder: Arc<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 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 fn pause(&self, pause: bool) -> Result<(), ObsError>

This pauses or resumes the given output, and waits until the output is fully paused.

§Arguments
  • pause - true to pause the output, false to resume the output.
§Returns
  • Ok(()) - The output was paused or resumed successfully.
  • Err(ObsError::OutputPauseFailure(Some(String))) - The output failed to pause or resume.
Source

pub 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 is_active(&self) -> Result<bool, ObsError>

Source

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

Trait Implementations§

Source§

impl Clone for ObsOutputRef

Source§

fn clone(&self) -> ObsOutputRef

Returns a duplicate 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(&self) -> Result<HashMap<String, ObsProperty>, ObsError>

Returns the properties of the object
Source§

fn get_properties_by_id<T: Into<ObsString> + Sync + Send>( id: T, runtime: &ObsRuntime, ) -> Result<HashMap<String, ObsProperty>, ObsError>

Source§

impl ObsPropertyObjectPrivate for ObsOutputRef

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(&self) -> Result<Box<Path>, ObsError>

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, dest: *mut u8)

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

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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> 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.