OSDN Git Service

vorbiscomment: convert metadata before computing the header's length
authorAnton Khirnov <wyskas@gmail.com>
Wed, 27 Oct 2010 05:02:29 +0000 (05:02 +0000)
committerAnton Khirnov <wyskas@gmail.com>
Wed, 27 Oct 2010 05:02:29 +0000 (05:02 +0000)
Originally committed as revision 25586 to svn://svn.ffmpeg.org/ffmpeg/trunk

libavformat/flacenc.c
libavformat/oggenc.c
libavformat/vorbiscomment.c

index 996d9f4..281d013 100644 (file)
@@ -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)
index 7ec1b3e..8f6ba69 100644 (file)
@@ -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)
index d141b9d..59a403f 100644 (file)
@@ -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) {