61 buf[126] = atoi(tag->
value);
77 #define XING_NUM_BAGS 400
78 #define XING_TOC_SIZE 100
80 #define XING_MAX_SIZE (32 + 4 + 4 + 4 + 4 + XING_TOC_SIZE)
119 int srate_idx, i, channels;
131 else if (codec->
sample_rate == base_freq / 2) ver = 0x2;
132 else if (codec->
sample_rate == base_freq / 4) ver = 0x0;
148 "not writing Xing header.\n");
153 bitrate_idx = (ver == 3) ? 5 : 8;
157 header |= (0x7 << 5 | ver << 3 | 0x1 << 1 | 0x1) << 16;
158 header |= (bitrate_idx << 4 | srate_idx << 2) << 8;
159 header |= channels << 6;
172 mp3->
size = mpah.frame_size;
182 mpah.frame_size -= 4 + xing_offset + 4 + 4 + 4 + 4 +
XING_TOC_SIZE;
204 mp3->
bag[i / 2] = mp3->
bag[i];
209 mp3->
pos = XING_NUM_BAGS / 2;
240 int ret = 0, write = 1;
245 while ((pktl = mp3->
queue)) {
275 int seek_point = 256LL * mp3->
bag[j] / mp3->
size;
289 "attached pictures.\n");
308 .mime_type =
"audio/x-mpeg",
309 .extensions =
"mp2,m2a",
320 {
"id3v2_version",
"Select ID3v2 version to write. Currently 3 and 4 are supported.",
322 {
"write_id3v1",
"Enable ID3v1 writing. ID3v1 tags are written in UTF-8 which may not be supported by most software.",
327 static const AVClass mp3_muxer_class = {
360 av_log(s, AV_LOG_WARNING,
"Got more than one picture in stream %d,"
395 av_log(s, AV_LOG_ERROR,
"Invalid audio stream. Exactly one MP3 "
396 "audio stream is required.\n");
401 av_log(s, AV_LOG_ERROR,
"Only audio streams and pictures are allowed in MP3.\n");
406 av_log(s, AV_LOG_ERROR,
"No audio stream present.\n");
427 .mime_type =
"audio/x-mpeg",
435 .
flags = AVFMT_NOTIMESTAMPS,
436 .priv_class = &mp3_muxer_class,