"user interface" functions */
| 589 | |
| 590 | /* "user interface" functions */ |
| 591 | static void dump_stream_format(const AVFormatContext *ic, int i, |
| 592 | int group_index, int index, int is_output, |
| 593 | int log_level) |
| 594 | { |
| 595 | char buf[256]; |
| 596 | int flags = (is_output ? ic->oformat->flags : ic->iformat->flags); |
| 597 | const AVStream *st = ic->streams[i]; |
| 598 | const FFStream *const sti = cffstream(st); |
| 599 | const AVDictionaryEntry *lang = av_dict_get(st->metadata, "language", NULL, 0); |
| 600 | const char *separator = ic->dump_separator; |
| 601 | const char *group_indent = group_index >= 0 ? " " : ""; |
| 602 | const char *extra_indent = group_index >= 0 ? " " : " "; |
| 603 | AVCodecContext *avctx; |
| 604 | int ret; |
| 605 | |
| 606 | avctx = avcodec_alloc_context3(NULL); |
| 607 | if (!avctx) |
| 608 | return; |
| 609 | |
| 610 | ret = avcodec_parameters_to_context(avctx, st->codecpar); |
| 611 | if (ret < 0) { |
| 612 | avcodec_free_context(&avctx); |
| 613 | return; |
| 614 | } |
| 615 | |
| 616 | // Fields which are missing from AVCodecParameters need to be taken from the AVCodecContext |
| 617 | if (sti->avctx) { |
| 618 | #if FF_API_CODEC_PROPS |
| 619 | FF_DISABLE_DEPRECATION_WARNINGS |
| 620 | avctx->properties = sti->avctx->properties; |
| 621 | FF_ENABLE_DEPRECATION_WARNINGS |
| 622 | #endif |
| 623 | avctx->codec = sti->avctx->codec; |
| 624 | avctx->qmin = sti->avctx->qmin; |
| 625 | avctx->qmax = sti->avctx->qmax; |
| 626 | avctx->coded_width = sti->avctx->coded_width; |
| 627 | avctx->coded_height = sti->avctx->coded_height; |
| 628 | } |
| 629 | |
| 630 | if (separator) |
| 631 | av_opt_set(avctx, "dump_separator", separator, 0); |
| 632 | avcodec_string(buf, sizeof(buf), avctx, is_output); |
| 633 | avcodec_free_context(&avctx); |
| 634 | |
| 635 | av_log(NULL, log_level, "%s Stream #%d", group_indent, index); |
| 636 | av_log(NULL, log_level, ":%d", i); |
| 637 | |
| 638 | /* the pid is an important information, so we display it */ |
| 639 | /* XXX: add a generic system */ |
| 640 | if (flags & AVFMT_SHOW_IDS) |
| 641 | av_log(NULL, log_level, "[0x%x]", st->id); |
| 642 | if (lang) |
| 643 | av_log(NULL, log_level, "(%s)", lang->value); |
| 644 | av_log(NULL, AV_LOG_DEBUG, ", %d, %d/%d", sti->codec_info_nb_frames, |
| 645 | st->time_base.num, st->time_base.den); |
| 646 | av_log(NULL, log_level, ": %s", buf); |
| 647 | |
| 648 | if (st->sample_aspect_ratio.num && |
no test coverage detected