Data Structures | Defines | Typedefs | Functions | Variables

libavformat/mp3enc.c File Reference

#include <strings.h>
#include "avformat.h"
#include "id3v1.h"
#include "id3v2.h"
#include "rawenc.h"
#include "libavutil/avstring.h"
#include "libavutil/intreadwrite.h"
#include "libavutil/opt.h"
#include "libavcodec/mpegaudio.h"
#include "libavcodec/mpegaudiodata.h"
#include "libavcodec/mpegaudiodecheader.h"
#include "libavformat/avio_internal.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 void id3v2_put_size (AVFormatContext *s, int size)
static int string_is_ascii (const uint8_t *str)
static int id3v2_put_ttag (AVFormatContext *s, const char *str1, const char *str2, uint32_t tag, enum ID3v2Encoding enc)
 Write a text frame with one (normal frames) or two (TXXX frames) strings according to encoding (only UTF-8 or UTF-16+BOM supported).
static int mp2_write_trailer (struct AVFormatContext *s)
static int id3v2_check_write_tag (AVFormatContext *s, AVDictionaryEntry *t, const char table[][4], enum ID3v2Encoding enc)
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 164 of file mp3enc.c.

Referenced by mp3_xing_add_frame().

#define VBR_TOC_SIZE   100

Definition at line 165 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 45 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 36 of file mp3enc.c.

Referenced by id3v1_create_tag().

static int id3v2_check_write_tag ( AVFormatContext s,
AVDictionaryEntry t,
const char  table[][4],
enum ID3v2Encoding  enc 
) [static]

Definition at line 191 of file mp3enc.c.

Referenced by mp3_write_header().

static void id3v2_put_size ( AVFormatContext s,
int  size 
) [static]

Definition at line 80 of file mp3enc.c.

Referenced by id3v2_put_ttag(), and mp3_write_header().

static int id3v2_put_ttag ( AVFormatContext s,
const char *  str1,
const char *  str2,
uint32_t  tag,
enum ID3v2Encoding  enc 
) [static]

Write a text frame with one (normal frames) or two (TXXX frames) strings according to encoding (only UTF-8 or UTF-16+BOM supported).

Returns:
number of bytes written or a negative error code.

Definition at line 99 of file mp3enc.c.

Referenced by id3v2_check_write_tag(), and mp3_write_header().

static int mp2_write_trailer ( struct AVFormatContext s  )  [static]

Definition at line 136 of file mp3enc.c.

Referenced by mp3_write_trailer().

static void mp3_fix_xing ( AVFormatContext s  )  [static]

Definition at line 321 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 347 of file mp3enc.c.

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

Definition at line 397 of file mp3enc.c.

static int mp3_write_trailer ( AVFormatContext s  )  [static]

Definition at line 433 of file mp3enc.c.

static int mp3_write_xing ( AVFormatContext s  )  [static]

Definition at line 211 of file mp3enc.c.

Referenced by mp3_write_header().

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

Definition at line 295 of file mp3enc.c.

Referenced by mp3_write_packet().

static int string_is_ascii ( const uint8_t *  str  )  [static]

Definition at line 88 of file mp3enc.c.

Referenced by id3v2_put_ttag().


Variable Documentation

Initial value:
 {
    "mp2",
    NULL_IF_CONFIG_SMALL("MPEG audio layer 2"),
    "audio/x-mpeg",
    "mp2,m2a",
    0,
    CODEC_ID_MP2,
    CODEC_ID_NONE,
    NULL,
    ff_raw_write_packet,
    mp2_write_trailer,
}

Definition at line 149 of file mp3enc.c.

Initial value:
 {
    "mp3",
    NULL_IF_CONFIG_SMALL("MPEG audio layer 3"),
    "audio/x-mpeg",
    "mp3",
    sizeof(MP3Context),
    CODEC_ID_MP3,
    CODEC_ID_NONE,
    mp3_write_header,
    mp3_write_packet,
    mp3_write_trailer,
    AVFMT_NOTIMESTAMPS,
    .priv_class = &mp3_muxer_class,
}

Definition at line 447 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 184 of file mp3enc.c.

const AVOption options[] [static]
Initial value:
 {
    { "id3v2_version", "Select ID3v2 version to write. Currently 3 and 4 are supported.",
      0x42, FF_OPT_TYPE_INT, {.dbl = 4}, 3, 4, AV_OPT_FLAG_ENCODING_PARAM},
    { NULL },
}

Definition at line 178 of file mp3enc.c.

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

Definition at line 206 of file mp3enc.c.

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