MediaProcessors
Classes | Typedefs | Functions
ffmpeg_audio.h File Reference

Generic processor module context (see type proc_ctx_t) extension for audio encoders and decoders. More...

#include <libmediaprocsutils/mem_utils.h>
#include <libmediaprocs/proc.h>
Include dependency graph for ffmpeg_audio.h:
This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  ffmpeg_audio_enc_ctx_s
 
struct  ffmpeg_audio_dec_ctx_s
 

Typedefs

typedef struct AVCodec AVCodec
 
typedef struct AVCodecContext AVCodecContext
 
typedef struct AVFrame AVFrame
 
typedef struct AVPacket AVPacket
 
typedef struct audio_settings_enc_ctx_s audio_settings_enc_ctx_t
 
typedef struct audio_settings_dec_ctx_s audio_settings_dec_ctx_t
 
typedef struct ffmpeg_audio_enc_ctx_s ffmpeg_audio_enc_ctx_t
 
typedef struct ffmpeg_audio_dec_ctx_s ffmpeg_audio_dec_ctx_t
 

Functions

int ffmpeg_audio_enc_ctx_init (ffmpeg_audio_enc_ctx_t *ffmpeg_audio_enc_ctx, int avcodecid, const audio_settings_enc_ctx_t *audio_settings_enc_ctx, log_ctx_t *log_ctx)
 
void ffmpeg_audio_enc_ctx_deinit (ffmpeg_audio_enc_ctx_t *ffmpeg_audio_enc_ctx, log_ctx_t *log_ctx)
 
int ffmpeg_audio_enc_frame (ffmpeg_audio_enc_ctx_t *ffmpeg_audio_enc_ctx, AVFrame *avframe_iput, fifo_ctx_t *oput_fifo_ctx, log_ctx_t *log_ctx)
 
int ffmpeg_audio_dec_ctx_init (ffmpeg_audio_dec_ctx_t *ffmpeg_audio_dec_ctx, int avcodecid, const audio_settings_dec_ctx_t *audio_settings_dec_ctx, log_ctx_t *log_ctx)
 
void ffmpeg_audio_dec_ctx_deinit (ffmpeg_audio_dec_ctx_t *ffmpeg_audio_dec_ctx, log_ctx_t *log_ctx)
 
int ffmpeg_audio_dec_frame (ffmpeg_audio_dec_ctx_t *ffmpeg_audio_dec_ctx, AVPacket *avpacket_iput, fifo_ctx_t *oput_fifo_ctx, log_ctx_t *log_ctx)
 
void ffmpeg_audio_reset_on_new_settings (proc_ctx_t *proc_ctx, volatile void *audio_settings_opaque, int flag_is_encoder, log_ctx_t *log_ctx)
 

Detailed Description

Generic processor module context (see type proc_ctx_t) extension for audio encoders and decoders.

Author
Rafael Antoniello

Definition in file ffmpeg_audio.h.

Typedef Documentation

FFmpeg audio decoding common context structure.

FFmpeg audio encoding common context structure.

Function Documentation

void ffmpeg_audio_dec_ctx_deinit ( ffmpeg_audio_dec_ctx_t ffmpeg_audio_dec_ctx,
log_ctx_t log_ctx 
)

De-initialize FFmpeg's audio decoding common context structure previously allocated by a call to 'ffmpeg_audio_dec_ctx_init()'. This function release any heap-allocated field or structure member.

Parameters
ffmpeg_audio_dec_ctxPointer to the audio decoding common context structure to be de-initialized.
log_ctxExternally defined LOG module context structure.

Definition at line 301 of file ffmpeg_audio.c.

int ffmpeg_audio_dec_ctx_init ( ffmpeg_audio_dec_ctx_t ffmpeg_audio_dec_ctx,
int  avcodecid,
const audio_settings_dec_ctx_t audio_settings_dec_ctx,
log_ctx_t log_ctx 
)

Initialize FFmpeg's audio decoding common context structure.

