MCPcopy Create free account
hub / github.com/FFmpeg/FFmpeg / avi_read_header

Function avi_read_header

libavformat/avidec.c:508–1118  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

506}
507
508static int avi_read_header(AVFormatContext *s)
509{
510 AVIContext *avi = s->priv_data;
511 AVIOContext *pb = s->pb;
512 unsigned int tag, tag1, handler;
513 int codec_type, stream_index, frame_period;
514 unsigned int size;
515 int i;
516 AVStream *st;
517 AVIStream *ast = NULL;
518 int avih_width = 0, avih_height = 0;
519 int amv_file_format = 0;
520 uint64_t list_end = 0;
521 int64_t pos;
522 int ret;
523 AVDictionaryEntry *dict_entry;
524
525 avi->stream_index = -1;
526
527 ret = get_riff(s, pb);
528 if (ret < 0)
529 return ret;
530
531 av_log(avi, AV_LOG_DEBUG, "use odml:%d\n", avi->use_odml);
532
533 avi->io_fsize = avi->fsize = avio_size(pb);
534 if (avi->fsize <= 0 || avi->fsize < avi->riff_end)
535 avi->fsize = avi->riff_end == 8 ? INT64_MAX : avi->riff_end;
536
537 /* first list tag */
538 stream_index = -1;
539 codec_type = -1;
540 frame_period = 0;
541 for (;;) {
542 if (avio_feof(pb))
543 return AVERROR_INVALIDDATA;
544 tag = avio_rl32(pb);
545 size = avio_rl32(pb);
546
547 print_tag(s, "tag", tag, size);
548
549 switch (tag) {
550 case MKTAG('L', 'I', 'S', 'T'):
551 list_end = avio_tell(pb) + size;
552 /* Ignored, except at start of video packets. */
553 tag1 = avio_rl32(pb);
554
555 print_tag(s, "list", tag1, 0);
556
557 if (tag1 == MKTAG('m', 'o', 'v', 'i')) {
558 avi->movi_list = avio_tell(pb) - 4;
559 if (size)
560 avi->movi_end = avi->movi_list + size + (size & 1);
561 else
562 avi->movi_end = avi->fsize;
563 av_log(s, AV_LOG_TRACE, "movi end=%"PRIx64"\n", avi->movi_end);
564 goto end_of_header;
565 } else if (tag1 == MKTAG('I', 'N', 'F', 'O')) {

Callers

nothing calls this directly

Calls 15

get_riffFunction · 0.85
av_logFunction · 0.85
avio_sizeFunction · 0.85
avio_feofFunction · 0.85
avio_rl32Function · 0.85
avio_tellFunction · 0.85
ff_read_riff_infoFunction · 0.85
avi_read_nikonFunction · 0.85
avio_readFunction · 0.85
avio_skipFunction · 0.85
avformat_new_streamFunction · 0.85

Tested by

no test coverage detected