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
impl ObsOutputRef
pub fn settings(&self) -> &Arc<RwLock<Option<ObsData>>>
pub fn hotkey_data(&self) -> &Arc<RwLock<Option<ObsData>>>
pub fn video_encoders(&self) -> &Arc<RwLock<Vec<Arc<ObsVideoEncoder>>>>
pub fn audio_encoders(&self) -> &Arc<RwLock<Vec<Arc<ObsAudioEncoder>>>>
pub fn id(&self) -> &ObsString
pub fn name(&self) -> &ObsString
pub fn signal_manager(&self) -> &Arc<ObsOutputSignals>
pub fn video_encoders_mut( &mut self, ) -> &mut Arc<RwLock<Vec<Arc<ObsVideoEncoder>>>>
pub fn audio_encoders_mut( &mut self, ) -> &mut Arc<RwLock<Vec<Arc<ObsAudioEncoder>>>>
Source§impl ObsOutputRef
impl ObsOutputRef
Sourcepub async fn get_video_encoders(&self) -> Vec<Arc<ObsVideoEncoder>>
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
Sourcepub async fn video_encoder(
&mut self,
info: VideoEncoderInfo,
handler: Sendable<*mut video_output>,
) -> Result<Arc<ObsVideoEncoder>, ObsError>
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 encoderhandler
- The video output handler
§Returns
A Result containing an Arc-wrapped ObsVideoEncoder or an error
Sourcepub async fn set_video_encoder(
&mut self,
encoder: ObsVideoEncoder,
) -> Result<(), ObsError>
pub async fn set_video_encoder( &mut self, encoder: ObsVideoEncoder, ) -> Result<(), ObsError>
Sourcepub async fn audio_encoder(
&mut self,
info: AudioEncoderInfo,
mixer_idx: usize,
handler: Sendable<*mut audio_output>,
) -> Result<Arc<ObsAudioEncoder>, ObsError>
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 encodermixer_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
Sourcepub async fn set_audio_encoder(
&mut self,
encoder: ObsAudioEncoder,
mixer_idx: usize,
) -> Result<(), ObsError>
pub async fn set_audio_encoder( &mut self, encoder: ObsAudioEncoder, mixer_idx: usize, ) -> Result<(), ObsError>
Sourcepub async fn start(&self) -> Result<(), ObsError>
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)
Sourcepub async fn stop(&mut self) -> Result<(), ObsError>
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
pub fn as_ptr(&self) -> Sendable<*mut obs_output>
Trait Implementations§
Source§impl Clone for ObsOutputRef
impl Clone for ObsOutputRef
Source§fn clone(&self) -> ObsOutputRef
fn clone(&self) -> ObsOutputRef
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreSource§impl Debug for ObsOutputRef
impl Debug for ObsOutputRef
Source§impl ObsPropertyObject for ObsOutputRef
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,
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,
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>>
Source§impl ObsPropertyObjectPrivate for ObsOutputRef
impl ObsPropertyObjectPrivate for ObsOutputRef
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,
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>>
Source§impl ReplayBufferOutput for ObsOutputRef
Implementation of the ReplayBufferOutput trait for ObsOutputRef.
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,
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:
- Accesses the OBS procedure handler for the output
- Calls the “save” procedure to trigger saving the replay
- Calls the “get_last_replay” procedure to retrieve the saved file path
- Extracts the path string from the calldata and returns it
§Returns
Ok(Box<Path>)
- The path to the saved replay fileErr(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