[FFmpeg-devel] [PATCH] vorbiscomment: convert metadata before computing the header's length

Anton Khirnov anton
Tue Oct 26 23:31:45 CEST 2010


---
 libavformat/flacenc.c       |    2 ++
 libavformat/oggenc.c        |    2 ++
 libavformat/vorbiscomment.c |    1 -
 3 files changed, 4 insertions(+), 1 deletions(-)

diff --git a/libavformat/flacenc.c b/libavformat/flacenc.c
index 996d9f4..281d013 100644
--- a/libavformat/flacenc.c
+++ b/libavformat/flacenc.c
@@ -46,6 +46,8 @@ static int flac_write_block_comment(ByteIOContext *pb, AVMetadata **m,
     unsigned int len, count;
     uint8_t *p, *p0;
 
+    ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
+
     len = ff_vorbiscomment_length(*m, vendor, &count);
     p0 = av_malloc(len+4);
     if (!p0)
diff --git a/libavformat/oggenc.c b/libavformat/oggenc.c
index 7ec1b3e..8f6ba69 100644
--- a/libavformat/oggenc.c
+++ b/libavformat/oggenc.c
@@ -213,6 +213,8 @@ static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact,
     uint8_t *p, *p0;
     unsigned int count;
 
+    ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
+
     size = offset + ff_vorbiscomment_length(*m, vendor, &count) + framing_bit;
     p = av_mallocz(size);
     if (!p)
diff --git a/libavformat/vorbiscomment.c b/libavformat/vorbiscomment.c
index d141b9d..59a403f 100644
--- a/libavformat/vorbiscomment.c
+++ b/libavformat/vorbiscomment.c
@@ -55,7 +55,6 @@ int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string,
 int ff_vorbiscomment_write(uint8_t **p, AVMetadata **m,
                            const char *vendor_string, const unsigned count)
 {
-    ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
     bytestream_put_le32(p, strlen(vendor_string));
     bytestream_put_buffer(p, vendor_string, strlen(vendor_string));
     if (*m) {
-- 
1.7.1




More information about the ffmpeg-devel mailing list