@@ -3461,7 +3461,7 @@ static int mov_write_int8_metadata(AVFormatContext *s, AVIOContext *pb,
uint8_t num;
int size = 24 + len;
- if (len != 1 && len != 4)
+ if (len != 1 && len != 2 && len != 4)
return -1;
if (!(t = av_dict_get(s->metadata, tag, NULL, 0)))
@@ -3470,12 +3470,14 @@ static int mov_write_int8_metadata(AVFormatContext *s, AVIOContext *pb,
avio_wb32(pb, size);
ffio_wfourcc(pb, name);
- avio_wb32(pb, size - 8);
+ avio_wb32(pb, size - 8); // size
ffio_wfourcc(pb, "data");
- avio_wb32(pb, 0x15);
+ avio_wb32(pb, 0x15); // type specifier
avio_wb32(pb, 0);
- if (len==4) avio_wb32(pb, num);
- else avio_w8 (pb, num);
+ // data:
+ if (len == 4) avio_wb32(pb, num);
+ else if (len == 2) avio_wb16(pb, num);
+ else avio_w8 (pb, num);
return size;
}
Padding to four bytes was already possible. This is in preparation for being able to also write 16-bit integer atoms (and other currently unneeded scenarios). Signed-off-by: Moritz Barsnick <barsnick@gmx.net> --- libavformat/movenc.c | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-)