Revision 47146dfb libavformat/avidec.c

View differences:

libavformat/avidec.c
216 216
    }
217 217
}
218 218

  
219
static int avi_read_tag(ByteIOContext *pb, char *buf, int maxlen,  unsigned int size)
219
static int avi_read_tag(AVFormatContext *s, const char *key, unsigned int size)
220 220
{
221
    ByteIOContext *pb = s->pb;
222
    uint8_t value[1024];
223

  
221 224
    int64_t i = url_ftell(pb);
222 225
    size += (size & 1);
223
    get_strz(pb, buf, maxlen);
226
    get_strz(pb, value, sizeof(value));
224 227
    url_fseek(pb, i+size, SEEK_SET);
225
    return 0;
228

  
229
    return av_metadata_set(&s->meta_data, (const AVMetaDataTag){key, value});
226 230
}
227 231

  
228 232
static int avi_read_header(AVFormatContext *s, AVFormatParameters *ap)
......
235 239
    int i;
236 240
    AVStream *st;
237 241
    AVIStream *ast = NULL;
238
    char str_track[4];
239 242
    int avih_width=0, avih_height=0;
240 243
    int amv_file_format=0;
241 244

  
......
561 564
            url_fseek(pb, size, SEEK_CUR);
562 565
            break;
563 566
        case MKTAG('I', 'N', 'A', 'M'):
564
            avi_read_tag(pb, s->title, sizeof(s->title), size);
567
            avi_read_tag(s, "Title", size);
565 568
            break;
566 569
        case MKTAG('I', 'A', 'R', 'T'):
567
            avi_read_tag(pb, s->author, sizeof(s->author), size);
570
            avi_read_tag(s, "Artist", size);
568 571
            break;
569 572
        case MKTAG('I', 'C', 'O', 'P'):
570
            avi_read_tag(pb, s->copyright, sizeof(s->copyright), size);
573
            avi_read_tag(s, "Copyright", size);
571 574
            break;
572 575
        case MKTAG('I', 'C', 'M', 'T'):
573
            avi_read_tag(pb, s->comment, sizeof(s->comment), size);
576
            avi_read_tag(s, "Comment", size);
574 577
            break;
575 578
        case MKTAG('I', 'G', 'N', 'R'):
576
            avi_read_tag(pb, s->genre, sizeof(s->genre), size);
579
            avi_read_tag(s, "Genre", size);
577 580
            break;
578 581
        case MKTAG('I', 'P', 'R', 'D'):
579
            avi_read_tag(pb, s->album, sizeof(s->album), size);
582
            avi_read_tag(s, "Album", size);
580 583
            break;
581 584
        case MKTAG('I', 'P', 'R', 'T'):
582
            avi_read_tag(pb, str_track, sizeof(str_track), size);
583
            sscanf(str_track, "%d", &s->track);
585
            avi_read_tag(s, "Track", size);
584 586
            break;
585 587
        default:
586 588
            if(size > 1000000){

Also available in: Unified diff