ismindex: Properly report errors reading the MFRA atom

Signed-off-by: Martin Storsjö <martin@martin.st>
pull/59/head
Martin Storsjö 13 years ago
parent 1a068bfefd
commit 1be8c90847
  1. 15
      tools/ismindex.c

@ -209,10 +209,14 @@ static int read_mfra(struct VideoFiles *files, int start_index,
avio_seek(f, avio_size(f) - 4, SEEK_SET); avio_seek(f, avio_size(f) - 4, SEEK_SET);
mfra_size = avio_rb32(f); mfra_size = avio_rb32(f);
avio_seek(f, -mfra_size, SEEK_CUR); avio_seek(f, -mfra_size, SEEK_CUR);
if (avio_rb32(f) != mfra_size) if (avio_rb32(f) != mfra_size) {
err = AVERROR_INVALIDDATA;
goto fail; goto fail;
if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) }
if (avio_rb32(f) != MKBETAG('m', 'f', 'r', 'a')) {
err = AVERROR_INVALIDDATA;
goto fail; goto fail;
}
while (!read_tfra(files, start_index, f)) { while (!read_tfra(files, start_index, f)) {
/* Empty */ /* Empty */
} }
@ -223,6 +227,8 @@ static int read_mfra(struct VideoFiles *files, int start_index,
fail: fail:
if (f) if (f)
avio_close(f); avio_close(f);
if (err)
fprintf(stderr, "Unable to read the MFRA atom in %s\n", file);
return err; return err;
} }
@ -355,7 +361,7 @@ static int handle_file(struct VideoFiles *files, const char *file, int split)
avformat_close_input(&ctx); avformat_close_input(&ctx);
read_mfra(files, orig_files, file, split); err = read_mfra(files, orig_files, file, split);
fail: fail:
if (ctx) if (ctx)
@ -509,7 +515,8 @@ int main(int argc, char **argv)
} else if (argv[i][0] == '-') { } else if (argv[i][0] == '-') {
return usage(argv[0], 1); return usage(argv[0], 1);
} else { } else {
handle_file(&vf, argv[i], split); if (handle_file(&vf, argv[i], split))
return 1;
} }
} }
if (!vf.nb_files || (!basename && !split)) if (!vf.nb_files || (!basename && !split))

Loading…
Cancel
Save