From patchwork Tue Oct 5 20:50:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 30911 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a6b:6506:0:0:0:0:0 with SMTP id z6csp5773718iob; Tue, 5 Oct 2021 13:51:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyEjieCoiOI6OLPCxnocvdVv2u6v/urTT1rOaV6bloABE/FrYhPB1l+gsCaA+pETDOX1QvG X-Received: by 2002:a17:906:3283:: with SMTP id 3mr27134448ejw.4.1633467087585; Tue, 05 Oct 2021 13:51:27 -0700 (PDT) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id w15si2478570edl.93.2021.10.05.13.51.26; Tue, 05 Oct 2021 13:51:27 -0700 (PDT) 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=@outlook.com header.s=selector1 header.b=MP9yQirB; arc=fail (body hash mismatch); 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=NONE sp=QUARANTINE dis=NONE) header.from=outlook.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0B5D768A874; Tue, 5 Oct 2021 23:51:22 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-DB5-obe.outbound.protection.outlook.com (mail-oln040092064043.outbound.protection.outlook.com [40.92.64.43]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 46A5D68A767 for ; Tue, 5 Oct 2021 23:51:15 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=T6Ca/+UBSqTpN+a0GAgs+FY0yO2f5Uilaru1/9btxLPlVUcx+M4DIpigusVuWwnIawLLA+GOEbNlb7q7Cy8TEVM2i91WTtvd8/G728x1oNGCfkPn7z2TPcOJw3oIQOAfIeQWkr7yRL+4SE1KXx1wyDFQYIvoYdKPQ+O2x6IftSEFKa/Nf6DEB5SmToynrDKnUl2dkZ5Y8tdt7DTPD7QomtzEfmCB7Aunrb0WJIXTBbKOtqr//bk5L0ERCaZDUR7NwvYAncMEmwDOJq68A70r7qQF5JDQcag1L9z27gZfDqU90GD4w8lQJpz3BOZyZfkUDI1VZi44gcnc2F35tfwOdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=1y2RI10C/0PlaRYPopYK7l782AwN7PoTZFDyKO45UUI=; b=d6Pi4zPmR5A0+gv9AfgEjqtRhXP0Y3Ios+gXx1eTOM+l7Fa6K+yrr/2+3Up1R4TfWS+zqyEWm4C7kc8/uYsy3sCoQ/X7bikUqSlhJOKhhrDRGtXVqD4/kplTEyCuviYkOj/L8rzrZtVZtgoOwVnSTbwbG7iqkqaig4G5EtxblbYHVTM2WH44RArTJsk4cIamzpyAohlQYgC/HZ8KLsiJgWZmzUBF59rjvmcjZ1KD+m8VsjHsMb2p4WYV+MUDv7XsuW4TaKLWbDNhb3eptHO3HNgY0bTgwYODYRAQBE0T2jBbj4200V1O///WAN/8aSSMeUDwLbj0nhBCfk7b6LyEMA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outlook.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=1y2RI10C/0PlaRYPopYK7l782AwN7PoTZFDyKO45UUI=; b=MP9yQirBrO0yl0igfgHQaNr7LF32J7561MEC8rW3MOGJA4JxevugHZ20h+pqAkmwElZ31aY2kA5/dXdWx8riypGhIHd+nsPtGql2+NVzzUTYOMsNH2oJLU5M+2R8TB1fKTmOTHsFIL8WM8Y6JhrwrIpwXMTJtqN+FD8RnB3MS2TbZMBGyxvg9ddFTrB1e3OMPrvGeddMQbg4F7lwmgq2b8IMvxe7jID/G6esPZWlL/wUnWMtwr9zYSblS31Iqub+oZFUS5JRf4fkfAxXrt8EUmKcg5H2NNdjQBzmMZ9OllIaoSXNb2oHSym3fuHbfdndnoaVtIG8ucxop3Pk5j/f3A== Received: from AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) by AM6PR03MB4824.eurprd03.prod.outlook.com (2603:10a6:20b:84::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4566.22; Tue, 5 Oct 2021 20:51:13 +0000 Received: from AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51]) by AM7PR03MB6660.eurprd03.prod.outlook.com ([fe80::700f:d70b:3bb8:4d51%7]) with mapi id 15.20.4566.022; Tue, 5 Oct 2021 20:51:13 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Tue, 5 Oct 2021 22:50:55 +0200 Message-ID: X-Mailer: git-send-email 2.30.2 X-TMN: [YdYzK0j0R52uoZ+2wtSZPds+AUjylY9P] X-ClientProxiedBy: AM3PR07CA0132.eurprd07.prod.outlook.com (2603:10a6:207:8::18) To AM7PR03MB6660.eurprd03.prod.outlook.com (2603:10a6:20b:1c1::22) X-Microsoft-Original-Message-ID: <20211005205102.519815-1-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.142.38) by AM3PR07CA0132.eurprd07.prod.outlook.com (2603:10a6:207:8::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4587.11 via Frontend Transport; Tue, 5 Oct 2021 20:51:12 +0000 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 2ddcce1f-e1f5-4043-bf4e-08d98841ddb0 X-MS-Exchange-SLBlob-MailProps: EpEO96k6WokY/mv56J80DP/THPsZHp4Z9/776o1W+4KAoWxIpl95nfnxsuS2AxiJQvfu/6HKNcJe+/4VdAzQk9jp66HKfxaS49i3gY0GJh69T9mvxdMGKp/T5KW10VCHI5BQGe+RO948KB0BqLmx3EXaCcz8qVojPLENyCVee/vAwnde9bYx4HRIi50CEOvLGWIm1A8ZXhVW/sKG1wolWq1xVUracu4fc2S8N2Vtp/QtY19qN+kyze9XGxPI1x8wzJtYg6YsJxwIql9/4sM+wwurZnJqoVm1oLWPlGfJRda5pvuuVSrA4wXOZrF8cDps8KhdyNhjvtzeTlLZC5NNZoqWozae3S+564xj6xEptvPJa6LW1W+6f/U7IRsDbspAQCm5oceEzxe9ZO6TMTpxAz6qq9od9Z4j7Vp4HtJHjHvAvKOQpm+nqyWM2tPKb8aBwi47NShy6w1+WmQtvY6qItR/W/IPMcmQRmM0XCsUMsi+jRHeP0nGKEoFpr/SQtgy8tL0yXqUXj3FMqpuknwhQx7Y1JclLEQ3DSwu3WejMuvGaMNQ3TeBEbB+PP3/kccWb/ArxRbPnwG4N40FniK6iM6q3xQEi8QwnLmZm/WwLfX+PIYGjC2UTtx3Zt8hfqY5Sr8G+IjzZPxMYy4N/LCpNzZPT6PqlE1/JC8K3RawCWTWXRjhk2UfWdLWbhZkwiUNukKiTFfXvX6e6ZXA89BdHPBqkpVyzcees7qzoB0uSEhOB+VzLcF66XLkd2PmXB33yFS+r5XablA= X-MS-TrafficTypeDiagnostic: AM6PR03MB4824: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: EuWU5Nrbc6Qrm03M3tZ2C1yEvIswKW9XserQHm5Xr/VgdQrrty1rtwC1bcIM12dj9UPodNnBWQ0qxs2qaQs6majtLhNCMo/3W4J4wjEi+6duneLP9VT3w7IKA0AmTgK3S8Lkk1ZdBYAVSQrt0zbVxKfynZdZo0XTpsKVKX9d1M8VeTjF3K2oLLxPlHhT03MZlR30vojmhCBWHnZfsnD5/WksvcAn6n+lyvG8CHsjIh0GMvH3+AaRlLZ3Jvlz96C5QC7kCPvIzaCSTJcqPfvOWXAYbYIDiU03ZPsaTIN/TewSW26BqENUMikB3VqmoeUDfaorG7Fd2bYYtCV/xKMFS6LgExDHXwS9UIujPi3K6iNh0bfJTqYABnvS6q1EoWKo7L2ZBWiDdEw7VlhTQ4sWewOFOsHaYwz2u1IGjfrVguJHNtGLSCtJPhXlE9/kGQLU X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: quPnlalltZHllY9HrvvzsCwPkqE3/yOZwA3q0bRL0lH5tb6xzhVxmjdPzZryEyPe0zrYWGH2iwtgKanbMcyG+sgZWxTxpyTQ97wc6ZE0lrKldxWiG28Tfh70gFFg6gSADjeqSg/mQUWUiaZHh72WRA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2ddcce1f-e1f5-4043-bf4e-08d98841ddb0 X-MS-Exchange-CrossTenant-AuthSource: AM7PR03MB6660.eurprd03.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Oct 2021 20:51:13.5641 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR03MB4824 Subject: [FFmpeg-devel] [PATCH 1/8] avfilter/tests/filtfmts: Replace macro by ordinary function X-BeenThere: ffmpeg-devel@ffmpeg.org X-Mailman-Version: 2.1.29 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: Andreas Rheinhardt Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: wsUNLqXqBxaS This is possible now that AVFilterFormatsConfig exists. Signed-off-by: Andreas Rheinhardt --- libavfilter/tests/filtfmts.c | 77 ++++++++++++++++++++---------------- 1 file changed, 42 insertions(+), 35 deletions(-) diff --git a/libavfilter/tests/filtfmts.c b/libavfilter/tests/filtfmts.c index 55bb64abc5..07e387b92e 100644 --- a/libavfilter/tests/filtfmts.c +++ b/libavfilter/tests/filtfmts.c @@ -32,43 +32,50 @@ #include "libavfilter/formats.h" #include "libavfilter/internal.h" +static void print_formats_internal(AVFilterLink **links, const AVFilterPad *pads, + unsigned nb, size_t fmts_cfg_offset, + const char *inout_string) +{ + for (unsigned i = 0; i < nb; i++) { + const AVFilterLink *const link = links[i]; + const AVFilterFormatsConfig *const cfg = (AVFilterFormatsConfig*)((const char*)link + fmts_cfg_offset); + const char *pad_name = avfilter_pad_get_name(pads, i); + + if (link->type == AVMEDIA_TYPE_VIDEO) { + const AVFilterFormats *const fmts = cfg->formats; + for (unsigned j = 0; j < fmts->nb_formats; j++) { + printf("%s[%u] %s: fmt:%s\n", + inout_string, i, pad_name, + av_get_pix_fmt_name(fmts->formats[j])); + } + } else if (link->type == AVMEDIA_TYPE_AUDIO) { + const AVFilterFormats *const fmts = cfg->formats; + const AVFilterChannelLayouts *const layouts = cfg->channel_layouts; + + for (unsigned j = 0; j < fmts->nb_formats; j++) + printf("%s[%u] %s: fmt:%s\n", + inout_string, i, pad_name, + av_get_sample_fmt_name(fmts->formats[j])); + + for (unsigned j = 0; j < layouts->nb_channel_layouts; j++) { + char buf[256]; + av_get_channel_layout_string(buf, sizeof(buf), -1, + layouts->channel_layouts[j]); + printf("%s[%u] %s: chlayout:%s\n", + inout_string, i, pad_name, buf); + } + } + } +} + static void print_formats(AVFilterContext *filter_ctx) { - int i, j; - -#define PRINT_FMTS(inout, outin, INOUT) \ - for (i = 0; i < filter_ctx->nb_##inout##puts; i++) { \ - if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_VIDEO) { \ - AVFilterFormats *fmts = \ - filter_ctx->inout##puts[i]->outin##cfg.formats; \ - for (j = 0; j < fmts->nb_formats; j++) \ - if(av_get_pix_fmt_name(fmts->formats[j])) \ - printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ - i, avfilter_pad_get_name(filter_ctx->inout##put_pads, i), \ - av_get_pix_fmt_name(fmts->formats[j])); \ - } else if (filter_ctx->inout##puts[i]->type == AVMEDIA_TYPE_AUDIO) { \ - AVFilterFormats *fmts; \ - AVFilterChannelLayouts *layouts; \ - \ - fmts = filter_ctx->inout##puts[i]->outin##cfg.formats; \ - for (j = 0; j < fmts->nb_formats; j++) \ - printf(#INOUT "PUT[%d] %s: fmt:%s\n", \ - i, avfilter_pad_get_name(filter_ctx->inout##put_pads, i), \ - av_get_sample_fmt_name(fmts->formats[j])); \ - \ - layouts = filter_ctx->inout##puts[i]->outin##cfg.channel_layouts; \ - for (j = 0; j < layouts->nb_channel_layouts; j++) { \ - char buf[256]; \ - av_get_channel_layout_string(buf, sizeof(buf), -1, \ - layouts->channel_layouts[j]); \ - printf(#INOUT "PUT[%d] %s: chlayout:%s\n", \ - i, avfilter_pad_get_name(filter_ctx->inout##put_pads, i), buf); \ - } \ - } \ - } \ - - PRINT_FMTS(in, out, IN); - PRINT_FMTS(out, in, OUT); + print_formats_internal(filter_ctx->inputs, filter_ctx->input_pads, + filter_ctx->nb_inputs, + offsetof(AVFilterLink, outcfg), "INPUT"); + print_formats_internal(filter_ctx->outputs, filter_ctx->output_pads, + filter_ctx->nb_outputs, + offsetof(AVFilterLink, incfg), "OUTPUT"); } int main(int argc, char **argv)