Revision 7a9af8ec libavformat/avidec.c

View differences:

libavformat/avidec.c
227 227
    }
228 228
}
229 229

  
230
static int avi_read_tag(AVFormatContext *s, const char *key, unsigned int size)
230
static int avi_read_tag(AVFormatContext *s, AVStream *st, const char *key, unsigned int size)
231 231
{
232 232
    ByteIOContext *pb = s->pb;
233 233
    char *value;
......
239 239
    value = av_malloc(size+1);
240 240
    if (!value)
241 241
        return -1;
242
    get_strz(pb, value, size);
242
    get_buffer(pb, value, size);
243
    value[size]=0;
243 244

  
245
    if(st)
246
        return av_metadata_set2(&st->metadata, key, value,
247
                                    AV_METADATA_DONT_STRDUP_VAL);
248
    else
244 249
    return av_metadata_set2(&s->metadata, key, value,
245 250
                                  AV_METADATA_DONT_STRDUP_VAL);
246 251
}
......
602 607
            url_fseek(pb, size, SEEK_CUR);
603 608
            break;
604 609
        case MKTAG('I', 'N', 'A', 'M'):
605
            avi_read_tag(s, "Title", size);
610
            avi_read_tag(s, NULL, "Title", size);
606 611
            break;
607 612
        case MKTAG('I', 'A', 'R', 'T'):
608
            avi_read_tag(s, "Artist", size);
613
            avi_read_tag(s, NULL, "Artist", size);
609 614
            break;
610 615
        case MKTAG('I', 'C', 'O', 'P'):
611
            avi_read_tag(s, "Copyright", size);
616
            avi_read_tag(s, NULL, "Copyright", size);
612 617
            break;
613 618
        case MKTAG('I', 'C', 'M', 'T'):
614
            avi_read_tag(s, "Comment", size);
619
            avi_read_tag(s, NULL, "Comment", size);
615 620
            break;
616 621
        case MKTAG('I', 'G', 'N', 'R'):
617
            avi_read_tag(s, "Genre", size);
622
            avi_read_tag(s, NULL, "Genre", size);
618 623
            break;
619 624
        case MKTAG('I', 'P', 'R', 'D'):
620
            avi_read_tag(s, "Album", size);
625
            avi_read_tag(s, NULL, "Album", size);
621 626
            break;
622 627
        case MKTAG('I', 'P', 'R', 'T'):
623
            avi_read_tag(s, "Track", size);
628
            avi_read_tag(s, NULL, "Track", size);
624 629
            break;
630
        case MKTAG('s', 't', 'r', 'n'):
631
            if(s->nb_streams){
632
                avi_read_tag(s, s->streams[s->nb_streams-1], "Title", size);
633
                break;
634
            }
625 635
        default:
626 636
            if(size > 1000000){
627 637
                av_log(s, AV_LOG_ERROR, "Something went wrong during header parsing, "

Also available in: Unified diff