Struct obs_encoder_info

Source
#[repr(C)]
pub struct obs_encoder_info {
Show 22 fields pub id: *const c_char, pub type_: obs_encoder_type, pub codec: *const c_char, pub get_name: Option<unsafe extern "C" fn(type_data: *mut c_void) -> *const c_char>, pub create: Option<unsafe extern "C" fn(settings: *mut obs_data_t, encoder: *mut obs_encoder_t) -> *mut c_void>, pub destroy: Option<unsafe extern "C" fn(data: *mut c_void)>, pub encode: Option<unsafe extern "C" fn(data: *mut c_void, frame: *mut encoder_frame, packet: *mut encoder_packet, received_packet: *mut bool) -> bool>, pub get_frame_size: Option<unsafe extern "C" fn(data: *mut c_void) -> usize>, pub get_defaults: Option<unsafe extern "C" fn(settings: *mut obs_data_t)>, pub get_properties: Option<unsafe extern "C" fn(data: *mut c_void) -> *mut obs_properties_t>, pub update: Option<unsafe extern "C" fn(data: *mut c_void, settings: *mut obs_data_t) -> bool>, pub get_extra_data: Option<unsafe extern "C" fn(data: *mut c_void, extra_data: *mut *mut u8, size: *mut usize) -> bool>, pub get_sei_data: Option<unsafe extern "C" fn(data: *mut c_void, sei_data: *mut *mut u8, size: *mut usize) -> bool>, pub get_audio_info: Option<unsafe extern "C" fn(data: *mut c_void, info: *mut audio_convert_info)>, pub get_video_info: Option<unsafe extern "C" fn(data: *mut c_void, info: *mut video_scale_info)>, pub type_data: *mut c_void, pub free_type_data: Option<unsafe extern "C" fn(type_data: *mut c_void)>, pub caps: u32, pub get_defaults2: Option<unsafe extern "C" fn(settings: *mut obs_data_t, type_data: *mut c_void)>, pub get_properties2: Option<unsafe extern "C" fn(data: *mut c_void, type_data: *mut c_void) -> *mut obs_properties_t>, pub encode_texture: Option<unsafe extern "C" fn(data: *mut c_void, handle: u32, pts: i64, lock_key: u64, next_key: *mut u64, packet: *mut encoder_packet, received_packet: *mut bool) -> bool>, pub encode_texture2: Option<unsafe extern "C" fn(data: *mut c_void, texture: *mut encoder_texture, pts: i64, lock_key: u64, next_key: *mut u64, packet: *mut encoder_packet, received_packet: *mut bool) -> bool>,
}
Expand description

Encoder interface

Encoders have a limited usage with OBS. You are not generally supposed to implement every encoder out there. Generally, these are limited or specific encoders for h264/aac for streaming and recording. It doesn’t have to be just h264 or aac of course, but generally those are the expected encoders.

That being said, other encoders will be kept in mind for future use.

Fields§

§id: *const c_char

Specifies the named identifier of this encoder

§type_: obs_encoder_type

Specifies the encoder type (video or audio)

§codec: *const c_char

Specifies the codec

§get_name: Option<unsafe extern "C" fn(type_data: *mut c_void) -> *const c_char>

Gets the full translated name of this encoder

@param type_data The type_data variable of this structure @return Translated name of the encoder

§create: Option<unsafe extern "C" fn(settings: *mut obs_data_t, encoder: *mut obs_encoder_t) -> *mut c_void>

Creates the encoder with the specified settings

@param settings Settings for the encoder @param encoder OBS encoder context @return Data associated with this encoder context, or NULL if initialization failed.

§destroy: Option<unsafe extern "C" fn(data: *mut c_void)>

Destroys the encoder data

@param data Data associated with this encoder context

§encode: Option<unsafe extern "C" fn(data: *mut c_void, frame: *mut encoder_frame, packet: *mut encoder_packet, received_packet: *mut bool) -> bool>

Encodes frame(s), and outputs encoded packets as they become available.

