Skip to main content

ObsOutputTrait

Trait ObsOutputTrait 

Source
pub trait ObsOutputTrait: ObsOutputTraitSealed + ObsObjectTrait<Native = *mut obs_output_t> {
Show 36 methods // Required method fn signals(&self) -> &Arc<ObsOutputSignals> ⓘ; // Provided methods fn attached_video_encoder( &self, ) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError> { ... } fn attached_audio_encoder( &self, slot: usize, ) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError> { ... } fn attached_audio_encoder_at_slot( &self, slot: AudioEncoderSlot, ) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError> { ... } fn attached_audio_encoders( &self, ) -> Result<HashMap<usize, Arc<ObsAudioEncoder>>, ObsError> { ... } fn attached_service(&self) -> Result<Option<Arc<ObsServiceRef>>, ObsError> { ... } fn get_current_video_encoder( &self, ) -> Result<Option<Arc<ObsVideoEncoder>>, ObsError> { ... } fn get_current_audio_encoder( &self, mixer_idx: usize, ) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError> { ... } fn get_current_audio_encoders( &self, ) -> Result<HashMap<usize, Arc<ObsAudioEncoder>>, ObsError> { ... } fn get_current_service( &self, ) -> Result<Option<Arc<ObsServiceRef>>, ObsError> { ... } fn current_composition(&self) -> Result<ObsOutputComposition, ObsError> { ... } fn set_service(&self, service: Arc<ObsServiceRef>) -> Result<(), ObsError> { ... } fn apply_composition( &self, composition: ObsOutputComposition, ) -> Result<(), ObsError> { ... } fn clear_video_encoder(&self) -> Result<(), ObsError> { ... } fn clear_audio_encoder(&self, mixer_idx: usize) -> Result<(), ObsError> { ... } fn clear_audio_encoder_at_slot( &self, slot: AudioEncoderSlot, ) -> Result<(), ObsError> { ... } fn clear_service(&self) -> Result<(), ObsError> { ... } fn create_and_set_video_encoder( &self, info: VideoEncoderInfo, ) -> Result<Arc<ObsVideoEncoder>, ObsError> { ... } fn set_video_encoder( &self, encoder: Arc<ObsVideoEncoder>, ) -> Result<(), ObsError> { ... } fn create_and_set_audio_encoder( &self, info: AudioEncoderInfo, index: usize, ) -> Result<Arc<ObsAudioEncoder>, ObsError> { ... } fn create_and_set_audio_encoder_for_mix_at_slot( &self, info: AudioEncoderInfo, mix: AudioMixIndex, slot: AudioEncoderSlot, ) -> Result<Arc<ObsAudioEncoder>, ObsError> { ... } fn set_audio_encoder( &self, encoder: Arc<ObsAudioEncoder>, mixer_idx: usize, ) -> Result<(), ObsError> { ... } fn set_audio_encoder_at_slot( &self, encoder: Arc<ObsAudioEncoder>, slot: AudioEncoderSlot, ) -> Result<(), ObsError> { ... } fn start(&self) -> Result<(), ObsError> { ... } fn set_paused_with_timeout( &self, should_pause: bool, timeout: Duration, ) -> Result<(), ObsError> { ... } fn pause(&self) -> Result<(), ObsError> { ... } fn pause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError> { ... } fn unpause(&self) -> Result<(), ObsError> { ... } fn unpause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError> { ... } fn stop(&self) -> Result<(), ObsError> { ... } fn stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError> { ... } fn force_stop(&self) -> Result<(), ObsError> { ... } fn force_stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError> { ... } fn is_active(&self) -> Result<bool, ObsError> { ... } fn is_paused(&self) -> Result<bool, ObsError> { ... } fn is_reconnecting(&self) -> Result<bool, ObsError> { ... }
}

Required Methods§

Provided Methods§

Source

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

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

Source

fn attached_audio_encoder( &self, slot: usize, ) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError>

Returns the audio encoder attached at the requested mixer index, if any. Compatibility helper: slot is the output attachment slot, not an audio mix.

Source

fn attached_audio_encoder_at_slot( &self, slot: AudioEncoderSlot, ) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError>

Source

fn attached_audio_encoders( &self, ) -> Result<HashMap<usize, Arc<ObsAudioEncoder>>, ObsError>

Returns a snapshot of all managed audio encoder attachments keyed by mixer index.

Source

fn attached_service(&self) -> Result<Option<Arc<ObsServiceRef>>, ObsError>

Returns the streaming service attached to this output, if any.

Source

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

👎Deprecated:

Use attached_video_encoder

Source

fn get_current_audio_encoder( &self, mixer_idx: usize, ) -> Result<Option<Arc<ObsAudioEncoder>>, ObsError>

👎Deprecated:

Use attached_audio_encoder

Source

fn get_current_audio_encoders( &self, ) -> Result<HashMap<usize, Arc<ObsAudioEncoder>>, ObsError>

👎Deprecated:

Use attached_audio_encoders

Source

fn get_current_service(&self) -> Result<Option<Arc<ObsServiceRef>>, ObsError>

