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

Function read_mfra

tools/ismindex.c:412–451  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

410}
411
412static int read_mfra(struct Tracks *tracks, int start_index,
413 const char *file, int split, int ismf,
414 const char *basename, const char* output_prefix)
415{
416 int err = 0;
417 const char* err_str = "";
418 AVIOContext *f = NULL;
419 int32_t mfra_size;
420
421 if ((err = avio_open2(&f, file, AVIO_FLAG_READ, NULL, NULL)) < 0)
422 goto fail;
423 avio_seek(f, avio_size(f) - 4, SEEK_SET);
424 mfra_size = avio_rb32(f);
425 avio_seek(f, -mfra_size, SEEK_CUR);
426 if (avio_rb32(f) != mfra_size) {
427 err = AVERROR_INVALIDDATA;
428 err_str = "mfra size mismatch";
429 goto fail;
430 }
431 if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) {
432 err = AVERROR_INVALIDDATA;
433 err_str = "mfra tag mismatch";
434 goto fail;
435 }
436 while (!read_tfra(tracks, start_index, f)) {
437 /* Empty */
438 }
439
440 if (split || ismf)
441 err = write_fragments(tracks, start_index, f, basename, split, ismf,
442 output_prefix);
443 err_str = "error in write_fragments";
444
445fail:
446 if (f)
447 avio_close(f);
448 if (err)
449 fprintf(stderr, "Unable to read the MFRA atom in %s (%s)\n", file, err_str);
450 return err;
451}
452
453static int get_private_data(struct Track *track, AVCodecParameters *codecpar)
454{

Callers 1

handle_fileFunction · 0.85

Calls 7

avio_open2Function · 0.85
avio_seekFunction · 0.85
avio_sizeFunction · 0.85
avio_rb32Function · 0.85
write_fragmentsFunction · 0.85
avio_closeFunction · 0.85
read_tfraFunction · 0.70

Tested by

no test coverage detected