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 signal_manager(&self) -> &Arc<ObsOutputSignals>
pub fn settings(&self) -> &Arc<RwLock<Option<ObsData>>>
pub fn hotkey_data(&self) -> &Arc<RwLock<Option<ObsData>>>
pub fn curr_video_encoder(&self) -> &Arc<RwLock<Option<Arc<ObsVideoEncoder>>>>
pub fn audio_encoders(&self) -> &Arc<RwLock<Option<Arc<ObsAudioEncoder>>>>
pub fn id(&self) -> &ObsString
pub fn name(&self) -> &ObsString
pub fn curr_video_encoder_mut( &mut self, ) -> &mut Arc<RwLock<Option<Arc<ObsVideoEncoder>>>>
pub fn audio_encoders_mut( &mut self, ) -> &mut Arc<RwLock<Option<Arc<ObsAudioEncoder>>>>
Source§impl ObsOutputRef
impl ObsOutputRef
Sourcepub fn get_current_video_encoder(
&self,
) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError>
pub fn get_current_video_encoder( &self, ) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError>
Returns the current video encoder attached to this output, if any.
Sourcepub fn create_and_set_video_encoder(
&mut self,
info: VideoEncoderInfo,
) -> Result<Arc<ObsVideoEncoder>, ObsError>
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 encodermixer_idx- The mixer index to use (typically 0 for primary audio)
§Returns
A Result containing an Arc-wrapped ObsAudioEncoder or an error
Sourcepub fn set_video_encoder(
&mut self,
encoder: Arc<ObsVideoEncoder>,
) -> Result<(), ObsError>
pub fn set_video_encoder( &mut self, encoder: Arc<ObsVideoEncoder>, ) -> Result<(), ObsError>
Sourcepub fn create_and_set_audio_encoder(
&mut self,
info: AudioEncoderInfo,
mixer_idx: usize,
) -> Result<Arc<ObsAudioEncoder>, ObsError>
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 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 fn set_audio_encoder(
&mut self,
encoder: Arc<ObsAudioEncoder>,
mixer_idx: usize,
) -> Result<(), ObsError>
pub fn set_audio_encoder( &mut self, encoder: Arc<ObsAudioEncoder>, mixer_idx: usize, ) -> Result<(), ObsError>
Sourcepub fn start(&self) -> Result<(), ObsError>
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)
Sourcepub fn pause(&self, pause: bool) -> Result<(), ObsError>
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-trueto pause the output,falseto resume the output.
§Returns
Ok(())- The output was paused or resumed successfully.Err(ObsError::OutputPauseFailure(Some(String)))- The output failed to pause or resume.
Sourcepub fn stop(&mut self) -> Result<(), ObsError>
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
pub fn is_active(&self) -> Result<bool, ObsError>
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(&self) -> Result<HashMap<String, ObsProperty>, ObsError>
fn get_properties(&self) -> Result<HashMap<String, ObsProperty>, ObsError>
fn get_properties_by_id<T: Into<ObsString> + Sync + Send>( id: T, runtime: &ObsRuntime, ) -> Result<HashMap<String, ObsProperty>, ObsError>
Source§impl ObsPropertyObjectPrivate for ObsOutputRef
impl ObsPropertyObjectPrivate for ObsOutputRef
fn get_properties_raw( &self, ) -> Result<Sendable<*mut obs_properties_t>, ObsError>
fn get_properties_by_id_raw<T: Into<ObsString> + Sync + Send>( id: T, runtime: ObsRuntime, ) -> Result<Sendable<*mut obs_properties_t>, ObsError>
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(&self) -> Result<Box<Path>, ObsError>
fn save_buffer(&self) -> Result<Box<Path>, ObsError>
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