👎Deprecated:

Use attached_service

Source

fn current_composition(&self) -> Result<ObsOutputComposition, ObsError>

Returns an owned, coherent snapshot of the currently managed encoder/service wiring.

Source

fn set_service(&self, service: Arc<ObsServiceRef>) -> Result<(), ObsError>

Attaches a streaming service to this output. Fails while the output is active.

Source

fn apply_composition( &self, composition: ObsOutputComposition, ) -> Result<(), ObsError>

Replaces the complete managed output wiring in one actor command.

This is the preferred API when constructing an output from discovered capabilities: it validates all runtime affinities before touching libobs, detaches omitted components, and updates the Rust-side ownership graph only after the native calls complete.

Source

fn clear_video_encoder(&self) -> Result<(), ObsError>

Detaches the current video encoder while the output is inactive.

Source

fn clear_audio_encoder(&self, mixer_idx: usize) -> Result<(), ObsError>

Detaches the audio encoder at an output attachment slot while inactive. The historical parameter name was “mixer index”; it never selected the encoder’s source mix.

Source

fn clear_audio_encoder_at_slot( &self, slot: AudioEncoderSlot, ) -> Result<(), ObsError>

Source

fn clear_service(&self) -> Result<(), ObsError>

Detaches the current streaming service while the output is inactive.

Source

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

Creates and attaches a new video encoder to this output.

Fails if the output is active.

Source

fn set_video_encoder( &self, encoder: Arc<ObsVideoEncoder>, ) -> Result<(), ObsError>

Attaches an existing video encoder to this output.

Fails if the output is active.

Source

fn create_and_set_audio_encoder( &self, info: AudioEncoderInfo, index: usize, ) -> Result<Arc<ObsAudioEncoder>, ObsError>

Compatibility helper that historically used one integer for both concepts.

It creates an encoder reading native mix index and also attaches it at output slot index. New code should use Self::create_and_set_audio_encoder_for_mix_at_slot.

Source

fn create_and_set_audio_encoder_for_mix_at_slot( &self, info: AudioEncoderInfo, mix: AudioMixIndex, slot: AudioEncoderSlot, ) -> Result<Arc<ObsAudioEncoder>, ObsError>

Creates an encoder for mix and attaches it independently at output slot.

Source

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

Compatibility helper: mixer_idx is actually an output attachment slot.

Source

fn set_audio_encoder_at_slot( &self, encoder: Arc<ObsAudioEncoder>, slot: AudioEncoderSlot, ) -> Result<(), ObsError>

Attaches an existing audio encoder at an output slot. The encoder retains its own, independently selected AudioMixIndex.

Source

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

Starts the output, wiring encoders to global contexts and invoking obs_output_start.

Lifecycle requests are serialized per output. Starting an already-active output keeps the historical OutputAlreadyActive error so accidental duplicate starts remain visible.

Source

fn set_paused_with_timeout( &self, should_pause: bool, timeout: Duration, ) -> Result<(), ObsError>

Pauses/resumes with an explicit completion deadline.

Repeating the state already in effect is idempotent and returns immediately. Concurrent lifecycle requests are serialized so one request cannot consume another request’s signal. A timeout does not cancel the native pause request; query Self::is_paused before retrying.

Source

fn pause(&self) -> Result<(), ObsError>

Pauses the output with DEFAULT_OUTPUT_OPERATION_TIMEOUT.

Source

fn pause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>

Pauses the output and waits at most timeout for native completion.

Source

fn unpause(&self) -> Result<(), ObsError>

Resumes the output with DEFAULT_OUTPUT_OPERATION_TIMEOUT.

Source

fn unpause_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>

Resumes the output and waits at most timeout for native completion.

Source

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

Stops the output with DEFAULT_OUTPUT_OPERATION_TIMEOUT.

Stop is idempotent: if the output is already inactive and not reconnecting, this returns Ok(()). A timeout only bounds this caller’s wait; libobs may complete later. The managed output continues retaining its encoder/service graph. Re-query Self::is_active and Self::is_reconnecting before changing or releasing that graph.

Source

fn stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>

Requests a graceful stop and waits at most one overall timeout for both the stop and deactivate completion signals. Time spent waiting behind another lifecycle/configuration operation consumes the same deadline.

Source

fn force_stop(&self) -> Result<(), ObsError>

Requests libobs’s force-stop recovery path and waits for normal stop/deactivate completion.

obs_output_force_stop asks the output to stop immediately without waiting for queued data; it is appropriate after a graceful stop deadline when data loss is preferable to waiting. It is not cancellation and still uses the same bounded completion semantics here.

Source

fn force_stop_with_timeout(&self, timeout: Duration) -> Result<(), ObsError>

Force-stop variant with an explicit overall deadline.

Source

fn is_active(&self) -> Result<bool, ObsError>

Returns whether the output is currently active.

Source

fn is_paused(&self) -> Result<bool, ObsError>

Returns whether the output is currently paused.

Source

fn is_reconnecting(&self) -> Result<bool, ObsError>

Returns whether the output is currently reconnecting.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§