libavformat/mp3enc.c File Reference

#include "avformat.h"
#include "avio_internal.h"
#include "id3v1.h"
#include "id3v2.h"
#include "rawenc.h"
#include "libavutil/avstring.h"
#include "libavcodec/mpegaudio.h"
#include "libavcodec/mpegaudiodata.h"
#include "libavcodec/mpegaudiodecheader.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavutil/dict.h"

Go to the source code of this file.

Data Structures

struct  MP3Context

Defines

#define VBR_NUM_BAGS   400
#define VBR_TOC_SIZE   100

Typedefs

typedef struct MP3Context MP3Context

Functions

static int id3v1_set_string (AVFormatContext *s, const char *key, uint8_t *buf, int buf_size)
static int id3v1_create_tag (AVFormatContext *s, uint8_t *buf)
static int mp2_write_trailer (struct AVFormatContext *s)
static int mp3_write_xing (AVFormatContext *s)
static void mp3_xing_add_frame (AVFormatContext *s, AVPacket *pkt)
static void mp3_fix_xing (AVFormatContext *s)
static int mp3_write_header (struct AVFormatContext *s)
 Write an ID3v2 header at beginning of stream.
static int mp3_write_packet (AVFormatContext *s, AVPacket *pkt)
static int mp3_write_trailer (AVFormatContext *s)

Variables

AVOutputFormat ff_mp2_muxer
static const AVOption options []
static const AVClass mp3_muxer_class
static const int64_t xing_offtbl [2][2] = {{32, 17}, {17,9}}
AVOutputFormat ff_mp3_muxer

Define Documentation

#define VBR_NUM_BAGS   400

Definition at line 81 of file mp3enc.c.

Referenced by mp3_xing_add_frame().

#define VBR_TOC_SIZE   100

Definition at line 82 of file mp3enc.c.


Typedef Documentation

typedef struct MP3Context MP3Context

Function Documentation

static int id3v1_create_tag ( AVFormatContext s,
uint8_t *  buf 
) [static]

Definition at line 48 of file mp3enc.c.

Referenced by mp2_write_trailer().

static int id3v1_set_string ( AVFormatContext s,
const char *  key,
uint8_t *  buf,
int  buf_size 
) [static]

Definition at line 39 of file mp3enc.c.

Referenced by id3v1_create_tag().

static int mp2_write_trailer ( struct AVFormatContext s  )  [static]

Definition at line 97 of file mp3enc.c.

Referenced by mp3_write_trailer().

static void mp3_fix_xing ( AVFormatContext s  )  [static]

Definition at line 274 of file mp3enc.c.

Referenced by mp3_write_trailer().

static int mp3_write_header ( struct AVFormatContext s  )  [static]

Write an ID3v2 header at beginning of stream.

Definition at line 300 of file mp3enc.c.

static int mp3_write_packet ( AVFormatContext s,
AVPacket pkt 
) [static]

Definition at line 315 of file mp3enc.c.

static int mp3_write_trailer ( AVFormatContext s  )  [static]

Definition at line 351 of file mp3enc.c.

static int mp3_write_xing ( AVFormatContext s  )  [static]

Definition at line 155 of file mp3enc.c.

Referenced by mp3_write_header().

static void mp3_xing_add_frame ( AVFormatContext s,
AVPacket pkt 
) [static]

Definition at line 248 of file mp3enc.c.

Referenced by mp3_write_packet().


Variable Documentation

Initial value:
 {
    .name              = "mp2",
    .long_name         = NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
    .mime_type         = "audio/x-mpeg",
    .extensions        = "mp2,m2a",
    .audio_codec       = CODEC_ID_MP2,
    .video_codec       = CODEC_ID_NONE,
    .write_packet      = ff_raw_write_packet,
    .write_trailer     = mp2_write_trailer,
    .flags             = AVFMT_NOTIMESTAMPS,
}

Definition at line 120 of file mp3enc.c.

Initial value:
 {
    .name              = "mp3",
    .long_name         = NULL_IF_CONFIG_SMALL("MPEG audio layer 3"),
    .mime_type         = "audio/x-mpeg",
    .extensions        = "mp3",
    .priv_data_size    = sizeof(MP3Context),
    .audio_codec       = CODEC_ID_MP3,
    .video_codec       = CODEC_ID_NONE,
    .write_header      = mp3_write_header,
    .write_packet      = mp3_write_packet,
    .write_trailer     = mp3_write_trailer,
    .flags             = AVFMT_NOTIMESTAMPS,
    .priv_class = &mp3_muxer_class,
}

Definition at line 365 of file mp3enc.c.

const AVClass mp3_muxer_class [static]
Initial value:
 {
    .class_name     = "MP3 muxer",
    .item_name      = av_default_item_name,
    .option         = options,
    .version        = LIBAVUTIL_VERSION_INT,
}

Definition at line 143 of file mp3enc.c.

const AVOption options[] [static]
Initial value:
 {
    { "id3v2_version", "Select ID3v2 version to write. Currently 3 and 4 are supported.",
      0x42, AV_OPT_TYPE_INT, {.dbl = 4}, 3, 4, AV_OPT_FLAG_ENCODING_PARAM},
    { "write_id3v1", "Enable ID3v1 writing. ID3v1 tags are written in UTF-8 which may not be supported by most software.",
      0x42, AV_OPT_TYPE_INT, {.dbl = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
    { NULL },
}

Definition at line 135 of file mp3enc.c.

const int64_t xing_offtbl[2][2] = {{32, 17}, {17,9}} [static]

Definition at line 150 of file mp3enc.c.

Referenced by mp3_parse_vbr_tags(), mp3_write_packet(), and mp3_write_xing().