#[repr(C)]
pub struct obs_encoder_info {
Show 21 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) -> size_t>, 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 size_t) -> bool>, pub get_sei_data: Option<unsafe extern "C" fn(data: *mut c_void, sei_data: *mut *mut u8, size: *mut size_t) -> 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>,
}
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) -> size_t>

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 size_t) -> 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 size_t) -> 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_voidfree_type_data: Option<unsafe extern "C" fn(type_data: *mut c_void)>caps: u32get_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>

Trait Implementations

Returns a copy of the value. Read more
Performs copy-assignment from source. Read more
Formats the value using the given formatter. Read more
Returns the “default value” for a type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning. Read more
Uses borrowed data to replace owned data, usually by cloning. Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.