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 "codec_internal.h"
#include "decode.h"
#include "encode.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, AVFrame *frame, 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 FFCodec ff_libcodec2_decoder
 
const FFCodec ff_libcodec2_encoder
 

Function Documentation

◆ libcodec2_init_common()

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

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

◆ libcodec2_init_encoder()

static av_cold int libcodec2_init_encoder ( AVCodecContext avctx)
static

Definition at line 102 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,
AVFrame frame,
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 161 of file libcodec2.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:

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

◆ ff_libcodec2_decoder

const FFCodec ff_libcodec2_decoder
Initial value:
= {
.p.name = "libcodec2",
CODEC_LONG_NAME("codec2 decoder using libcodec2"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.capabilities = AV_CODEC_CAP_CHANNEL_CONF,
.p.supported_samplerates = (const int[]){ 8000, 0 },
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO, { 0 } },
.priv_data_size = sizeof(LibCodec2Context),
.close = libcodec2_close,
}

Definition at line 178 of file libcodec2.c.

◆ ff_libcodec2_encoder

const FFCodec ff_libcodec2_encoder
Initial value:
= {
.p.name = "libcodec2",
CODEC_LONG_NAME("codec2 encoder using libcodec2"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.capabilities = AV_CODEC_CAP_DR1 |
.p.supported_samplerates = (const int[]){ 8000, 0 },
.p.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16, AV_SAMPLE_FMT_NONE },
.p.ch_layouts = (const AVChannelLayout[]) { AV_CHANNEL_LAYOUT_MONO, { 0 } },
.p.priv_class = &libcodec2_enc_class,
.priv_data_size = sizeof(LibCodec2Context),
.close = libcodec2_close,
}

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:161
FF_CODEC_CAP_NOT_INIT_THREADSAFE
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
Definition: codec_internal.h:34
FF_CODEC_ENCODE_CB
#define FF_CODEC_ENCODE_CB(func)
Definition: codec_internal.h:296
AV_OPT_FLAG_AUDIO_PARAM
#define AV_OPT_FLAG_AUDIO_PARAM
Definition: opt.h:274
libcodec2_init_decoder
static av_cold int libcodec2_init_decoder(AVCodecContext *avctx)
Definition: libcodec2.c:86
options
static const AVOption options[]
Definition: libcodec2.c:37
FF_CODEC_DECODE_CB
#define FF_CODEC_DECODE_CB(func)
Definition: codec_internal.h:287
AVMEDIA_TYPE_AUDIO
@ AVMEDIA_TYPE_AUDIO
Definition: avutil.h:202
AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
#define AV_CODEC_CAP_ENCODER_REORDERED_OPAQUE
This encoder can reorder user opaque values from input AVFrames and return them with corresponding ou...
Definition: codec.h:159
AV_CODEC_ID_CODEC2
@ AV_CODEC_ID_CODEC2
Definition: codec_id.h:507
CODEC_LONG_NAME
#define CODEC_LONG_NAME(str)
Definition: codec_internal.h:272
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:237
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:44
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:269
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:106
init
int(* init)(AVBSFContext *ctx)
Definition: dts2pts.c:365
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
LibCodec2Context
Definition: libcodec2.c:31
AVChannelLayout
An AVChannelLayout holds information about the channel layout of audio data.
Definition: channel_layout.h:303
AV_SAMPLE_FMT_NONE
@ AV_SAMPLE_FMT_NONE
Definition: samplefmt.h:56
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:55
AV_SAMPLE_FMT_S16
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition: samplefmt.h:58
libcodec2_init_encoder
static av_cold int libcodec2_init_encoder(AVCodecContext *avctx)
Definition: libcodec2.c:102
AV_CHANNEL_LAYOUT_MONO
#define AV_CHANNEL_LAYOUT_MONO
Definition: channel_layout.h:378
libcodec2_decode
static int libcodec2_decode(AVCodecContext *avctx, AVFrame *frame, int *got_frame_ptr, AVPacket *pkt)
Definition: libcodec2.c:132