FFmpeg
Data Structures | Functions | Variables
libcodec2.c File Reference
#include <codec2/codec2.h>
#include "avcodec.h"
#include "libavutil/opt.h"
#include "internal.h"
#include "codec2utils.h"

Go to the source code of this file.

Data Structures

struct  LibCodec2Context
 

Functions

static av_cold int libcodec2_init_common (AVCodecContext *avctx, int mode)
 
static av_cold int libcodec2_init_decoder (AVCodecContext *avctx)
 
static av_cold int libcodec2_init_encoder (AVCodecContext *avctx)
 
static av_cold int libcodec2_close (AVCodecContext *avctx)
 
static int libcodec2_decode (AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
 
static int libcodec2_encode (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 

Variables

static const AVOption options []
 
static const AVClass libcodec2_enc_class
 
static const AVClass libcodec2_dec_class
 
AVCodec ff_libcodec2_decoder
 
AVCodec ff_libcodec2_encoder
 

Function Documentation

◆ libcodec2_init_common()

static av_cold int libcodec2_init_common ( AVCodecContext avctx,
int  mode 
)
static

Definition at line 54 of file libcodec2.c.

Referenced by libcodec2_init_decoder(), and libcodec2_init_encoder().

◆ libcodec2_init_decoder()

static av_cold int libcodec2_init_decoder ( AVCodecContext avctx)
static

Definition at line 89 of file libcodec2.c.

◆ libcodec2_init_encoder()

static av_cold int libcodec2_init_encoder ( AVCodecContext avctx)
static

Definition at line 105 of file libcodec2.c.

◆ libcodec2_close()

static av_cold int libcodec2_close ( AVCodecContext avctx)
static

Definition at line 128 of file libcodec2.c.

◆ libcodec2_decode()

static int libcodec2_decode ( AVCodecContext avctx,
void *  data,
int got_frame_ptr,
AVPacket pkt 
)
static

Definition at line 136 of file libcodec2.c.

◆ libcodec2_encode()

static int libcodec2_encode ( AVCodecContext avctx,
AVPacket avpkt,
const AVFrame frame,
int got_packet_ptr 
)
static

Definition at line 166 of file libcodec2.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:

Definition at line 34 of file libcodec2.c.

Referenced by libcodec2_init_common().

◆ libcodec2_enc_class

const AVClass libcodec2_enc_class
static
Initial value:
= {
.class_name = "libcodec2 encoder",
.item_name = av_default_item_name,
.option = options,
}

Definition at line 41 of file libcodec2.c.

◆ libcodec2_dec_class

const AVClass libcodec2_dec_class
static
Initial value:
= {
.class_name = "libcodec2 decoder",
.item_name = av_default_item_name,
}

Definition at line 48 of file libcodec2.c.

◆ ff_libcodec2_decoder

AVCodec ff_libcodec2_decoder
Initial value:
= {
.name = "libcodec2",
.long_name = NULL_IF_CONFIG_SMALL("codec2 decoder using libcodec2"),
.priv_data_size = sizeof(LibCodec2Context),
.close = libcodec2_close,
.capabilities = AV_CODEC_CAP_CHANNEL_CONF,
.supported_samplerates = (const int[]){ 8000, 0 },
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
.channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO, 0 },
.priv_class = &libcodec2_dec_class,
}

Definition at line 183 of file libcodec2.c.

◆ ff_libcodec2_encoder

AVCodec ff_libcodec2_encoder
Initial value:
= {
.name = "libcodec2",
.long_name = NULL_IF_CONFIG_SMALL("codec2 encoder using libcodec2"),
.priv_data_size = sizeof(LibCodec2Context),
.close = libcodec2_close,
.encode2 = libcodec2_encode,
.capabilities = 0,
.supported_samplerates = (const int[]){ 8000, 0 },
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
.channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO, 0 },
.priv_class = &libcodec2_enc_class,
}

Definition at line 199 of file libcodec2.c.

libcodec2_encode
static int libcodec2_encode(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: libcodec2.c:166
init
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:31
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:90
libcodec2_dec_class
static const AVClass libcodec2_dec_class
Definition: libcodec2.c:48
libcodec2_init_decoder
static av_cold int libcodec2_init_decoder(AVCodecContext *avctx)
Definition: libcodec2.c:89
options
static const AVOption options[]
Definition: libcodec2.c:34
decode
static void decode(AVCodecContext *dec_ctx, AVPacket *pkt, AVFrame *frame, FILE *outfile)
Definition: decode_audio.c:71
AV_OPT_FLAG_ENCODING_PARAM
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
Definition: opt.h:278
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CODEC_ID_CODEC2
@ AV_CODEC_ID_CODEC2
Definition: codec_id.h:491
AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_AUDIO_PARAM
Definition: opt.h:280
LIBAVUTIL_VERSION_INT
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
NULL
#define NULL
Definition: coverity.c:32
av_default_item_name
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:235
libcodec2_close
static av_cold int libcodec2_close(AVCodecContext *avctx)
Definition: libcodec2.c:128
libcodec2_enc_class
static const AVClass libcodec2_enc_class
Definition: libcodec2.c:41
AV_CODEC_CAP_CHANNEL_CONF
#define AV_CODEC_CAP_CHANNEL_CONF
Codec should fill in channel configuration and samplerate instead of container.
Definition: codec.h:104
NULL_IF_CONFIG_SMALL
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition: internal.h:117
LibCodec2Context
Definition: libcodec2.c:28
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:59
CODEC2_AVOPTIONS
#define CODEC2_AVOPTIONS(desc, classname, min_val, default_val, option_flags)
Definition: codec2utils.h:38
AVSampleFormat
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:61
libcodec2_decode
static int libcodec2_decode(AVCodecContext *avctx, void *data, int *got_frame_ptr, AVPacket *pkt)
Definition: libcodec2.c:136
libcodec2_init_encoder
static av_cold int libcodec2_init_encoder(AVCodecContext *avctx)
Definition: libcodec2.c:105