| 410 | } |
| 411 | |
| 412 | static 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 | |
| 445 | fail: |
| 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 | |
| 453 | static int get_private_data(struct Track *track, AVCodecParameters *codecpar) |
| 454 | { |
no test coverage detected