FFmpeg  4.0
Data Structures | Macros | Functions | Variables
sbcenc.c File Reference

SBC encoder implementation. More...

#include <stdbool.h>
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include "profiles.h"
#include "put_bits.h"
#include "sbc.h"
#include "sbcdsp.h"

Go to the source code of this file.

Data Structures

struct  SBCEncContext
 

Macros

#define OFFSET(x)   offsetof(SBCEncContext, x)
 
#define AE   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static int sbc_analyze_audio (SBCDSPContext *s, struct sbc_frame *frame)
 
static size_t sbc_pack_frame (AVPacket *avpkt, struct sbc_frame *frame, int joint, bool msbc)
 
static int sbc_encode_init (AVCodecContext *avctx)
 
static int sbc_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *av_frame, int *got_packet_ptr)
 

Variables

static const AVOption options []
 
static const AVClass sbc_class
 
AVCodec ff_sbc_encoder
 

Detailed Description

SBC encoder implementation.

Definition in file sbcenc.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET (   x)    offsetof(SBCEncContext, x)

Definition at line 327 of file sbcenc.c.

◆ AE

Definition at line 328 of file sbcenc.c.

Function Documentation

◆ sbc_analyze_audio()

static int sbc_analyze_audio ( SBCDSPContext *  s,
struct sbc_frame frame 
)
static

Definition at line 50 of file sbcenc.c.

Referenced by sbc_encode_frame().

◆ sbc_pack_frame()

static size_t sbc_pack_frame ( AVPacket avpkt,
struct sbc_frame frame,
int  joint,
bool  msbc 
)
static

Definition at line 97 of file sbcenc.c.

Referenced by sbc_encode_frame().

◆ sbc_encode_init()

static int sbc_encode_init ( AVCodecContext avctx)
static

Definition at line 195 of file sbcenc.c.

◆ sbc_encode_frame()

static int sbc_encode_frame ( AVCodecContext avctx,
AVPacket avpkt,
const AVFrame av_frame,
int got_packet_ptr 
)
static

Definition at line 277 of file sbcenc.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "sbc_delay", "set maximum algorithmic latency",
OFFSET(max_delay), AV_OPT_TYPE_DURATION, {.i64 = 13000}, 1000,13000, AE },
{ "msbc", "use mSBC mode (wideband speech mono SBC)",
OFFSET(msbc), AV_OPT_TYPE_BOOL, {.i64 = 0}, 0, 1, AE },
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define OFFSET(x)
Definition: sbcenc.c:327
#define AE
Definition: sbcenc.c:328

Definition at line 329 of file sbcenc.c.

◆ sbc_class

const AVClass sbc_class
static
Initial value:
= {
.class_name = "sbc encoder",
.item_name = av_default_item_name,
.option = options,
}
static const AVOption options[]
Definition: sbcenc.c:329
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
const char * av_default_item_name(void *ptr)
Return the context name.
Definition: log.c:191

Definition at line 337 of file sbcenc.c.

◆ ff_sbc_encoder

AVCodec ff_sbc_encoder
Initial value:
= {
.name = "sbc",
.long_name = NULL_IF_CONFIG_SMALL("SBC (low-complexity subband codec)"),
.priv_data_size = sizeof(SBCEncContext),
.encode2 = sbc_encode_frame,
.caps_internal = FF_CODEC_CAP_INIT_THREADSAFE,
.channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
.sample_fmts = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S16,
.supported_samplerates = (const int[]) { 16000, 32000, 44100, 48000, 0 },
.priv_class = &sbc_class,
}
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define AV_CH_LAYOUT_STEREO
#define FF_CODEC_CAP_INIT_THREADSAFE
The codec does not modify any global variables in the init function, allowing to call the init functi...
Definition: internal.h:40
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:186
#define AV_CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
Definition: avcodec.h:989
static const AVClass sbc_class
Definition: sbcenc.c:337
AVSampleFormat
Audio sample formats.
Definition: samplefmt.h:58
static const uint16_t channel_layouts[7]
Definition: dca_lbr.c:113
const AVProfile ff_sbc_profiles[]
Definition: profiles.c:150
signed 16 bits
Definition: samplefmt.h:61
static int sbc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *av_frame, int *got_packet_ptr)
Definition: sbcenc.c:277
#define AV_CH_LAYOUT_MONO
static int sbc_encode_init(AVCodecContext *avctx)
Definition: sbcenc.c:195

Definition at line 344 of file sbcenc.c.