Revision d2ace376 libavformat/mov.c

View differences:

libavformat/mov.c
1036 1036
    return mov_read_default(c, pb, atom);
1037 1037
}
1038 1038

  
1039
static void mov_parse_udta_string(ByteIOContext *pb, char *str, int size)
1040
{
1041
    uint16_t str_size = get_be16(pb); /* string length */;
1042

  
1043
    get_be16(pb); /* skip language */
1044
    get_buffer(pb, str, FFMIN(size, str_size));
1045
}
1046

  
1047
static int mov_read_udta(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
1048
{
1049
    uint64_t end = url_ftell(pb) + atom.size;
1050

  
1051
    while (url_ftell(pb) + 8 < end) {
1052
        uint32_t tag_size = get_be32(pb);
1053
        uint32_t tag      = get_le32(pb);
1054
        uint64_t next     = url_ftell(pb) + tag_size - 8;
1055

  
1056
        switch (tag) {
1057
        case MKTAG(0xa9,'n','a','m'):
1058
            mov_parse_udta_string(pb, c->fc->title,     sizeof(c->fc->title));
1059
            break;
1060
        case MKTAG(0xa9,'w','r','t'):
1061
            mov_parse_udta_string(pb, c->fc->author,    sizeof(c->fc->author));
1062
            break;
1063
        case MKTAG(0xa9,'c','p','y'):
1064
            mov_parse_udta_string(pb, c->fc->copyright, sizeof(c->fc->copyright));
1065
            break;
1066
        case MKTAG(0xa9,'i','n','f'):
1067
            mov_parse_udta_string(pb, c->fc->comment,   sizeof(c->fc->comment));
1068
            break;
1069
        default:
1070
            break;
1071
        }
1072

  
1073
        url_fseek(pb, next, SEEK_SET);
1074
    }
1075

  
1076
    return 0;
1077
}
1078

  
1039 1079
static int mov_read_tkhd(MOVContext *c, ByteIOContext *pb, MOV_atom_t atom)
1040 1080
{
1041 1081
    AVStream *st = c->fc->streams[c->fc->nb_streams-1];
......
1200 1240
{ MKTAG( 's', 't', 't', 's' ), mov_read_stts },
1201 1241
{ MKTAG( 't', 'k', 'h', 'd' ), mov_read_tkhd }, /* track header */
1202 1242
{ MKTAG( 't', 'r', 'a', 'k' ), mov_read_trak },
1243
{ MKTAG( 'u', 'd', 't', 'a' ), mov_read_udta },
1203 1244
{ MKTAG( 'w', 'a', 'v', 'e' ), mov_read_wave },
1204 1245
{ MKTAG( 'e', 's', 'd', 's' ), mov_read_esds },
1205 1246
{ MKTAG( 'w', 'i', 'd', 'e' ), mov_read_wide }, /* place holder */

Also available in: Unified diff