From patchwork Thu Mar 2 08:53:06 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: wm4 X-Patchwork-Id: 2724 Delivered-To: ffmpegpatchwork@gmail.com Received: by 10.103.31.14 with SMTP id f14csp153779vsf; Thu, 2 Mar 2017 00:53:57 -0800 (PST) X-Received: by 10.223.144.1 with SMTP id h1mr1553245wrh.26.1488444837174; Thu, 02 Mar 2017 00:53:57 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id c12si9843715wrd.245.2017.03.02.00.53.56; Thu, 02 Mar 2017 00:53:57 -0800 (PST) Received-SPF: pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) client-ip=79.124.17.100; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@googlemail.com; spf=pass (google.com: domain of ffmpeg-devel-bounces@ffmpeg.org designates 79.124.17.100 as permitted sender) smtp.mailfrom=ffmpeg-devel-bounces@ffmpeg.org; dmarc=fail (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=googlemail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0BA0F688398; Thu, 2 Mar 2017 10:53:15 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-wm0-f67.google.com (mail-wm0-f67.google.com [74.125.82.67]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6CAF768837E for ; Thu, 2 Mar 2017 10:53:08 +0200 (EET) Received: by mail-wm0-f67.google.com with SMTP id m70so11212511wma.1 for ; Thu, 02 Mar 2017 00:53:19 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=googlemail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=eHmaa52ts10B3izGvXZLxVuepfdGDUeEpni6p3AC59I=; b=BbdqCsHQ1l/Q94kKIS6dcb5LhydDxL6KRDjxC5PCGmkor714OegxrDqnqs+bNUyHQb d6CKRR75nm2j7icg36U/YjoeW5y7bOPbNhi3b0lxrjR5AFtjx0G/cpqVB+P9z6ViAluS 1VI6Cn/a66tVd9IvEFmxGst7iU8QC3PbgGEYyBGNDC6aFOl2eZ7rHhI9FtobMDwumYW1 zvN3MV+hfAEimuwutmH15j1u4N/BG1eFcw7QCIrDlfGHZoeo0THgLHy5mfse8m9dX8DF PLCdToONnnntV6FT9kpG5oKGsENE5kjot507VX6wLxozxsAJ91lCc4qiAnngL9/GMKA3 B72Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=eHmaa52ts10B3izGvXZLxVuepfdGDUeEpni6p3AC59I=; b=Xm+0ciy23uQWA0+XAooXVEEnyJXIZblVlDzQ8TEctHUrTeNSVLF9heFF1Dgp6FEyTB x7O3F59HTNR3aEVq7B/N35KJZlccm2CBgKmBQyo/5TQZlm6WvWQAPzqC2+Wk8/AMKeP1 ru0ip6vmBzxH7/FhVjRK8JhwH5z/nqypsDelJlHRVT2X+VlklU3zUHquSUSIIHCtvRlf +7SizQMd7q+KMaG9DoY7r8+fCxdsBI4vMRkFww0oQ+GZgFsrHDF8+5KEs1KZdh8R0KbA g3gu0oq19Aa+2S9CGnx4XVZK6/+l930qoe86u0Ave2yuIdiq+4+gVvq0rWpLW5TShnog ra2w== X-Gm-Message-State: AMke39nT+lbWHVe5LWyQY12BPs67fHbBDeI+uQk6WIgT6JlIFynJ8H5ficEIggHWjoz38A== X-Received: by 10.28.111.136 with SMTP id c8mr6853862wmi.128.1488444799208; Thu, 02 Mar 2017 00:53:19 -0800 (PST) Received: from localhost.localdomain (p4FF003DA.dip0.t-ipconnect.de. [79.240.3.218]) by smtp.googlemail.com with ESMTPSA id s18sm26177390wmb.18.2017.03.02.00.53.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 02 Mar 2017 00:53:18 -0800 (PST) From: wm4 To: ffmpeg-devel@ffmpeg.org Date: Thu, 2 Mar 2017 09:53:06 +0100 Message-Id: <20170302085309.11471-5-nfxjfg@googlemail.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20170302085309.11471-1-nfxjfg@googlemail.com> References: <20170210123541.32375-1-nfxjfg@googlemail.com> <20170302085309.11471-1-nfxjfg@googlemail.com> Subject: [FFmpeg-devel] [PATCH v3 4/7] ffmpeg: fix printing of filter input/output names X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: FFmpeg development discussions and patches List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: FFmpeg development discussions and patches Cc: wm4 MIME-Version: 1.0 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Broken by the previous Libav commit (even in Libav, thus a separate commit). Signed-off-by: wm4 --- ffmpeg_filter.c | 44 +++++++++++++++++++++----------------------- 1 file changed, 21 insertions(+), 23 deletions(-) diff --git a/ffmpeg_filter.c b/ffmpeg_filter.c index 8490f4a455..f21a8c85f8 100644 --- a/ffmpeg_filter.c +++ b/ffmpeg_filter.c @@ -230,6 +230,25 @@ int init_simple_filtergraph(InputStream *ist, OutputStream *ost) return 0; } +static char *describe_filter_link(FilterGraph *fg, AVFilterInOut *inout, int in) +{ + AVFilterContext *ctx = inout->filter_ctx; + AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; + int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs; + AVIOContext *pb; + uint8_t *res = NULL; + + if (avio_open_dyn_buf(&pb) < 0) + exit_program(1); + + avio_printf(pb, "%s", ctx->filter->name); + if (nb_pads > 1) + avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx)); + avio_w8(pb, 0); + avio_close_dyn_buf(pb, &res); + return res; +} + static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) { InputStream *ist = NULL; @@ -300,6 +319,7 @@ static void init_input_filter(FilterGraph *fg, AVFilterInOut *in) fg->inputs[fg->nb_inputs - 1]->graph = fg; fg->inputs[fg->nb_inputs - 1]->format = -1; fg->inputs[fg->nb_inputs - 1]->type = ist->st->codecpar->codec_type; + fg->inputs[fg->nb_inputs - 1]->name = describe_filter_link(fg, in, 1); fg->inputs[fg->nb_inputs - 1]->frame_queue = av_fifo_alloc(8 * sizeof(AVFrame*)); if (!fg->inputs[fg->nb_inputs - 1]->frame_queue) @@ -338,6 +358,7 @@ int init_complex_filtergraph(FilterGraph *fg) fg->outputs[fg->nb_outputs - 1]->out_tmp = cur; fg->outputs[fg->nb_outputs - 1]->type = avfilter_pad_get_type(cur->filter_ctx->output_pads, cur->pad_idx); + fg->outputs[fg->nb_outputs - 1]->name = describe_filter_link(fg, cur, 0); cur = cur->next; fg->outputs[fg->nb_outputs - 1]->out_tmp->next = NULL; } @@ -643,28 +664,8 @@ static int configure_output_audio_filter(FilterGraph *fg, OutputFilter *ofilter, return 0; } -#define DESCRIBE_FILTER_LINK(f, inout, in) \ -{ \ - AVFilterContext *ctx = inout->filter_ctx; \ - AVFilterPad *pads = in ? ctx->input_pads : ctx->output_pads; \ - int nb_pads = in ? ctx->nb_inputs : ctx->nb_outputs; \ - AVIOContext *pb; \ - \ - if (avio_open_dyn_buf(&pb) < 0) \ - exit_program(1); \ - \ - avio_printf(pb, "%s", ctx->filter->name); \ - if (nb_pads > 1) \ - avio_printf(pb, ":%s", avfilter_pad_get_name(pads, inout->pad_idx));\ - avio_w8(pb, 0); \ - avio_close_dyn_buf(pb, &f->name); \ -} - int configure_output_filter(FilterGraph *fg, OutputFilter *ofilter, AVFilterInOut *out) { - av_freep(&ofilter->name); - DESCRIBE_FILTER_LINK(ofilter, out, 0); - if (!ofilter->ost) { av_log(NULL, AV_LOG_FATAL, "Filter %s has an unconnected output\n", ofilter->name); exit_program(1); @@ -970,9 +971,6 @@ static int configure_input_audio_filter(FilterGraph *fg, InputFilter *ifilter, static int configure_input_filter(FilterGraph *fg, InputFilter *ifilter, AVFilterInOut *in) { - av_freep(&ifilter->name); - DESCRIBE_FILTER_LINK(ifilter, in, 1); - if (!ifilter->ist->dec) { av_log(NULL, AV_LOG_ERROR, "No decoder for stream #%d:%d, filtering impossible\n",