FFmpeg
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
Data Structures | Macros | Functions | Variables
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"
#include "libavutil/avassert.h"
#include "libavutil/crc.h"
#include "libavutil/mathematics.h"
#include "libavutil/replaygain.h"

Go to the source code of this file.

Data Structures

struct  MP3Context
 

Macros

#define XING_NUM_BAGS   400
 
#define XING_TOC_SIZE   100
 
#define XING_SIZE   156
 

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 mp3_write_xing (AVFormatContext *s)
 
static void mp3_xing_add_frame (MP3Context *mp3, AVPacket *pkt)
 
static int mp3_write_audio_packet (AVFormatContext *s, AVPacket *pkt)
 
static int mp3_queue_flush (AVFormatContext *s)
 
static void mp3_update_xing (AVFormatContext *s)
 
static int mp3_write_trailer (struct AVFormatContext *s)
 
static int query_codec (enum AVCodecID id, int std_compliance)
 
static int mp3_write_packet (AVFormatContext *s, AVPacket *pkt)
 
static int mp3_write_header (struct AVFormatContext *s)
 Write an ID3v2 header at beginning of stream. More...
 

Variables

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

Macro Definition Documentation

#define XING_NUM_BAGS   400

Definition at line 81 of file mp3enc.c.

Referenced by mp3_xing_add_frame().

#define XING_TOC_SIZE   100

Definition at line 82 of file mp3enc.c.

Referenced by mp3_update_xing(), and mp3_write_xing().

#define XING_SIZE   156

Definition at line 84 of file mp3enc.c.

Referenced by mp3_update_xing(), and mp3_write_xing().

Function Documentation

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 id3v1_create_tag ( AVFormatContext s,
uint8_t buf 
)
static

Definition at line 48 of file mp3enc.c.

Referenced by mp3_write_trailer().

static int mp3_write_xing ( AVFormatContext s)
static

Definition at line 131 of file mp3enc.c.

Referenced by mp3_queue_flush(), and mp3_write_header().

static void mp3_xing_add_frame ( MP3Context mp3,
AVPacket pkt 
)
static

Definition at line 278 of file mp3enc.c.

Referenced by mp3_write_audio_packet().

static int mp3_write_audio_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 304 of file mp3enc.c.

Referenced by mp3_queue_flush(), and mp3_write_packet().

static int mp3_queue_flush ( AVFormatContext s)
static

Definition at line 369 of file mp3enc.c.

Referenced by mp3_write_packet(), and mp3_write_trailer().

static void mp3_update_xing ( AVFormatContext s)
static

Definition at line 389 of file mp3enc.c.

Referenced by mp3_write_trailer().

static int mp3_write_trailer ( struct AVFormatContext s)
static

Definition at line 458 of file mp3enc.c.

static int query_codec ( enum AVCodecID  id,
int  std_compliance 
)
static

Definition at line 482 of file mp3enc.c.

static int mp3_write_packet ( AVFormatContext s,
AVPacket pkt 
)
static

Definition at line 510 of file mp3enc.c.

static int mp3_write_header ( struct AVFormatContext s)
static

Write an ID3v2 header at beginning of stream.

Definition at line 567 of file mp3enc.c.

Variable Documentation

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

Definition at line 126 of file mp3enc.c.

Referenced by mp3_parse_info_tag(), mp3_write_audio_packet(), and mp3_write_xing().

const AVOption options[]
static
Initial value:
= {
{ "id3v2_version", "Select ID3v2 version to write. Currently 3 and 4 are supported.",
0x42, AV_OPT_TYPE_INT, {.i64 = 4}, 0, 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_BOOL, {.i64 = 0}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
{ "write_xing", "Write the Xing header containing file duration.",
0x42, AV_OPT_TYPE_BOOL, {.i64 = 1}, 0, 1, AV_OPT_FLAG_ENCODING_PARAM},
{ NULL },
}
#define NULL
Definition: coverity.c:32
#define AV_OPT_FLAG_ENCODING_PARAM
a generic parameter which can be set by the user for muxing or encoding
Definition: opt.h:276

Definition at line 493 of file mp3enc.c.

const AVClass mp3_muxer_class
static
Initial value:
= {
.class_name = "MP3 muxer",
.item_name = av_default_item_name,
.option = options,
}
#define LIBAVUTIL_VERSION_INT
Definition: version.h:85
av_default_item_name
static const AVOption options[]
Definition: mp3enc.c:493

Definition at line 503 of file mp3enc.c.

AVOutputFormat ff_mp3_muxer
Initial value:
= {
.name = "mp3",
.long_name = NULL_IF_CONFIG_SMALL("MP3 (MPEG audio layer 3)"),
.mime_type = "audio/mpeg",
.extensions = "mp3",
.priv_data_size = sizeof(MP3Context),
.audio_codec = AV_CODEC_ID_MP3,
.video_codec = AV_CODEC_ID_PNG,
.priv_class = &mp3_muxer_class,
}
static void write_packet(OutputFile *of, AVPacket *pkt, OutputStream *ost, int unqueue)
Definition: ffmpeg.c:672
static int mp3_write_trailer(struct AVFormatContext *s)
Definition: mp3enc.c:458
static int flags
Definition: log.c:57
#define NULL_IF_CONFIG_SMALL(x)
Return NULL if CONFIG_SMALL is true, otherwise the argument without modification. ...
Definition: internal.h:179
preferred ID for decoding MPEG audio layer 1, 2 or 3
Definition: avcodec.h:550
static int write_trailer(AVFormatContext *s1)
Definition: v4l2enc.c:94
static int query_codec(enum AVCodecID id, int std_compliance)
Definition: mp3enc.c:482
#define AVFMT_NOTIMESTAMPS
Format does not need / have any timestamps.
Definition: avformat.h:486
static const AVClass mp3_muxer_class
Definition: mp3enc.c:503
static int mp3_write_header(struct AVFormatContext *s)
Write an ID3v2 header at beginning of stream.
Definition: mp3enc.c:567
static void write_header(FFV1Context *f)
Definition: ffv1enc.c:337
static int mp3_write_packet(AVFormatContext *s, AVPacket *pkt)
Definition: mp3enc.c:510

Definition at line 625 of file mp3enc.c.