Open Broadcaster Software
Free, open source software for live streaming and recording
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
obs_encoder_info Struct Reference

Data Fields

const char * id
 
enum obs_encoder_type type
 
const char * codec
 
const char *(* get_name )(void *type_data)
 
void *(* create )(obs_data_t *settings, obs_encoder_t *encoder)
 
void(* destroy )(void *data)
 
bool(* encode )(void *data, struct encoder_frame *frame, struct encoder_packet *packet, bool *received_packet)
 
size_t(* get_frame_size )(void *data)
 
void(* get_defaults )(obs_data_t *settings)
 
obs_properties_t *(* get_properties )(void *data)
 
bool(* update )(void *data, obs_data_t *settings)
 
bool(* get_extra_data )(void *data, uint8_t **extra_data, size_t *size)
 
bool(* get_sei_data )(void *data, uint8_t **sei_data, size_t *size)
 
void(* get_audio_info )(void *data, struct audio_convert_info *info)
 
void(* get_video_info )(void *data, struct video_scale_info *info)
 
void * type_data
 
void(* free_type_data )(void *type_data)
 
uint32_t caps
 

Detailed 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.

Field Documentation

uint32_t obs_encoder_info::caps
const char* obs_encoder_info::codec

Specifies the codec

void*(* obs_encoder_info::create)(obs_data_t *settings, obs_encoder_t *encoder)

Creates the encoder with the specified settings

Parameters
settingsSettings for the encoder
encoderOBS encoder context
Returns
Data associated with this encoder context, or NULL if initialization failed.
void(* obs_encoder_info::destroy)(void *data)

Destroys the encoder data

Parameters
dataData associated with this encoder context
bool(* obs_encoder_info::encode)(void *data, struct encoder_frame *frame, struct encoder_packet *packet, bool *received_packet)

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

Parameters
dataData associated with this encoder context
[in]frameRaw audio/video data to encode
[out]packetEncoder packet output, if any
[out]received_packetSet to true if a packet was received, false otherwise
Returns
true if successful, false otherwise.
void(* obs_encoder_info::free_type_data)(void *type_data)
void(* obs_encoder_info::get_audio_info)(void *data, struct audio_convert_info *info)

Returns desired audio format and sample information

Parameters
dataData associated with this encoder context
in/out]info Audio format information
void(* obs_encoder_info::get_defaults)(obs_data_t *settings)

Gets the default settings for this encoder

Parameters
[out]settingsData to assign default settings to
bool(* obs_encoder_info::get_extra_data)(void *data, uint8_t **extra_data, size_t *size)

Returns extra data associated with this encoder (usually header)

Parameters
dataData associated with this encoder context
[out]extra_dataPointer to receive the extra data
[out]sizePointer to receive the size of the extra data
Returns
true if extra data available, false otherwise
size_t(* obs_encoder_info::get_frame_size)(void *data)

Audio encoder only: Returns the frame size for this encoder

const char*(* obs_encoder_info::get_name)(void *type_data)

Gets the full translated name of this encoder

Parameters
type_dataThe type_data variable of this structure
Returns
Translated name of the encoder
obs_properties_t*(* obs_encoder_info::get_properties)(void *data)

Gets the property information of this encoder

Returns
The properties data
bool(* obs_encoder_info::get_sei_data)(void *data, uint8_t **sei_data, size_t *size)

Gets the SEI data, if any

Parameters
dataData associated with this encoder context
[out]sei_dataPointer to receive the SEI data
[out]sizePointer to receive the SEI data size
Returns
true if SEI data available, false otherwise
void(* obs_encoder_info::get_video_info)(void *data, struct video_scale_info *info)

Returns desired video format information

Parameters
dataData associated with this encoder context
in/out]info Video format information
const char* obs_encoder_info::id

Specifies the named identifier of this encoder

enum obs_encoder_type obs_encoder_info::type

Specifies the encoder type (video or audio)

void* obs_encoder_info::type_data
bool(* obs_encoder_info::update)(void *data, obs_data_t *settings)

Updates the settings for this encoder (usually used for things like changeing birate while active)

Parameters
dataData associated with this encoder context
settingsNew settings for this encoder
Returns
true if successful, false otherwise

The documentation for this struct was generated from the following file: