--- libavfilter/avfiltergraph.c | 64 +++++++++++++++++++++++++++++++++++++ 1 file changed, 64 insertions(+)
diff --git a/libavfilter/avfiltergraph.c b/libavfilter/avfiltergraph.c index c6472876bf..24d8201f9c 100644 --- a/libavfilter/avfiltergraph.c +++ b/libavfilter/avfiltergraph.c @@ -437,6 +437,69 @@ static int formats_declared(AVFilterContext *f) return 1; } +static void display_channel_layouts(AVBPrint *buf, const char *name, + AVFilterChannelLayouts *chs) +{ + char layout[128]; + int i; + + av_bprintf(buf, "%32s chs:", name); + if (chs->all_layouts) + av_bprintf(buf, " all-layouts"); + if (chs->all_counts) + av_bprintf(buf, " all-counts"); + for (i = 0; i < chs->nb_channel_layouts; i++) { + av_channel_layout_describe(&chs->channel_layouts[i], layout, sizeof(layout)); + av_bprintf(buf, " %s", layout); + } + av_bprintf(buf, "\n"); +} + +static void display_samplerates(AVBPrint *buf, const char *name, + AVFilterFormats *rates) +{ + int i; + + av_bprintf(buf, "%32s rates:", name); + for (i = 0; i < rates->nb_formats; i++) + av_bprintf(buf, " %d", rates->formats[i]); + av_bprintf(buf, "\n"); +} + +static void display_formats(AVBPrint *buf, const char *name, + AVFilterFormats *fmts, int media_type) +{ + int i; + + av_bprintf(buf, "%32s fmts:", name); + for (i = 0; i < fmts->nb_formats; i++) + av_bprintf(buf, " %s", + media_type == AVMEDIA_TYPE_AUDIO ? av_get_sample_fmt_name(fmts->formats[i]) : av_get_pix_fmt_name(fmts->formats[i])); + av_bprintf(buf, "\n"); +} + +static void display_link_formats(AVFilterLink *link) +{ + AVBPrint buf; + + av_bprint_init(&buf, 0, AV_BPRINT_SIZE_AUTOMATIC); + + switch (link->type) { + case AVMEDIA_TYPE_AUDIO: + display_channel_layouts(&buf, link->src->name, link->incfg.channel_layouts); + display_channel_layouts(&buf, link->dst->name, link->outcfg.channel_layouts); + display_samplerates(&buf, link->src->name, link->incfg.samplerates); + display_samplerates(&buf, link->dst->name, link->outcfg.samplerates); + case AVMEDIA_TYPE_VIDEO: /* fallthrough */ + display_formats(&buf, link->src->name, link->incfg.formats, link->type); + display_formats(&buf, link->dst->name, link->outcfg.formats, link->type); + break; + } + + av_log(NULL, AV_LOG_INFO, "\n%s", buf.str); + av_bprint_finalize(&buf, NULL); +} + /** * Perform one round of query_formats() and merging formats lists on the * filter graph. @@ -516,6 +579,7 @@ static int query_formats(AVFilterGraph *graph, void *log_ctx) char inst_name[30]; const char *opts; + display_link_formats(link); if (fffiltergraph(graph)->disable_auto_convert) { av_log(log_ctx, AV_LOG_ERROR, "The filters '%s' and '%s' do not have a common format " -- 2.34.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-requ...@ffmpeg.org with subject "unsubscribe".