#[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
impl Clone for obs_encoder_info
Source§fn clone(&self) -> obs_encoder_info
fn clone(&self) -> obs_encoder_info
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more