From patchwork Thu Jun 17 02:32:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28518 Delivered-To: andriy.gelman@gmail.com Received: by 2002:a25:bbc9:0:0:0:0:0 with SMTP id c9csp74753ybk; Wed, 16 Jun 2021 19:39:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwKa3bj1IpQRSGsEep2EiN4qYuSsXzvxgxGz/2W7kDOdVdx0IHeMtyber2wC0U23G7QbxfO X-Received: by 2002:aa7:c64e:: with SMTP id z14mr3373348edr.119.1623897566879; Wed, 16 Jun 2021 19:39:26 -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 z26si4728254ejc.46.2021.06.16.19.39.26; Wed, 16 Jun 2021 19:39:26 -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=forDywP0; 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 D94DA68A08E; Thu, 17 Jun 2021 05:34:05 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-VI1-obe.outbound.protection.outlook.com (mail-oln040092075019.outbound.protection.outlook.com [40.92.75.19]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 4AAF3689F4F for ; Thu, 17 Jun 2021 05:34:00 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ABKF3h7ufiKfAWkj8D7prOpFCOVTESPyEjfn4ah+yi2n35jMgXlaNquMareYjd7jgTF4ak0xNjnzlcysMvyUHroMT7Kaqs/ELpzis1bmj+1xFHI7R9g8l31Y4LBvlGU+2V6DqzLD0mMd25sdVI1O3Fl5O1yeEiBjKTv9WySIEFeVquudYEte4HHUVUjcYVpHpe+8QyePFuCJ4OheN/3aXhuZml30hQg3IqvGf2tlV/E0EaMEShgeeP83aqkev7u19a0VvrYDQgIthJKXbTyARRGsUvPopR9OGHem2LzxjE5bJ81PQKUSbj1+xPzQ4TBAoxXhRh0/nUW6hitCF1gcIA== 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-SenderADCheck; bh=r3bvCEV+UWp+Vfh7k3eaatqCPgQ4146rjX6yHFMek3w=; b=JTWbD5mbIcalcidoQc0fBcHFECovb4pcK1uBVClkC/pDCjwdK5qxs5H5jfBU1NkFUr7XlR77f5TkkvPpjhbQyxDPMYYK28tkJiqOLNWA7JKPBhfu7kITo/zEZENQIa9lB80GL61tyLe19o0XfmTjxWCalRVPpAi5Sz1hRTTnaJCFKEUWko6VAoscLuBIrafvQrjNwbzLlBTuGRRWag6/HY7m5fyCZpXFD2Xuz7pwExl7oud/Mi1PvMeU21I6dyNn3n6uVos93Uj9oh+VdAI2bXbr5uUPnMd40o3Utu67g3FR64zZ7gqDWYmG/CnqFpYWnElHRmRMHiR97Jz3SE/ymA== 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=r3bvCEV+UWp+Vfh7k3eaatqCPgQ4146rjX6yHFMek3w=; b=forDywP0/8s3IG2mk29kyGgSgIEg+1/I20PDAYtu5EgqkKJZ/DlcxT8jq2JZwe+zP+0iJiJGY90N3yXTIyiqukYXRlfiIsoNejk34yO0t7EUAAAp1eClG/PYFWaIDBRC4H7Kh+uB0nyP6NRHrK9dns+u3KAAUgSeq0POwC/K4lEZnmbY4VDJsATWTOe9eAGtrWTXii6v7RRLgSp7d3UGm9S3iVDBgGTgbSiwu8Y1TVF5Yz8v7NGPH1Wtt+DeJ88JIbG5itOCtx0Gy3b/nvKNRlZRFItCcJPcoYv/EksHRcZHxaXYnwp22Ijx/cQBvMLJ9vrzo44jhbRplYcy9npYqg== Received: from HE1EUR04FT053.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::47) by HE1EUR04HT230.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::415) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16; Thu, 17 Jun 2021 02:33:59 +0000 Received: from VI1PR0301MB2159.eurprd03.prod.outlook.com (2a01:111:e400:7e0d::4b) by HE1EUR04FT053.mail.protection.outlook.com (2a01:111:e400:7e0d::298) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16 via Frontend Transport; Thu, 17 Jun 2021 02:33:59 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:9527E7AEB0712FA07E305BBF69037E1D90D6FE3B10D198DD5CFCC2778B73EF06; UpperCasedChecksum:42EF6521D41960761F018269380C63EE37C5410B30D3138171C48700F92BFC6A; SizeAsReceived:7757; Count:50 Received: from VI1PR0301MB2159.eurprd03.prod.outlook.com ([fe80::d9b:66ba:63ad:967b]) by VI1PR0301MB2159.eurprd03.prod.outlook.com ([fe80::d9b:66ba:63ad:967b%5]) with mapi id 15.20.4242.019; Thu, 17 Jun 2021 02:33:59 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Jun 2021 04:32:02 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [X+Mo5/z/fxNTEjHLBOBZxbl7/0AaaGOU] X-ClientProxiedBy: AM0PR04CA0115.eurprd04.prod.outlook.com (2603:10a6:208:55::20) To VI1PR0301MB2159.eurprd03.prod.outlook.com (2603:10a6:800:26::20) X-Microsoft-Original-Message-ID: <20210617023202.1318312-40-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from sblaptop.fritz.box (188.192.97.82) by AM0PR04CA0115.eurprd04.prod.outlook.com (2603:10a6:208:55::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4242.16 via Frontend Transport; Thu, 17 Jun 2021 02:33:30 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 50 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: e6decf3e-9e60-4c14-8267-08d931384b9e X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNU/fTcAoeunGvvJC2vgMUdOtpMk4ZZjMF9xeoJXzVRRaYaJD7BWCC0sTj8OMu+R72VZu9ikMN4iKfrLyDfYS3BX6HaLS8cGQYkTVS5Txh5WfSt7d1Qk+IoaN6Itp5U4+X2dMnyrKR61eVgtzW7XauS4fLultFzTvNZaJy5IjysuvmnSFPD5mq8SkuKWGk0vHxQocXYr7VUAKDES0E3a1/f7JCKcHYn6EoSE+h5UeXt4j21AZ7KGMWqmXc4JxcrfE9XJPvQkQbvWCh+/V5DmnIzKU8rOd39aboccKr2e5XzUuqJOBtD4/aG4rjyREP3qUEUAG3T0OzPQPELN0NSAzrJoil6lYEacjGnvDDTvlPU6NMj4VNrvT+5vV5Mw+WNAbYAyeBlXaWUMJc36DJHQZ6YN3qCTlffYiq6Hx3Pjqb6pdrKNOyXPKEdXh6I0T/LjJ55RabpkTLqI41yQFymfu4m7sKp42uWYmv5P3SnPEyrlgBGI54LQrCY03iqb+e90rrDaAO6OuLBdDM3XBNNHhHywie560afqIIsOUu+JFOOzzTbQpOBQWFdqfSUYV8GJEbZEAjHuZS/tPwhKAvPr/ijG01sEWlJvU5XY+r4YtaA4/OyKd7o54KaUIE3fZmh22QAlC2rRyrEP97Eio/SzbiF3/jmeLl6OeT7NoQ0WvWT+fKCZ79aKlIZ+vj1gJKJnPQ6C39wEAYo8jvpp9KHSul58nJ/oMbCl554= X-MS-TrafficTypeDiagnostic: HE1EUR04HT230: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: X5ez/hkY9UfwkJMzccYuPrW7lbG6zR3Gwfkf7Ae+kvmO4NgE1kNWUIwF8wxUqy+g2/MyEqm5ZeP13hxJF6HZixUQuAfFabyXnboV0lRiVLNEISf+y0kmKjFj6eG5yY4zkQtXmnzuwNGLvNJbqK2tVLLNhUO8R0ym+zmz21UweYcK9LEcEJLVny6VrBT1pvOZ/YNq9HfZMUsA6LKrb0sjlwHNJolIHSNwzUpk1xmtOATBb53gWBjkdDEpbILGFQQlKuT5MhMsIrveGwptLsEaUgHA7jJJ7g4SRDtoRr5HXOz3nKKZKkuPHXLbLH1G9byBVujZ3qdCLXZxTX9PXqdpY3fBPp8SkcUgx2p5ih4Pomln2QZB/90wxC9/NjE5ytTKnM8GcBqpJwGHlqxCNzQEIw== X-MS-Exchange-AntiSpam-MessageData: Dx6C5Pc5c65PxN9EkJwYR9SzLI7PB+Hm/Cf89vgeAVhKM1ftubDBgtNnyFhCmEqHuo71xfEkpxbE8Oc6CQ84+vZ3UnGUhK0mT2kXxihpCxhPrgoTMGmUs+Y0KahOxGsyrVnbEws0AhTPqgvquhPmMA== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6decf3e-9e60-4c14-8267-08d931384b9e X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2021 02:33:30.8253 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT053.eop-eur04.prod.protection.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: Internet X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: HE1EUR04HT230 Subject: [FFmpeg-devel] [PATCH 41/41] avcodec/textdec: Deduplicate AVClasses 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: d7j6xyBieZqh Content-Length: 4375 The child_class_next API relied on different (de)muxers to use different AVClasses; yet this API has been replaced by child_class_iterate. Signed-off-by: Andreas Rheinhardt --- libavcodec/textdec.c | 37 +++++++++++-------------------------- 1 file changed, 11 insertions(+), 26 deletions(-) diff --git a/libavcodec/textdec.c b/libavcodec/textdec.c index becbab601c..308553660a 100644 --- a/libavcodec/textdec.c +++ b/libavcodec/textdec.c @@ -71,17 +71,14 @@ static void text_flush(AVCodecContext *avctx) text->readorder = 0; } -#define DECLARE_CLASS(decname) static const AVClass decname ## _decoder_class = { \ - .class_name = #decname " decoder", \ - .item_name = av_default_item_name, \ - .option = decname ## _options, \ - .version = LIBAVUTIL_VERSION_INT, \ -} +static const AVClass textsub_decoder_class = { + .class_name = "text/vplayer/stl/pjs/subviewer1 decoder", + .item_name = av_default_item_name, + .option = options, + .version = LIBAVUTIL_VERSION_INT, +}; #if CONFIG_TEXT_DECODER -#define text_options options -DECLARE_CLASS(text); - const AVCodec ff_text_decoder = { .name = "text", .long_name = NULL_IF_CONFIG_SMALL("Raw text subtitle"), @@ -90,7 +87,7 @@ const AVCodec ff_text_decoder = { .id = AV_CODEC_ID_TEXT, .decode = text_decode_frame, .init = ff_ass_subtitle_header_default, - .priv_class = &text_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; @@ -106,9 +103,6 @@ static int linebreak_init(AVCodecContext *avctx) } #if CONFIG_VPLAYER_DECODER -#define vplayer_options options -DECLARE_CLASS(vplayer); - const AVCodec ff_vplayer_decoder = { .name = "vplayer", .long_name = NULL_IF_CONFIG_SMALL("VPlayer subtitle"), @@ -117,16 +111,13 @@ const AVCodec ff_vplayer_decoder = { .id = AV_CODEC_ID_VPLAYER, .decode = text_decode_frame, .init = linebreak_init, - .priv_class = &vplayer_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; #endif #if CONFIG_STL_DECODER -#define stl_options options -DECLARE_CLASS(stl); - const AVCodec ff_stl_decoder = { .name = "stl", .long_name = NULL_IF_CONFIG_SMALL("Spruce subtitle format"), @@ -135,16 +126,13 @@ const AVCodec ff_stl_decoder = { .id = AV_CODEC_ID_STL, .decode = text_decode_frame, .init = linebreak_init, - .priv_class = &stl_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; #endif #if CONFIG_PJS_DECODER -#define pjs_options options -DECLARE_CLASS(pjs); - const AVCodec ff_pjs_decoder = { .name = "pjs", .long_name = NULL_IF_CONFIG_SMALL("PJS subtitle"), @@ -153,16 +141,13 @@ const AVCodec ff_pjs_decoder = { .id = AV_CODEC_ID_PJS, .decode = text_decode_frame, .init = linebreak_init, - .priv_class = &pjs_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, }; #endif #if CONFIG_SUBVIEWER1_DECODER -#define subviewer1_options options -DECLARE_CLASS(subviewer1); - const AVCodec ff_subviewer1_decoder = { .name = "subviewer1", .long_name = NULL_IF_CONFIG_SMALL("SubViewer1 subtitle"), @@ -171,7 +156,7 @@ const AVCodec ff_subviewer1_decoder = { .id = AV_CODEC_ID_SUBVIEWER1, .decode = text_decode_frame, .init = linebreak_init, - .priv_class = &subviewer1_decoder_class, + .priv_class = &textsub_decoder_class, .flush = text_flush, .caps_internal = FF_CODEC_CAP_INIT_THREADSAFE, };