@param data Data associated with this encoder context @param[in] frame Raw audio/video data to encode @param[out] packet Encoder packet output, if any @param[out] received_packet Set to true if a packet was received, false otherwise @return true if successful, false otherwise.

§get_frame_size: Option<unsafe extern "C" fn(data: *mut c_void) -> usize>

Audio encoder only: Returns the frame size for this encoder

§get_defaults: Option<unsafe extern "C" fn(settings: *mut obs_data_t)>

Gets the default settings for this encoder

@param[out] settings Data to assign default settings to

§get_properties: Option<unsafe extern "C" fn(data: *mut c_void) -> *mut obs_properties_t>

Gets the property information of this encoder

@return The properties data

§update: Option<unsafe extern "C" fn(data: *mut c_void, settings: *mut obs_data_t) -> bool>

Updates the settings for this encoder (usually used for things like changing bitrate while active)

@param data Data associated with this encoder context @param settings New settings for this encoder @return true if successful, false otherwise

§get_extra_data: Option<unsafe extern "C" fn(data: *mut c_void, extra_data: *mut *mut u8, size: *mut usize) -> bool>

Returns extra data associated with this encoder (usually header)

@param data Data associated with this encoder context @param[out] extra_data Pointer to receive the extra data @param[out] size Pointer to receive the size of the extra data @return true if extra data available, false otherwise

§get_sei_data: Option<unsafe extern "C" fn(data: *mut c_void, sei_data: *mut *mut u8, size: *mut usize) -> bool>

Gets the SEI data, if any

@param data Data associated with this encoder context @param[out] sei_data Pointer to receive the SEI data @param[out] size Pointer to receive the SEI data size @return true if SEI data available, false otherwise

§get_audio_info: Option<unsafe extern "C" fn(data: *mut c_void, info: *mut audio_convert_info)>

Returns desired audio format and sample information

@param data Data associated with this encoder context @param[in/out] info Audio format information

§get_video_info: Option<unsafe extern "C" fn(data: *mut c_void, info: *mut video_scale_info)>

Returns desired video format information

@param data Data associated with this encoder context @param[in/out] info Video format information

§type_data: *mut c_void§free_type_data: Option<unsafe extern "C" fn(type_data: *mut c_void)>§caps: u32§get_defaults2: Option<unsafe extern "C" fn(settings: *mut obs_data_t, type_data: *mut c_void)>

Gets the default settings for this encoder

If get_defaults is also defined both will be called, and the first call will be to get_defaults, then to get_defaults2.

@param[out] settings Data to assign default settings to @param[in] typedata Type Data

§get_properties2: Option<unsafe extern "C" fn(data: *mut c_void, type_data: *mut c_void) -> *mut obs_properties_t>

Gets the property information of this encoder

@param[in] data Pointer from create (or null) @param[in] typedata Type Data @return The properties data

§encode_texture: Option<unsafe extern "C" fn(data: *mut c_void, handle: u32, pts: i64, lock_key: u64, next_key: *mut u64, packet: *mut encoder_packet, received_packet: *mut bool) -> bool>§encode_texture2: Option<unsafe extern "C" fn(data: *mut c_void, texture: *mut encoder_texture, pts: i64, lock_key: u64, next_key: *mut u64, packet: *mut encoder_packet, received_packet: *mut bool) -> bool>

Trait Implementations§

Source§

impl Clone for obs_encoder_info

Source§

fn clone(&self) -> obs_encoder_info

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 obs_encoder_info

Source§

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

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

impl Ord for obs_encoder_info

Source§

fn cmp(&self, other: &obs_encoder_info) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for obs_encoder_info

Source§

fn eq(&self, other: &obs_encoder_info) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for obs_encoder_info

Source§

fn partial_cmp(&self, other: &obs_encoder_info) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for obs_encoder_info

Source§

impl Eq for obs_encoder_info

Source§

impl StructuralPartialEq for obs_encoder_info

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.

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.