Parameters
ffmpeg_audio_dec_ctxPointer to the audio decoding common context structure to be initialized.
avcodecidUnambiguous decoder identifier (namely, the decoder type Id.).
audio_settings_dec_ctxPointer to the initial generic audio decoder settings context structure.
log_ctxExternally defined LOG module context structure.
Returns
Status code (STAT_SUCCESS code in case of success, for other code values please refer to .stat_codes.h).

Definition at line 229 of file ffmpeg_audio.c.

int ffmpeg_audio_dec_frame ( ffmpeg_audio_dec_ctx_t ffmpeg_audio_dec_ctx,
AVPacket *  avpacket_iput,
fifo_ctx_t oput_fifo_ctx,
log_ctx_t log_ctx 
)

Decode a complete audio frame. If an output frame is produced, is written to the output FIFO buffer.

Parameters
ffmpeg_audio_dec_ctxPointer to the audio decoding common context structure.
avpacket_iputPointer to the (FFmpeg's) input packet structure.
oput_fifo_ctxPointer to the output FIFO buffer context structure.
log_ctxExternally defined LOG module context structure.
Returns
Status code (STAT_SUCCESS code in case of success, for other code values please refer to .stat_codes.h).

Definition at line 311 of file ffmpeg_audio.c.

void ffmpeg_audio_enc_ctx_deinit ( ffmpeg_audio_enc_ctx_t ffmpeg_audio_enc_ctx,
log_ctx_t log_ctx 
)

De-initialize FFmpeg's audio encoding common context structure previously allocated by a call to 'ffmpeg_audio_enc_ctx_init()'. This function release any heap-allocated field or structure member.

Parameters
ffmpeg_audio_enc_ctxPointer to the audio encoding common context structure to be de-initialized.
log_ctxExternally defined LOG module context structure.

Definition at line 139 of file ffmpeg_audio.c.

int ffmpeg_audio_enc_ctx_init ( ffmpeg_audio_enc_ctx_t ffmpeg_audio_enc_ctx,
int  avcodecid,
const audio_settings_enc_ctx_t audio_settings_enc_ctx,
log_ctx_t log_ctx 
)

Initialize FFmpeg's audio encoding common context structure.

Parameters
ffmpeg_audio_enc_ctxPointer to the audio encoding common context structure to be initialized.
avcodecidUnambiguous encoder identifier (namely, the encoder type Id.).
audio_settings_enc_ctxPointer to the initial generic audio encoder settings context structure.
log_ctxExternally defined LOG module context structure.
Returns
Status code (STAT_SUCCESS code in case of success, for other code values please refer to .stat_codes.h).

Definition at line 55 of file ffmpeg_audio.c.

int ffmpeg_audio_enc_frame ( ffmpeg_audio_enc_ctx_t ffmpeg_audio_enc_ctx,
AVFrame *  avframe_iput,
fifo_ctx_t oput_fifo_ctx,
log_ctx_t log_ctx 
)

Encode a complete audio frame. If an output frame is produced, is written to the output FIFO buffer.

Parameters
ffmpeg_audio_enc_ctxPointer to the audio encoding common context structure.
avframe_iputPointer to the (FFmpeg's) input frame structure.
oput_fifo_ctxPointer to the output FIFO buffer context structure.
log_ctxExternally defined LOG module context structure.
Returns
Status code (STAT_SUCCESS code in case of success, for other code values please refer to .stat_codes.h).

Definition at line 149 of file ffmpeg_audio.c.

void ffmpeg_audio_reset_on_new_settings ( proc_ctx_t proc_ctx,
volatile void *  audio_settings_opaque,
int  flag_is_encoder,
log_ctx_t log_ctx 
)

FFmpeg audio CODECS are not generally designed to accept changing settings on run-time. Thus, we have to reset (that is, de-initialize and re-initialize) the CODEC to set new settings while running the processor.

Parameters
proc_ctxPointer to the processor (PROC) context structure
audio_settings_opaqueOpaque pointer to be casted either to an encoder or decoder audio settings context structure.
flag_is_encoderSet to non-zero to signal that we are resetting an encoder, set to zero to identify a decoder.
log_ctxPointer to the LOG module context structure.

Definition at line 392 of file ffmpeg_audio.c.