summaryrefslogtreecommitdiff
path: root/libavformat/movenc.c
diff options
context:
space:
mode:
authorJohn Stebbins <stebbins@jetheaddev.com>2014-07-31 11:51:40 -0700
committerJohn Stebbins <stebbins@jetheaddev.com>2014-08-06 13:27:17 -0700
commitb50173a4dd47b9c3c89845b781fa958ccf860929 (patch)
tree249382aff68e4d2beeb601a35a013c5fb0e1d657 /libavformat/movenc.c
parentda9cc22d5bd5f59756c2037b02966376da2cf323 (diff)
movenc: fix QT chapter track character encoding
An encoding ("encd") box is required to tell QT that the string is UTF8
Diffstat (limited to 'libavformat/movenc.c')
-rw-r--r--libavformat/movenc.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/libavformat/movenc.c b/libavformat/movenc.c
index c9b0f6e666..4d487e979e 100644
--- a/libavformat/movenc.c
+++ b/libavformat/movenc.c
@@ -3196,13 +3196,18 @@ static int mov_create_chapter_track(AVFormatContext *s, int tracknum)
pkt.duration = end - pkt.dts;
if ((t = av_dict_get(c->metadata, "title", NULL, 0))) {
+ const char encd[12] = {
+ 0x00, 0x00, 0x00, 0x0C,
+ 'e', 'n', 'c', 'd',
+ 0x00, 0x00, 0x01, 0x00 };
len = strlen(t->value);
- pkt.size = len + 2;
+ pkt.size = len + 2 + 12;
pkt.data = av_malloc(pkt.size);
if (!pkt.data)
return AVERROR(ENOMEM);
AV_WB16(pkt.data, len);
memcpy(pkt.data + 2, t->value, len);
+ memcpy(pkt.data + len + 2, encd, sizeof(encd));
ff_mov_write_packet(s, &pkt);
av_freep(&pkt.data);
}