FFmpeg
Data Structures | Functions | Variables
libcodec2.c File Reference
#include <codec2/codec2.h>
#include "libavutil/channel_layout.h"
#include "avcodec.h"
#include "libavutil/opt.h"
#include "encode.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
 
const AVCodec ff_libcodec2_decoder
 
const AVCodec ff_libcodec2_encoder
 

Function Documentation

◆ libcodec2_init_common()

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

Definition at line 50 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 85 of file libcodec2.c.

◆ libcodec2_init_encoder()

static av_cold int libcodec2_init_encoder ( AVCodecContext avctx)
static

Definition at line 101 of file libcodec2.c.

◆ libcodec2_close()

static av_cold int libcodec2_close ( AVCodecContext avctx)
static

Definition at line 124 of file libcodec2.c.

◆ libcodec2_decode()

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

Definition at line 132 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 162 of file libcodec2.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:

Definition at line 36 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 43 of file libcodec2.c.

◆ ff_libcodec2_decoder

const 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 },
}

Definition at line 179 of file libcodec2.c.

◆ ff_libcodec2_encoder

const AVCodec ff_libcodec2_encoder
Initial value:
= {
.name = "libcodec2",
.long_name = NULL_IF_CONFIG_SMALL("codec2 encoder using libcodec2"),
.capabilities = AV_CODEC_CAP_DR1,
.priv_data_size = sizeof(LibCodec2Context),
.close = libcodec2_close,
.encode2 = libcodec2_encode,
.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 194 of file libcodec2.c.

libcodec2_encode
static int libcodec2_encode(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: libcodec2.c:162
AV_CH_LAYOUT_MONO
#define AV_CH_LAYOUT_MONO
Definition: channel_layout.h:90
init
static int init
Definition: av_tx.c:47
libcodec2_init_decoder
static av_cold int libcodec2_init_decoder(AVCodecContext *avctx)
Definition: libcodec2.c:85
options
static const AVOption options[]
Definition: libcodec2.c:36
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:277
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CODEC_ID_CODEC2
@ AV_CODEC_ID_CODEC2
Definition: codec_id.h:490
AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_AUDIO_PARAM
Definition: opt.h:279
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:124
libcodec2_enc_class
static const AVClass libcodec2_enc_class
Definition: libcodec2.c:43
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:109
AV_CODEC_CAP_DR1
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition: codec.h:52
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:30
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:36
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:132
libcodec2_init_encoder
static av_cold int libcodec2_init_encoder(AVCodecContext *avctx)
Definition: libcodec2.c:101