libmp3lame.c File Reference

Interface to libmp3lame for mp3 encoding. More...

#include <lame/lame.h>
#include "libavutil/channel_layout.h"
#include "libavutil/common.h"
#include "libavutil/float_dsp.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/log.h"
#include "libavutil/opt.h"
#include "avcodec.h"
#include "audio_frame_queue.h"
#include "internal.h"
#include "mpegaudio.h"
#include "mpegaudiodecheader.h"
Include dependency graph for libmp3lame.c:

Go to the source code of this file.

Data Structures

struct  LAMEContext
 

Macros

#define BUFFER_SIZE   (7200 + 2 * MPA_FRAME_SIZE + MPA_FRAME_SIZE / 4+1000)
 
#define ENCODE_BUFFER(func, buf_type, buf_name)
 
#define OFFSET(x)   offsetof(LAMEContext, x)
 
#define AE   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM
 

Typedefs

typedef struct LAMEContext LAMEContext
 

Functions

static int realloc_buffer (LAMEContext *s)
 
static av_cold int mp3lame_encode_close (AVCodecContext *avctx)
 
static av_cold int mp3lame_encode_init (AVCodecContext *avctx)
 
static int mp3lame_encode_frame (AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
 

Variables

static const AVOption options []
 
static const AVClass libmp3lame_class
 
static const AVCodecDefault libmp3lame_defaults []
 
static const int libmp3lame_sample_rates []
 
AVCodec ff_libmp3lame_encoder
 

Detailed Description

Interface to libmp3lame for mp3 encoding.

Definition in file libmp3lame.c.

Macro Definition Documentation

Definition at line 264 of file libmp3lame.c.

Referenced by g726_reset().

#define BUFFER_SIZE   (7200 + 2 * MPA_FRAME_SIZE + MPA_FRAME_SIZE / 4+1000)

Definition at line 41 of file libmp3lame.c.

Referenced by realloc_buffer().

#define ENCODE_BUFFER (   func,
  buf_type,
  buf_name 
)
Value:
do { \
lame_result = func(s->gfp, \
(const buf_type *)buf_name[0], \
(const buf_type *)buf_name[1], frame->nb_samples, \
s->buffer + s->buffer_index, \
s->buffer_size - s->buffer_index); \
} while (0)
const char * s
Definition: avisynth_c.h:668
frame
Definition: stft.m:14
int(* func)(AVBPrint *dst, const char *in, const char *arg)

Definition at line 169 of file libmp3lame.c.

Referenced by mp3lame_encode_frame().

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

Definition at line 263 of file libmp3lame.c.

Typedef Documentation

typedef struct LAMEContext LAMEContext

Function Documentation

static av_cold int mp3lame_encode_close ( AVCodecContext avctx)
static

Definition at line 78 of file libmp3lame.c.

Referenced by mp3lame_encode_init().

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

Definition at line 177 of file libmp3lame.c.

static av_cold int mp3lame_encode_init ( AVCodecContext avctx)
static

Definition at line 92 of file libmp3lame.c.

static int realloc_buffer ( LAMEContext s)
static

Definition at line 58 of file libmp3lame.c.

Referenced by mp3lame_encode_frame(), and mp3lame_encode_init().

Variable Documentation

AVCodec ff_libmp3lame_encoder
Initial value:
= {
.name = "libmp3lame",
.priv_data_size = sizeof(LAMEContext),
.supported_samplerates = libmp3lame_sample_rates,
.channel_layouts = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
0 },
.long_name = NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"),
.priv_class = &libmp3lame_class,
.defaults = libmp3lame_defaults,
}
static int mp3lame_encode_frame(AVCodecContext *avctx, AVPacket *avpkt, const AVFrame *frame, int *got_packet_ptr)
Definition: libmp3lame.c:177
static const AVClass libmp3lame_class
Definition: libmp3lame.c:271
static av_cold int mp3lame_encode_init(AVCodecContext *avctx)
Definition: libmp3lame.c:92
static av_cold int init(AVCodecContext *avctx)
Definition: avrndec.c:35
static const int libmp3lame_sample_rates[]
Definition: libmp3lame.c:283
#define AV_CH_LAYOUT_STEREO
static av_cold int mp3lame_encode_close(AVCodecContext *avctx)
Definition: libmp3lame.c:78
signed 32 bits, planar
Definition: samplefmt.h:59
float, planar
Definition: samplefmt.h:60
#define CODEC_CAP_DELAY
Encoder or decoder requires flushing with NULL input at the end in order to give the complete and cor...
#define CODEC_CAP_SMALL_LAST_FRAME
Codec can be fed a final frame with a smaller size.
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
preferred ID for decoding MPEG audio layer 1, 2 or 3
static const AVCodecDefault libmp3lame_defaults[]
Definition: libmp3lame.c:278
struct LAMEContext LAMEContext
static void close(AVCodecParserContext *s)
Definition: h264_parser.c:375
AVSampleFormat
Audio Sample Formats.
Definition: samplefmt.h:49
signed 16 bits, planar
Definition: samplefmt.h:58
static enum AVSampleFormat sample_fmts[]
Definition: adpcmenc.c:700
#define AV_CH_LAYOUT_MONO

Definition at line 287 of file libmp3lame.c.

const AVClass libmp3lame_class
static
Initial value:
= {
.class_name = "libmp3lame encoder",
.item_name = av_default_item_name,
.option = options,
}
av_default_item_name
static const AVOption options[]
Definition: libmp3lame.c:265
LIBAVUTIL_VERSION_INT
Definition: eval.c:55

Definition at line 271 of file libmp3lame.c.

const AVCodecDefault libmp3lame_defaults[]
static
Initial value:
= {
{ "b", "0" },
{ NULL },
}
NULL
Definition: eval.c:55

Definition at line 278 of file libmp3lame.c.

const int libmp3lame_sample_rates[]
static
Initial value:
= {
44100, 48000, 32000, 22050, 24000, 16000, 11025, 12000, 8000, 0
}

Definition at line 283 of file libmp3lame.c.

const AVOption options[]
static
Initial value:
= {
{ "reservoir", "Use bit reservoir.", OFFSET(reservoir), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AE },
{ "joint_stereo", "Use joint stereo.", OFFSET(joint_stereo), AV_OPT_TYPE_INT, { .i64 = 1 }, 0, 1, AE },
{ NULL },
}
#define AE
Definition: libmp3lame.c:264
NULL
Definition: eval.c:55
#define OFFSET(x)
Definition: libmp3lame.c:263

Definition at line 265 of file libmp3lame.c.