libavcodec/libmp3lame.c File Reference

Interface to libmp3lame for mp3 encoding. More...

#include <lame/lame.h>
#include "libavutil/audioconvert.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"

Go to the source code of this file.

Data Structures

struct  LAMEContext

Defines

#define BUFFER_SIZE   (7200 + 2 * MPA_FRAME_SIZE + MPA_FRAME_SIZE / 4+1000)
#define DEINTERLEAVE(type, scale)
#define OFFSET(x)   offsetof(LAMEContext, x)
#define AE   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM

Functions

static av_cold int mp3lame_encode_close (AVCodecContext *avctx)
static av_cold int mp3lame_encode_init (AVCodecContext *avctx)
static int encode_frame_int16 (LAMEContext *s, void *samples, int nb_samples)
static int encode_frame_int32 (LAMEContext *s, void *samples, int nb_samples)
static int encode_frame_float (LAMEContext *s, void *samples, int nb_samples)
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.


Define Documentation

#define AE   AV_OPT_FLAG_AUDIO_PARAM | AV_OPT_FLAG_ENCODING_PARAM

Definition at line 270 of file libmp3lame.c.

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

#define DEINTERLEAVE ( type,
scale   ) 

Value:

do {                  \
    int ch, i;                                          \
    for (ch = 0; ch < s->avctx->channels; ch++) {       \
        const type *input = samples;                    \
        type      *output = s->planar_samples[ch];      \
        input += ch;                                    \
        for (i = 0; i < nb_samples; i++) {              \
            output[i] = *input * scale;                 \
            input += s->avctx->channels;                \
        }                                               \
    }                                                   \
} while (0)

Definition at line 149 of file libmp3lame.c.

Referenced by encode_frame_float(), and encode_frame_int32().

#define OFFSET (  )     offsetof(LAMEContext, x)

Definition at line 269 of file libmp3lame.c.


Function Documentation

static int encode_frame_float ( LAMEContext s,
void *  samples,
int  nb_samples 
) [static]

Definition at line 187 of file libmp3lame.c.

Referenced by mp3lame_encode_frame().

static int encode_frame_int16 ( LAMEContext s,
void *  samples,
int  nb_samples 
) [static]

Definition at line 162 of file libmp3lame.c.

Referenced by mp3lame_encode_frame().

static int encode_frame_int32 ( LAMEContext s,
void *  samples,
int  nb_samples 
) [static]

Definition at line 176 of file libmp3lame.c.

Referenced by mp3lame_encode_frame().

static av_cold int mp3lame_encode_close ( AVCodecContext avctx  )  [static]

Definition at line 53 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 198 of file libmp3lame.c.

static av_cold int mp3lame_encode_init ( AVCodecContext avctx  )  [static]

Definition at line 69 of file libmp3lame.c.


Variable Documentation

Initial value:

 {
    .name                  = "libmp3lame",
    .type                  = AVMEDIA_TYPE_AUDIO,
    .id                    = CODEC_ID_MP3,
    .priv_data_size        = sizeof(LAMEContext),
    .init                  = mp3lame_encode_init,
    .encode2               = mp3lame_encode_frame,
    .close                 = mp3lame_encode_close,
    .capabilities          = CODEC_CAP_DELAY | CODEC_CAP_SMALL_LAST_FRAME,
    .sample_fmts           = (const enum AVSampleFormat[]) { AV_SAMPLE_FMT_S32,
                                                             AV_SAMPLE_FMT_FLT,
                                                             AV_SAMPLE_FMT_S16,
                                                             AV_SAMPLE_FMT_NONE },
    .supported_samplerates = libmp3lame_sample_rates,
    .channel_layouts       = (const uint64_t[]) { AV_CH_LAYOUT_MONO,
                                                  AV_CH_LAYOUT_STEREO,
                                                  0},
    .long_name             = NULL_IF_CONFIG_SMALL("libmp3lame MP3 (MPEG audio layer 3)"),
    .priv_class            = &libmp3lame_class,
    .defaults              = libmp3lame_defaults,
}

Definition at line 292 of file libmp3lame.c.

const AVClass libmp3lame_class [static]

Initial value:

 {
    .class_name = "libmp3lame encoder",
    .item_name  = av_default_item_name,
    .option     = options,
    .version    = LIBAVUTIL_VERSION_INT,
}

Definition at line 276 of file libmp3lame.c.

Initial value:

 {
    { "b",          "0" },
    { NULL },
}

Definition at line 283 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 288 of file libmp3lame.c.

const AVOption options[] [static]

Initial value:

 {
    { "reservoir", "Use bit reservoir.", OFFSET(reservoir), AV_OPT_TYPE_INT, { 1 }, 0, 1, AE },
    { NULL },
}

Definition at line 271 of file libmp3lame.c.


Generated on Fri Oct 26 02:47:57 2012 for FFmpeg by  doxygen 1.5.8