| 553 | } |
| 554 | |
| 555 | static int opt_map(void *optctx, const char *opt, const char *arg) |
| 556 | { |
| 557 | OptionsContext *o = optctx; |
| 558 | StreamMap *m = NULL; |
| 559 | StreamSpecifier ss; |
| 560 | int i, negative = 0, file_idx, disabled = 0; |
| 561 | int ret, allow_unused = 0; |
| 562 | |
| 563 | memset(&ss, 0, sizeof(ss)); |
| 564 | |
| 565 | if (*arg == '-') { |
| 566 | negative = 1; |
| 567 | arg++; |
| 568 | } |
| 569 | |
| 570 | if (arg[0] == '[') { |
| 571 | ViewSpecifier vs; |
| 572 | /* this mapping refers to lavfi output */ |
| 573 | const char *c = arg + 1; |
| 574 | char *endptr; |
| 575 | |
| 576 | ret = GROW_ARRAY(o->stream_maps, o->nb_stream_maps); |
| 577 | if (ret < 0) |
| 578 | goto fail; |
| 579 | |
| 580 | m = &o->stream_maps[o->nb_stream_maps - 1]; |
| 581 | m->linklabel = av_get_token(&c, "]"); |
| 582 | if (!m->linklabel) { |
| 583 | av_log(NULL, AV_LOG_ERROR, "Invalid output link label: %s.\n", arg); |
| 584 | ret = AVERROR(EINVAL); |
| 585 | goto fail; |
| 586 | } |
| 587 | |
| 588 | arg++; |
| 589 | |
| 590 | m->group_index = -1; |
| 591 | file_idx = strtol(arg, &endptr, 0); |
| 592 | if (file_idx >= nb_input_files || file_idx < 0) |
| 593 | goto end; |
| 594 | |
| 595 | arg = endptr; |
| 596 | ret = stream_specifier_parse(&ss, *arg == ':' ? arg + 1 : arg, 1, NULL); |
| 597 | if (ret < 0) |
| 598 | goto end; |
| 599 | |
| 600 | arg = ss.remainder ? ss.remainder : ""; |
| 601 | ret = view_specifier_parse(&arg, &vs); |
| 602 | if (ret < 0 || (*arg && strcmp(arg, "]"))) |
| 603 | goto end; |
| 604 | |
| 605 | m->file_index = file_idx; |
| 606 | m->stream_index = ss.idx; |
| 607 | m->group_index = ss.stream_list == STREAM_LIST_GROUP_IDX ? ss.list_id : -1; |
| 608 | } else { |
| 609 | ViewSpecifier vs; |
| 610 | char *endptr; |
| 611 | |
| 612 | file_idx = strtol(arg, &endptr, 0); |
nothing calls this directly
no test coverage detected