From patchwork Thu Jun 17 02:31:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 28455 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5e:c91a:0:0:0:0:0 with SMTP id z26csp200187iol; Wed, 16 Jun 2021 19:34:25 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw7czu+YPmmdYBhwAVp9RY9A0lv4vXLApgJ3QYG/L+e94u2yxw7CDciYhHHSn/+sYwyfg0Z X-Received: by 2002:a05:6402:28a:: with SMTP id l10mr3329719edv.365.1623897265475; Wed, 16 Jun 2021 19:34:25 -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 r10si3745962edy.600.2021.06.16.19.34.25; Wed, 16 Jun 2021 19:34:25 -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=PS+fnsjC; 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 DD71D689721; Thu, 17 Jun 2021 05:33:24 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-DB3-obe.outbound.protection.outlook.com (mail-oln040092074040.outbound.protection.outlook.com [40.92.74.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 607606883DD for ; Thu, 17 Jun 2021 05:33:18 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=DiRlWFM0PqN4k5QmPp4bO4RwB+lTzx7K35vYH2x4zMjQB4YDHdYJIQ1MSgykmU9dIHWUDkFVcJiZn3DQaVp8fjXDgY2KRY8QcxuQhC45qfRHs0vZFdiWiDrHfaYHCpC0uwux3hO3JXx1eXPW5Uqov5nN8NZh+KJVk8+Vh+DK++w1Skj0dyMocvboyrDWk4rwUOgQYK6j3H8DGqMk3gdrZvrWPMpPYoGdHo8mwsTO/9E8uSAGNRNjLhQ7a0GHF3+P7SOV8xfEnIHwoWORZxc2aA0SvatbfPSpS9WmnesoeYYMOPjVpEoE3KORqSanGtkPB9TCGEreNhYodRwXtTQ2xw== 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=HDFKo4dHLNd6suWeiSBj9jburNqiMHhp3xN8UI0UT80=; b=baf/pnnOQNf4NlYjZmfrjiymOK6F/Nk8op5hYtfuzqV6Pvb7Bcg7B4XX4otMnr5NTDZn75rHxczxG1ZCcGRjXjtQkxHIaGL/lAbgL4cS5iXvo7PDWyTux3rUw7QJL94B1Xw+ftptTFMBUHugW8AkN7e0yy0U69JY2UTOlv1fSJp+ikcCFh6W7fgVL8MwPMRF00SW+BFkDld8GTJ8vkMglFH3C6ea8cIfOG6Do6JKkiLfbtH5R1EszzDsrheRvp1PyzRTHkxoFjRO0mMpBMj5RRw60oZcSetINHCnbAvfZSVIbVZOIoErez0ZQSQJnTda29Jt0mXULiULFIpwKSZWYw== 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=HDFKo4dHLNd6suWeiSBj9jburNqiMHhp3xN8UI0UT80=; b=PS+fnsjCqQ4+AN62P4thDVPCYAck+zzyRxRYibbLVniciEHH6xbL1Y6yuuCZhowclHFRZE6sd5awJaMlQ/mMzlzzzoQdpnR6TRSFFjo8rxwL2IfKB518wKBfGNKDahB/45Pbu3f03HHJMYUf08kN/wKS2hZ8jkkhHrC4S3WBCYWNMR7eZ2FXvy6UPE1nMGwiRe1e/PDjUJza9JT0YK9a5IlCDuxlpXnGM/GR8u3L8kWY7oKvdr9oQu5JDEMVnHTyK7zFOwr1LQiu0mz4XTispVNtr+HetJyRVbOuqcky+m2sI1h0wJNpQGvmknCySNDZ0qWU1l5ESbUWe82skOxKrg== Received: from HE1EUR04FT016.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::47) by HE1EUR04HT116.eop-eur04.prod.protection.outlook.com (2a01:111:e400:7e0d::356) 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:17 +0000 Received: from VI1PR0301MB2159.eurprd03.prod.outlook.com (2a01:111:e400:7e0d::46) by HE1EUR04FT016.mail.protection.outlook.com (2a01:111:e400:7e0d::93) 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:17 +0000 X-IncomingTopHeaderMarker: OriginalChecksum:74261ABA1722F970449EEE0318268CE5A8DC3D53D57B1700708A4CEB40BF0B8D; UpperCasedChecksum:25AEF949A267BA3077C8482B8E6C590534D4F94D9B123247E3975225F67067E0; SizeAsReceived:7602; Count:48 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:17 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 17 Jun 2021 04:31:39 +0200 Message-ID: X-Mailer: git-send-email 2.27.0 In-Reply-To: References: X-TMN: [7llRWhzMapnikO7aJ+jM/LUTgHJvhq41] 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-17-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:17 +0000 X-MS-PublicTrafficType: Email X-IncomingHeaderCount: 48 X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-Correlation-Id: b411c5f6-dd61-4008-7b90-08d9313843c0 X-MS-Exchange-SLBlob-MailProps: gjx25WM8ZNU/fTcAoeunGvvJC2vgMUdOdgxUefZOMO/5/yH5cak6Ik7WoMCm0BmMjgWJHBF3OEgg06YMSvFLyVSQC59Tpp8CQtUC5qStdacGUarlzabLXQ1Ol2WTs/20NdiItPDbWoWr5/aIjnhgoVoEdZuQzWwBS85rrlCGBtVNhdgiTziRvOUbN7I3P6Vq3yHpgO6iM/z7g7mc8R/U81b3ykEGQ2g1sAKEfWXhqCeYUnHamp6MHN6seJmTBBjf4AOvUBO2iGSMRgf+iGwGRzcE0W+QRXQI2y5F36zWaKPhcRG71kDx2Ha2G22wp7uABEwbUTAqkaTktEufMt6AHFZV/zOHB3MJ/Y/gtWoL/2JXhWGadIXIr5zSW4EENL3AFeaIqmg3hC9sBptuOQjY2g2G2gZRzBuB8tdLB5p/hi3DOHYn1Mmn+e/JaWs7IzWkEuCDCZFj0X2LZ5iJadC0ZUO7+6Y9pOqHq4wbmSLyHrySnYetPHEDBZ2b5gyDh50tt3pajJaCX76dVGZlMoy5N7E7LFMIrrXYEP/BucL8VRs9K9U1Oi+aDj7i67GilCY+Di28yrv0V6ewZDhE3ppZaW0HE6mK/hiYu+3XZq86vdP2kfZsI8bsoPFOjQrjK6fFOTeOZDX1uDDnyawerJa+1cFobz/ZhUjCHsHIRp4+VgqjjWBtEk1Zs4CStSGrmlV/zxH6uhbQ7jezbj5L8ESxl07SBAaQ22GgUrWNQOE8YbU= X-MS-TrafficTypeDiagnostic: HE1EUR04HT116: X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 746Cs7uoCUJicDU6wjwubsahCuq37Nfs3nyt+WrnC3JCNrDTdl1j97l352NNto1ZuM87Dno4OFhejVrpa69od7e4F+nxGxeeTpSnXF/8dlZoZLfeebngMIkqkjRkTTn9dZqPvIGxMDKDilbeXEpSGMpnnvXlGCAoeS+hhhq1qGRgA/+byKSygcWYlMCHD3+51nOBW7ITxcpRpka1v0M7VUPs1zIOZp55Q9hZiOa28neOlYTV4eU4PlWYGR1j4AKJimu3+0e4LBiZb1tDwi6QxROgfh/+VptJjfTlZ11T8gfQO94+nH6rF8t86STPWLR0s6T3bdc+s7d1Dc37h/ddiaM3rwT0rS37EF8Agf6iJTGiDpMhwL4O6Kc3lUalZlE/xmx2y6M44iKdKrZ+uDD5eg== X-MS-Exchange-AntiSpam-MessageData: lhEEXcArdfgjiO5frxJJUkN8sWzW019YkKeg4Gzy1FijZ28QgH1kcXWuAgNxOAu7UCBNKNsPyNGng/eFdjpw5OT786+ruT8+rqjEQxaeVi3Za+FBnOMYctrblxukd9A39vGcdSGGzxkEqqakB1MuYg== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: b411c5f6-dd61-4008-7b90-08d9313843c0 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jun 2021 02:33:17.6232 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-AuthSource: HE1EUR04FT016.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: HE1EUR04HT116 Subject: [FFmpeg-devel] [PATCH 18/41] avformat/rawdec: Deduplicate AVClasses based upon ff_rawvideo_options 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: 3uW51KpGV734 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 --- libavformat/ingenientdec.c | 4 +--- libavformat/rawdec.c | 10 +++++++++- libavformat/rawdec.h | 14 ++------------ 3 files changed, 12 insertions(+), 16 deletions(-) diff --git a/libavformat/ingenientdec.c b/libavformat/ingenientdec.c index 9848e12e9e..7a9cce155f 100644 --- a/libavformat/ingenientdec.c +++ b/libavformat/ingenientdec.c @@ -61,8 +61,6 @@ static int ingenient_read_packet(AVFormatContext *s, AVPacket *pkt) return ret; } -FF_RAWVIDEO_DEMUXER_CLASS(ingenient) - const AVInputFormat ff_ingenient_demuxer = { .name = "ingenient", .long_name = NULL_IF_CONFIG_SMALL("raw Ingenient MJPEG"), @@ -73,5 +71,5 @@ const AVInputFormat ff_ingenient_demuxer = { .flags = AVFMT_GENERIC_INDEX, .extensions = "cgi", // FIXME .raw_codec_id = AV_CODEC_ID_MJPEG, - .priv_class = &ingenient_demuxer_class, + .priv_class = &ff_rawvideo_demuxer_class, }; diff --git a/libavformat/rawdec.c b/libavformat/rawdec.c index aa6eba4f39..cf5da8c21e 100644 --- a/libavformat/rawdec.c +++ b/libavformat/rawdec.c @@ -118,12 +118,20 @@ int ff_raw_data_read_header(AVFormatContext *s) #define OFFSET(x) offsetof(FFRawVideoDemuxerContext, x) #define DEC AV_OPT_FLAG_DECODING_PARAM -const AVOption ff_rawvideo_options[] = { +static const AVOption rawvideo_options[] = { { "framerate", "", OFFSET(framerate), AV_OPT_TYPE_VIDEO_RATE, {.str = "25"}, 0, INT_MAX, DEC}, { "raw_packet_size", "", OFFSET(raw_packet_size), AV_OPT_TYPE_INT, {.i64 = RAW_PACKET_SIZE }, 1, INT_MAX, DEC}, { NULL }, }; #undef OFFSET + +const AVClass ff_rawvideo_demuxer_class = { + .class_name = "generic raw video demuxer", + .item_name = av_default_item_name, + .option = rawvideo_options, + .version = LIBAVUTIL_VERSION_INT, +}; + #define OFFSET(x) offsetof(FFRawDemuxerContext, x) static const AVOption raw_options[] = { { "raw_packet_size", "", OFFSET(raw_packet_size), AV_OPT_TYPE_INT, {.i64 = RAW_PACKET_SIZE }, 1, INT_MAX, DEC}, diff --git a/libavformat/rawdec.h b/libavformat/rawdec.h index 3c05795762..18777db290 100644 --- a/libavformat/rawdec.h +++ b/libavformat/rawdec.h @@ -24,7 +24,6 @@ #include "avformat.h" #include "libavutil/log.h" -#include "libavutil/opt.h" typedef struct FFRawVideoDemuxerContext { const AVClass *class; /**< Class for private options. */ @@ -39,7 +38,7 @@ typedef struct FFRawDemuxerContext { int raw_packet_size; } FFRawDemuxerContext; -extern const AVOption ff_rawvideo_options[]; +extern const AVClass ff_rawvideo_demuxer_class; extern const AVClass ff_raw_demuxer_class; int ff_raw_read_partial_packet(AVFormatContext *s, AVPacket *pkt); @@ -52,16 +51,7 @@ int ff_raw_subtitle_read_header(AVFormatContext *s); int ff_raw_data_read_header(AVFormatContext *s); -#define FF_RAWVIDEO_DEMUXER_CLASS(name)\ -static const AVClass name ## _demuxer_class = {\ - .class_name = #name " demuxer",\ - .item_name = av_default_item_name,\ - .option = ff_rawvideo_options,\ - .version = LIBAVUTIL_VERSION_INT,\ -}; - #define FF_DEF_RAWVIDEO_DEMUXER2(shortname, longname, probe, ext, id, flag)\ -FF_RAWVIDEO_DEMUXER_CLASS(shortname)\ const AVInputFormat ff_ ## shortname ## _demuxer = {\ .name = #shortname,\ .long_name = NULL_IF_CONFIG_SMALL(longname),\ @@ -72,7 +62,7 @@ const AVInputFormat ff_ ## shortname ## _demuxer = {\ .flags = flag,\ .raw_codec_id = id,\ .priv_data_size = sizeof(FFRawVideoDemuxerContext),\ - .priv_class = &shortname ## _demuxer_class,\ + .priv_class = &ff_rawvideo_demuxer_class,\ }; #define FF_DEF_RAWVIDEO_DEMUXER(shortname, longname, probe, ext, id)\