FFmpeg  2.1.1
Data Structures | Macros | Functions | Variables
libtwolame.c File Reference

Interface to libtwolame for mp2 encoding. More...

#include <twolame.h>
#include "libavutil/opt.h"
#include "avcodec.h"
#include "internal.h"
#include "mpegaudio.h"

Go to the source code of this file.

Data Structures

struct  TWOLAMEContext
 

Macros

#define OFFSET(x)   offsetof(TWOLAMEContext, 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 libtwolame_class
 
AVCodec ff_libtwolame_encoder
 

Detailed Description

Interface to libtwolame for mp2 encoding.

Definition in file libtwolame.c.

Macro Definition Documentation

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

Definition at line 154 of file libtwolame.c.

Definition at line 155 of file libtwolame.c.

Function Documentation

static av_cold int twolame_encode_close ( AVCodecContext avctx)
static

Definition at line 47 of file libtwolame.c.

Referenced by twolame_encode_init().

static av_cold int twolame_encode_init ( AVCodecContext avctx)
static

Definition at line 54 of file libtwolame.c.

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

Definition at line 93 of file libtwolame.c.

Variable Documentation

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, "mode"},
{ "auto", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_AUTO_MODE }, 0, 0, AE, "mode" },
{ "stereo", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_STEREO }, 0, 0, AE, "mode" },
{ "joint_stereo", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_JOINT_STEREO }, 0, 0, AE, "mode" },
{ "dual_channel", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_DUAL_CHANNEL }, 0, 0, AE, "mode" },
{ "mono", NULL, 0, AV_OPT_TYPE_CONST, { .i64 = TWOLAME_MONO }, 0, 0, AE, "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},
{ NULL },
}
#define AE
Definition: libtwolame.c:155
mode
Definition: f_perms.c:27
#define OFFSET(x)
Definition: libtwolame.c:154

Definition at line 156 of file libtwolame.c.

const AVClass libtwolame_class
static
Initial value:
= {
.class_name = "libtwolame encoder",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: avcodec.h:820
const char * av_default_item_name(void *ctx)
Return the context name.
Definition: log.c:145
const OptionDef options[]
Definition: ffserver.c:4682

Definition at line 171 of file libtwolame.c.

AVCodec ff_libtwolame_encoder
Initial value:
= {
.name = "libtwolame",
.long_name = NULL_IF_CONFIG_SMALL("libtwolame MP2 (MPEG audio layer 2)"),
.priv_data_size = sizeof(TWOLAMEContext),
.capabilities = CODEC_CAP_DELAY,
.channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
0 },
.supported_samplerates = (const int[]){ 16000, 22050, 24000, 32000, 44100, 48000, 0 },
.priv_class = &libtwolame_class,
}
static av_cold int twolame_encode_init(AVCodecContext *avctx)
Definition: libtwolame.c:54
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
#define AV_CH_LAYOUT_STEREO
signed 16 bits
Definition: samplefmt.h:52
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
Definition: avcodec.h:769
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:151
static const AVClass libtwolame_class
Definition: libtwolame.c:171
AVSampleFormat
Audio Sample Formats.
Definition: samplefmt.h:49
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:538
static int twolame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: libtwolame.c:93
static av_cold int twolame_encode_close(AVCodecContext *avctx)
Definition: libtwolame.c:47
float, planar
Definition: samplefmt.h:60
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:700
signed 16 bits, planar
Definition: samplefmt.h:58
#define AV_CH_LAYOUT_MONO

Definition at line 178 of file libtwolame.c.