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

Interface to libtwolame for mp2 encoding. More...

#include <twolame.h>
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "codec_internal.h"
#include "encode.h"
#include "mpegaudio.h"

Go to the source code of this file.

Data Structures

struct  TWOLAMEContext
 

Macros

#define OFFSET(x)
 
#define AE   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Functions

static av_cold int twolame_encode_close (AVCodecContext *avctx)
 
static av_cold int twolame_encode_init (AVCodecContext *avctx)
 
static int twolame_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 

Variables

static const AVOption options []
 
static const AVClass twolame_class
 
static const FFCodecDefault twolame_defaults []
 
static const int twolame_samplerates []
 
const FFCodec ff_libtwolame_encoder
 

Detailed Description

Interface to libtwolame for mp2 encoding.

Definition in file libtwolame.c.

Macro Definition Documentation

◆ OFFSET

#define OFFSET ( x)
Value:

Definition at line 177 of file libtwolame.c.

◆ AE

Definition at line 178 of file libtwolame.c.

Function Documentation

◆ twolame_encode_close()

static av_cold int twolame_encode_close ( AVCodecContext * avctx)
static

Definition at line 52 of file libtwolame.c.

Referenced by twolame_encode_init().

◆ twolame_encode_init()

static av_cold int twolame_encode_init ( AVCodecContext * avctx)
static

Definition at line 59 of file libtwolame.c.

◆ twolame_encode_frame()

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

Definition at line 109 of file libtwolame.c.

Variable Documentation

◆ options

const AVOption options[]
static
Initial value:
= {
{ "mode", "Mpeg Mode", OFFSET(mode), AV_OPT_TYPE_INT, { .i64 = TWOLAME_AUTO_MODE }, TWOLAME_AUTO_MODE, TWOLAME_MONO, AE, .unit = "mode"},
{ "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_AUTO_MODE }, 0, 0, AE, .unit = "mode" },
{ "stereo", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_STEREO }, 0, 0, AE, .unit = "mode" },
{ "joint_stereo", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_JOINT_STEREO }, 0, 0, AE, .unit = "mode" },
{ "dual_channel", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_DUAL_CHANNEL }, 0, 0, AE, .unit = "mode" },
{ "mono", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_MONO }, 0, 0, AE, .unit = "mode" },
{ "psymodel", "Psychoacoustic Model", OFFSET(psymodel), AV_OPT_TYPE_INT, { .i64 = 3 }, -1, 4, AE},
{ "energy_levels","enable energy levels", OFFSET(energy), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AE},
{ "error_protection","enable CRC error protection", OFFSET(error_protection), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AE},
{ "copyright", "set MPEG Audio Copyright flag", OFFSET(copyright), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AE},
{ "original", "set MPEG Audio Original flag", OFFSET(original), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 1, AE},
{ "verbosity", "set library optput level (0-10)", OFFSET(verbosity), AV_OPT_TYPE_INT, { .i64 = 0 }, 0, 10, AE},
{ NULL },
}
#define AE
Definition alacenc.c:622
#define NULL
Definition coverity.c:32
#define OFFSET(x)
@ AV_OPT_TYPE_CONST
Special option type for declaring named constants.
Definition opt.h:298
@ AV_OPT_TYPE_INT
Underlying C type is int.
Definition opt.h:258
Definition swscale.c:71

Definition at line 179 of file libtwolame.c.

◆ twolame_class

const AVClass twolame_class
static
Initial value:
= {
.class_name = "libtwolame 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 195 of file libtwolame.c.

◆ twolame_defaults

const FFCodecDefault twolame_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ NULL },
}

Definition at line 202 of file libtwolame.c.

◆ twolame_samplerates

const int twolame_samplerates[]
static
Initial value:
= {
16000, 22050, 24000, 32000, 44100, 48000, 0
}

Definition at line 207 of file libtwolame.c.

◆ ff_libtwolame_encoder

const FFCodec ff_libtwolame_encoder
Initial value:
= {
.p.name = "libtwolame",
CODEC_LONG_NAME("libtwolame MP2 (MPEG audio layer 2)"),
.p.type = AVMEDIA_TYPE_AUDIO,
.p.id = AV_CODEC_ID_MP2,
.p.capabilities = AV_CODEC_CAP_DR1 | AV_CODEC_CAP_DELAY,
.priv_data_size = sizeof(TWOLAMEContext),
.defaults = twolame_defaults,
.p.priv_class = &twolame_class,
.p.wrapper_name = "libtwolame",
}
#define CODEC_SAMPLERATES_ARRAY(array)
#define CODEC_CH_LAYOUTS(...)
#define FF_CODEC_CAP_NOT_INIT_THREADSAFE
The codec is not known to be init-threadsafe (i.e.
#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_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition codec.h:79
#define AV_CODEC_CAP_DR1
Codec uses get_buffer() or get_encode_buffer() for allocating buffers and supports custom allocators.
Definition codec.h:49
@ AV_CODEC_ID_MP2
Definition codec_id.h:453
#define AV_CHANNEL_LAYOUT_STEREO
#define AV_CHANNEL_LAYOUT_MONO
@ AVMEDIA_TYPE_AUDIO
Definition avutil.h:201
@ AV_SAMPLE_FMT_FLTP
float, planar
Definition samplefmt.h:66
@ AV_SAMPLE_FMT_S16P
signed 16 bits, planar
Definition samplefmt.h:64
@ AV_SAMPLE_FMT_FLT
float
Definition samplefmt.h:60
@ AV_SAMPLE_FMT_S16
signed 16 bits
Definition samplefmt.h:58
static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition libtwolame.c:109
static const FFCodecDefault twolame_defaults[]
Definition libtwolame.c:202
static av_cold int twolame_encode_init(AVCodecContext *avctx)
Definition libtwolame.c:59
static av_cold int twolame_encode_close(AVCodecContext *avctx)
Definition libtwolame.c:52
static const int twolame_samplerates[]
Definition libtwolame.c:207
static const AVClass twolame_class
Definition libtwolame.c:195

Definition at line 211 of file libtwolame.c.