summaryrefslogtreecommitdiff
path: root/libavformat/mp3enc.c
diff options
context:
space:
mode:
authorMichael Niedermayer <michaelni@gmx.at>2012-07-04 22:22:18 +0200
committerMichael Niedermayer <michaelni@gmx.at>2012-07-14 17:20:22 +0200
commit57d5a224cec3d2f8e2c6c1140d312f17ed340740 (patch)
tree496de9dc1d99e1c6572d8197b4ec6583c46eb315 /libavformat/mp3enc.c
parent7b521c52c41471fa682a90248632d0d0d7333e59 (diff)
downloadffmpeg-57d5a224cec3d2f8e2c6c1140d312f17ed340740.tar.gz
mp3enc: add lame tag with start padding info
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
Diffstat (limited to 'libavformat/mp3enc.c')
-rw-r--r--libavformat/mp3enc.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/libavformat/mp3enc.c b/libavformat/mp3enc.c
index 8a9f788faa..cc99e77a51 100644
--- a/libavformat/mp3enc.c
+++ b/libavformat/mp3enc.c
@@ -123,6 +123,7 @@ static int mp3_write_xing(AVFormatContext *s)
MPADecodeHeader c;
int srate_idx, ver = 0, i, channels;
int needed;
+ const char *vendor = (codec->flags & CODEC_FLAG_BITEXACT) ? "Lavf" : LIBAVFORMAT_IDENT;
if (!s->pb->seekable)
return 0;
@@ -177,7 +178,9 @@ static int mp3_write_xing(AVFormatContext *s)
+ 4 // frames/size/toc flags
+ 4 // frames
+ 4 // size
- + VBR_TOC_SIZE; // toc
+ + VBR_TOC_SIZE // toc
+ + 24
+ ;
if (needed <= c.frame_size)
break;
@@ -202,6 +205,12 @@ static int mp3_write_xing(AVFormatContext *s)
for (i = 0; i < VBR_TOC_SIZE; ++i)
avio_w8(s->pb, (uint8_t)(255 * i / VBR_TOC_SIZE));
+ for (i = 0; i < strlen(vendor); ++i)
+ avio_w8(s->pb, vendor[i]);
+ for (; i < 21; ++i)
+ avio_w8(s->pb, 0);
+ avio_wb24(s->pb, FFMAX(codec->delay - 528 - 1, 0)<<12);
+
ffio_fill(s->pb, 0, c.frame_size - needed);
avio_flush(s->pb);