Browse Source

Implement parsing of the "HandlerName" from th MP4 HDLR atom.

This atom typically is used for a track title.
(cherry picked from commit a356137816)

Reviewed-by: Baptiste Coudurier
Signed-off-by: Michael Niedermayer <michaelni@gmx.at>
tags/n0.9
Hendrik Leppkes Michael Niedermayer 13 years ago
parent
commit
b76bc01034
1 changed files with 13 additions and 0 deletions
  1. +13
    -0
      libavformat/mov.c

+ 13
- 0
libavformat/mov.c View File

@@ -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;
}



Loading…
Cancel
Save