FFmpeg
Loading...
Searching...
No Matches
sbcenc.c File Reference

SBC encoder implementation. More...

#include "libavutil/channel_layout.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.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)
 
#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, int msbc)
 
static av_cold 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 int sbc_samplerates [] = { 16000, 32000, 44100, 48000, 0 }
 
static const AVOption options []
 
static const AVClass sbc_class
 
const FFCodec ff_sbc_encoder
 

Detailed Description

SBC encoder implementation.

Definition in file sbcenc.c.

Macro Definition Documentation

◆ OFFSET

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

Definition at line 330 of file sbcenc.c.

◆ AE

Definition at line 331 of file sbcenc.c.

Function Documentation

◆ sbc_analyze_audio()

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

Definition at line 53 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,
int msbc )
static

Definition at line 100 of file sbcenc.c.

Referenced by sbc_encode_frame().

◆ sbc_encode_init()

static av_cold int sbc_encode_init ( AVCodecContext * avctx)
static

Definition at line 194 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 281 of file sbcenc.c.

Variable Documentation

◆ sbc_samplerates

const int sbc_samplerates[] = { 16000, 32000, 44100, 48000, 0 }
static

Definition at line 51 of file sbcenc.c.

Referenced by sbc_encode_init().

◆ 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 AE
Definition alacenc.c:622
#define NULL
Definition coverity.c:32
#define AV_PROFILE_SBC_MSBC
Definition defs.h:179
#define OFFSET(x)
@ AV_OPT_TYPE_DURATION
Underlying C type is int64_t.
Definition opt.h:318
@ AV_OPT_TYPE_BOOL
Underlying C type is int.
Definition opt.h:326
#define FF_AVCTX_PROFILE_OPTION(name, description, type, value)
Definition profiles.h:26

Definition at line 332 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,
}
const char * av_default_item_name(void *ptr)
Return the context name.
Definition log.c:241
#define LIBAVUTIL_VERSION_INT
Definition version.h:85

Definition at line 341 of file sbcenc.c.

◆ ff_sbc_encoder

const FFCodec ff_sbc_encoder
Initial value:
= {
.p.name = "sbc",
CODEC_LONG_NAME("SBC (low-complexity subband codec)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_SBC,
.priv_data_size = sizeof(SBCEncContext),
.p.priv_class = &sbc_class,
}
#define CODEC_SAMPLERATES_ARRAY(array)
#define CODEC_CH_LAYOUTS(...)
#define FF_CODEC_ENCODE_CB(func)
#define CODEC_LONG_NAME(str)
#define CODEC_SAMPLEFMTS(...)
int(* init)(AVBSFContext *ctx)
Definition dts2pts.c:608
#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:147
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
#define AV_CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
Definition codec.h:84
@ AV_CODEC_ID_SBC
Definition codec_id.h:540
#define AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_MONO
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition samplefmt.h:58
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification.
Definition internal.h:88
const AVProfile ff_sbc_profiles[]
Definition profiles.c:170
static int sbc_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *av_frame, int *got_packet_ptr)
Definition sbcenc.c:281
static av_cold int sbc_encode_init(AVCodecContext *avctx)
Definition sbcenc.c:194
static const AVClass sbc_class
Definition sbcenc.c:341
static const int sbc_samplerates[]
Definition sbcenc.c:51

Definition at line 348 of file sbcenc.c.