Browse code

vorbiscomment: convert metadata before computing the header's length

Originally committed as revision 25586 to svn://svn.ffmpeg.org/ffmpeg/trunk

Anton Khirnov authored on 2010/10/27 14:02:29
Showing 3 changed files
... ...
@@ -46,6 +46,8 @@ static int flac_write_block_comment(ByteIOContext *pb, AVMetadata **m,
46 46
     unsigned int len, count;
47 47
     uint8_t *p, *p0;
48 48
 
49
+    ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
50
+
49 51
     len = ff_vorbiscomment_length(*m, vendor, &count);
50 52
     p0 = av_malloc(len+4);
51 53
     if (!p0)
... ...
@@ -213,6 +213,8 @@ static uint8_t *ogg_write_vorbiscomment(int offset, int bitexact,
213 213
     uint8_t *p, *p0;
214 214
     unsigned int count;
215 215
 
216
+    ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
217
+
216 218
     size = offset + ff_vorbiscomment_length(*m, vendor, &count) + framing_bit;
217 219
     p = av_mallocz(size);
218 220
     if (!p)
... ...
@@ -55,7 +55,6 @@ int ff_vorbiscomment_length(AVMetadata *m, const char *vendor_string,
55 55
 int ff_vorbiscomment_write(uint8_t **p, AVMetadata **m,
56 56
                            const char *vendor_string, const unsigned count)
57 57
 {
58
-    ff_metadata_conv(m, ff_vorbiscomment_metadata_conv, NULL);
59 58
     bytestream_put_le32(p, strlen(vendor_string));
60 59
     bytestream_put_buffer(p, vendor_string, strlen(vendor_string));
61 60
     if (*m) {