aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHendrik Leppkes <h.leppkes@gmail.com>2011-09-28 19:37:45 +0200
committerMichael Niedermayer <michaelni@gmx.at>2011-10-28 01:37:50 +0200
commitb76bc010343b0cff8717cc7ee81e47273272336c (patch)
treea3efdb94641dd4f8620d1745430d101ff597fe42
parent05e417aa63ef73b3c3a767c334f6c53abdb1ea20 (diff)
downloadffmpeg-b76bc010343b0cff8717cc7ee81e47273272336c.tar.gz
Implement parsing of the "HandlerName" from th MP4 HDLR atom.
This atom typically is used for a track title. (cherry picked from commit a356137816b4ea20a892d1fb203b11dbfedbc543) Reviewed-by: Baptiste Coudurier Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
-rw-r--r--libavformat/mov.c13
1 files changed, 13 insertions, 0 deletions
diff --git a/libavformat/mov.c b/libavformat/mov.c
index 03f01e05d5..62d5b3ccdb 100644
--- a/libavformat/mov.c
+++ b/libavformat/mov.c
@@ -496,6 +496,8 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
AVStream *st;
uint32_t type;
uint32_t av_unused ctype;
+ int title_size;
+ char *title_str;
if (c->fc->nb_streams < 1) // meta before first trak
return 0;
@@ -525,6 +527,17 @@ static int mov_read_hdlr(MOVContext *c, AVIOContext *pb, MOVAtom atom)
avio_rb32(pb); /* component flags */
avio_rb32(pb); /* component flags mask */
+ title_size = atom.size - 24;
+ if (title_size > 0) {
+ title_str = av_malloc(title_size + 1); /* Add null terminator */
+ if (!title_str)
+ return AVERROR(ENOMEM);
+ avio_read(pb, title_str, title_size);
+ title_str[title_size] = 0;
+ av_dict_set(&st->metadata, "handler_name", title_str, 0);
+ av_freep(&title_str);
+ }
+
return 0;
}