Commit 042ca05f authored by Anton Khirnov's avatar Anton Khirnov

vorbiscomment: convert metadata before computing the header's length

Originally committed as revision 25586 to svn://svn.ffmpeg.org/ffmpeg/trunk
parent 47bfe49c
......@@ -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)
......
......@@ -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)
......
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment