Revision f702df39 libavformat/matroskadec.c

View differences:

libavformat/matroskadec.c
176 176
typedef struct {
177 177
    char *name;
178 178
    char *string;
179
    char *lang;
180
    uint64_t def;
179 181
    EbmlList sub;
180 182
} MatroskaTag;
181 183

  
......
418 420
static EbmlSyntax matroska_simpletag[] = {
419 421
    { MATROSKA_ID_TAGNAME,            EBML_UTF8, 0, offsetof(MatroskaTag,name) },
420 422
    { MATROSKA_ID_TAGSTRING,          EBML_UTF8, 0, offsetof(MatroskaTag,string) },
423
    { MATROSKA_ID_TAGLANG,            EBML_STR,  0, offsetof(MatroskaTag,lang), {.s="und"} },
424
    { MATROSKA_ID_TAGDEFAULT,         EBML_UINT, 0, offsetof(MatroskaTag,def) },
421 425
    { MATROSKA_ID_SIMPLETAG,          EBML_NEST, sizeof(MatroskaTag), offsetof(MatroskaTag,sub), {.n=matroska_simpletag} },
422
    { MATROSKA_ID_TAGLANG,            EBML_NONE },
423
    { MATROSKA_ID_TAGDEFAULT,         EBML_NONE },
424 426
    { 0 }
425 427
};
426 428

  
......
990 992
    int i;
991 993

  
992 994
    for (i=0; i < list->nb_elem; i++) {
995
        const char *lang = strcmp(tags[i].lang, "und") ? tags[i].lang : NULL;
993 996
        if (prefix)  snprintf(key, sizeof(key), "%s/%s", prefix, tags[i].name);
994 997
        else         av_strlcpy(key, tags[i].name, sizeof(key));
998
        if (tags[i].def || !lang) {
995 999
        av_metadata_set(metadata, key, tags[i].string);
996 1000
        if (tags[i].sub.nb_elem)
997 1001
            matroska_convert_tag(s, &tags[i].sub, metadata, key);
1002
        }
1003
        if (lang) {
1004
            av_strlcat(key, "-", sizeof(key));
1005
            av_strlcat(key, lang, sizeof(key));
1006
            av_metadata_set(metadata, key, tags[i].string);
1007
            if (tags[i].sub.nb_elem)
1008
                matroska_convert_tag(s, &tags[i].sub, metadata, key);
1009
        }
998 1010
    }
999 1011
}
1000 1012

  

Also available in: Unified diff