From patchwork Thu Aug 4 17:36:52 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37135 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp536811pzb; Thu, 4 Aug 2022 10:37:57 -0700 (PDT) X-Google-Smtp-Source: AA6agR7kylvC2ceti+3O2ylsUzy/G03BcEwX9lJ3mqjskwe9t89BnpexYslT6Qky/nXlOXRp1Z/g X-Received: by 2002:a17:907:c06:b0:701:eb60:ded with SMTP id ga6-20020a1709070c0600b00701eb600dedmr2271513ejc.178.1659634677216; Thu, 04 Aug 2022 10:37:57 -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 jg12-20020a170907970c00b0073081d6727fsi1354398ejc.726.2022.08.04.10.37.56; Thu, 04 Aug 2022 10:37:57 -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=Kc3OD6p4; 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 6370B68B9F8; Thu, 4 Aug 2022 20:37:35 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR04-HE1-obe.outbound.protection.outlook.com (mail-oln040092073025.outbound.protection.outlook.com [40.92.73.25]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 6C94768B9F8 for ; Thu, 4 Aug 2022 20:37:28 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ksp0cTZk2mwanWsUEUPbafuTvNZ0nhegOh/wdoRT75IaIeSarj/aIXLYq6Sf83F498yFS0wxcyfULABbfH/S11dct8I+oEc873iRHKsCPc8TQg7P7wXZla1b7NCLqxWrzqVaFcNp7KQk9P9zmBhnC3zXe3RJ70zlZb1nOIOftTH6cAz4vhXk7r6yNJZnug2qu/v//nn/AASSzYard+8UtxSWUevRRVwskdBQslGVTKek4krTuEMOAFnb9mU7W7fLswxvWU/JTuuBR+zEQERk49kntsh6wlc6DNaKiB1wDV4BnFbA9WNg6u+qEKjE1BK1Ykeeztrq7g/uNe/d1ygFpw== 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=kSoHahWJIbfmD5MT5HYbDOPwesNlvg9zV4P58UuABN8=; b=M3qZE7AmojUzd9hwr2a5y6XGIk/lC6yzzlD8qC7MmBsIe4AeHxQP6Do2fq6iCXoOKsyr3GxduMEcVVANi7eNZpcAYZBSMbR1Q2BW+1brXLg1hLK8kANZpakB7XF5EnC1JSSSDCoCqF3X7vKH2Gd+tt03Gjj63TgTzMhedVZ/LTI+Nq3MoNwh46gsjA3xlOxwEsT8vmhMLI5tpzX7FOQaBIvSF8pFN42XQ2ZFz/lH/KrzS16aNL1US24g73I0UZjHrGEp9WVm+hNraIIj41d+vsmgVR9g9Kks574NNqx5UbC4gCHnNsTW4xyA4O3LkSXByehb3yk+TD2r5UFt+m6v8Q== 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=kSoHahWJIbfmD5MT5HYbDOPwesNlvg9zV4P58UuABN8=; b=Kc3OD6p4D8t1VCLYqotvC0tpAe0fJYtYqq3T5zJ86DZsNyn6SG0pXxX6ICFd3tBdVDI3JsI/Azq24jmTrxxEF5BBuuWpCZinRPvD5+jU4BMfZSfFa5cwj9LEc7+chXk7fdSAUyp2ld+9xNWjzr4SNsm4hnbh/eWcqmtgaOgev+fxidiznslH/9mlhu6KUxKukEq15JB5gfehtbChbefuHJNVddm6pON60KHylVtOTt+UtR+Os15XSljKKN7TlVttFNSThEQp7mMIOLLy8Rv/AR1i/3te6u1aFQmHFbYjpNThLaQZmgA+b95bjOpgS8Q5JIB1BgevXW4jBGm5J2d9AQ== Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) by DB8PR01MB6503.eurprd01.prod.exchangelabs.com (2603:10a6:10:154::11) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.14; Thu, 4 Aug 2022 17:37:17 +0000 Received: from DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::210e:b627:bcc9:8c46]) by DB6PR0101MB2214.eurprd01.prod.exchangelabs.com ([fe80::210e:b627:bcc9:8c46%11]) with mapi id 15.20.5482.016; Thu, 4 Aug 2022 17:37:17 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Aug 2022 19:36:52 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [DMKpkvwEYKtpMHoyLJ/t2MlU5d1MDdDM] X-ClientProxiedBy: AM5PR0201CA0018.eurprd02.prod.outlook.com (2603:10a6:203:3d::28) To DB6PR0101MB2214.eurprd01.prod.exchangelabs.com (2603:10a6:4:42::27) X-Microsoft-Original-Message-ID: <20220804173655.1561196-5-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: cabe8016-5a76-44d1-9804-08da763ff9b8 X-MS-Exchange-SLBlob-MailProps: dEG5jEBie8mQ1Nbr3MDquWuavSVdwHSdSw48DfofTHba7puomPvtqiV62cWCf+VePSLmEg9p/QlR2kdLQPMlqSwa3glt1w2zloBkFJN0R/oTbUYXm+JOJCw7qG7WXNjD6a+jz9o0erXxPQzeDpbt3AhKJnGDSNCr1Spva+xWdRuzS3zLVe7RFkyiEhFeBATH2F2uqVVFc4srb7aqzPVJjP2lEjNTb+EE1jpuE5rP/dHhJwEmFhu851Uyz+OZHm2K1bNoXRhKhZ1scU1aq1Odk1I1BNgqtWelU+wW/dlrCZOtsB/n3hErNk9xNFL7+az1xQ2If5dnKP3084qd1TkcUIcV/2ow44iH+STo9C1OVpU2Xvotx/R3LCiauQjNpCPxJQvJ153zTw2BK4LJ0o/XtfQcSLW/8y8fbc3w7scXJdIsOic/OrB62vwLLTBHvBoQSa4bXu7NdbPF3CJwiWmtB9qZJNSSdWO6MV22OgwQ2Q0WMdpUEVqIb6x73vhW2Km7LHMPel8traBFCCwov8OfOnqdHLO1cCl4FRgNyJ+3xBncTSEFFhs0w0eKQzExA+4KnaZAhEjf8EPcaWGwuAycofzVOZ7dyW5pGfx+TrVTp++/aj0jq64iwr3UKwoPTy2zamRQ9xZSByQiTYeS+42z/3dOIhF5nMH+Cxyol/LqXSqQBOYHIB8aOw== X-MS-TrafficTypeDiagnostic: DB8PR01MB6503:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: zufq14ff2c+abSN7hU7DS8X7l/sd/KT+GBzNVVzMgTUanYzhMUG3pQHWJBlRTZaXSSUtu2d/0j+/AoQXtv6M7XYdnUpMk84nyKWbETKkwy2ec59QhZrEG556yPS3e1HPq2xMQrD5GpGfUOtHz31JCVMmJZGXTd3yLRfh1rdME13cxsMQKvc0tMHUfLbMocFf3KyEPVjnIepdRcS4rlWP0DyPFGO/q8vV1KaUzZ8IXZH7nTPEBvMNAJkVScqmdx5vH4fmcUCFfR+QYm2MKf6WxIjqdi/W2zAJPAnLz+piatMXDQ8cYqC1pkQnoDy4uSvAlzu/I8Jy0s538P27h4MnFcbQMYiUiqJmTLjxJojsKUPQ1POKZpG05LtGqtrpINoonGMqrfDt0ED4i6piafOZB0RSgJNvA9guBALvsJiWa97PLdSeW/sUCG2ZHafL8sgm8rEzj77vRxV5sHeixf0JHgd8qaOFQfdwt8UwJhbDYaeRFhY4jU/tx+fX5VbzEL3XFV8N2PTlszAmO3g+lbMoPNSUBB0pQmnfo3G4+ToFhRcKJh+4iBtd95oQy6oF8VxtlBNZloIr4whzAzqMZsoFDfmilKq3Xq1qekVT7Fr21hIM/VRVsA/zTu36hQ9C2rv3bXhtkpoMRGkJHWJgvi9PKw== X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: macWlVT76qpq5Rz8vRWo73tmS4Vg9cZnPoymunqglb1HALH2u/7+/DzCllV19CNmmo/gxzP7FfdTz41jWEhURzz33Mvb69pb+3tBPRZhbkaAM1NF39Rwm4CJz74t/8wuQEMyvFAR9TtyIh+5x/aQked42u7uNpdeeuL4KnHXWNsK3EHAQ6VMMRxaNJC0x6sXbcIsEKyx7IPVKq0usmL1XwN9KYqo00umPPkfxIWRhUMSW+udkIk2fMijphgM8UqlWhvUqZ1IPLcJANAM0/t2/npPCGOOI6m9klaGsXjMSUAj3t4uxnTplzeBevp5JFcB3jcuCP8fKKw4tJq58KHQFhA4CVgH+UCjySo2F1TV5N0/iW+cRUqwmEbvQwGzSG8wLDvkEVIvN/zn5U6tVOTsxTPafKPPdl6uxqdzKBJnPELiYmpEo4BxSGJc3vfF1g18bN1kHVqht5thWgbi7psF+4uM5YhUlC6//uxgWG/vwKBk4vUvmCnRqp9tJMk2YnfEryFGplU+r15BoN0Y2DWTClOT+uN79biDF14Ypx+PJ652xi0iNWmzeslxx0BfjQsyFcmU/9V+LkPky6MTNxpy62fa48YL/JbLx04Dw6Pe1br4yUPDB4O35S7q8Cyz+tnJP30jKDd9cPxf4Uu0yghD0WRhIGcn3ClSrPi8q1gQeQL6BJiq8TKEAzoWh3oHu/lxlzGoBUynw1JdbTZIQfd90+HaYKNlruarBBInqVlcGMlFw0jis5jYSlxv/hJD+JwZ3nkWl4rrMg0PP0k8OAFRFeLH7FPt2JohD5PEJUe6UC9anT/F0yZhkAQ9Mfqx+1Eo3dC+FpQsWzvWH6WgtCOz3JCYejkvw7lUc6AFT1ZX/S/NbcxvA/Jly+8D0re/7f9D1oWRZsjiV/rWf8w5mfgtZf1APBJLeUCOwz34WpgkCFiS9nyiWmm8b7el5HHK/wm8n8NFrVhNi3Ad5fofX6YUOIP5X32FxIh2kpFbOl9FH4Y+cp7Yl99Cnj8zYuuiDuEDUTD7VGsKORo1PmLis8Z7aoVmvgcsQ6CIQwVf85Zs6YZjcBeska0Q3IX9MF6ZkY5VJMyTGfqLGsM9tO9yX0+x9NjNJm/jKS8Nm2BcKs1CZGcyFFxmI5HbOFf7qiwhVATZPTEaNzA+esho9+CYfzCuYwzdydl6siwtZmkvy7lyUUTVEKBQ/JWD9wNeTm1c9ECImzqFlsbDw4copc32YulIMFx+ZCowZJ9TmQfAmRWcqcX4V5bXbkA2w1xnTAJJtl+ykcXklOSGBqgC6OTNIURdoVZZO3rnKCPF5UVG1qz4gM4= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: cabe8016-5a76-44d1-9804-08da763ff9b8 X-MS-Exchange-CrossTenant-AuthSource: DB6PR0101MB2214.eurprd01.prod.exchangelabs.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 04 Aug 2022 17:37:17.3800 (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: DB8PR01MB6503 Subject: [FFmpeg-devel] [PATCH 6/9] avcodec/cbs_internal: Use unions to shrink size of descriptors 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: wLVdXTNMFz7T Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs.c | 26 +++++++-------- libavcodec/cbs_internal.h | 69 ++++++++++++++++++++++----------------- libavcodec/cbs_mpeg2.c | 10 +++--- 3 files changed, 57 insertions(+), 48 deletions(-) diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index c81297ec93..57b57238ed 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -857,8 +857,8 @@ static void cbs_default_free_unit_content(void *opaque, uint8_t *data) const CodedBitstreamUnitTypeDescriptor *desc = opaque; if (desc->content_type == CBS_CONTENT_TYPE_INTERNAL_REFS) { int i; - for (i = 0; i < desc->nb_ref_offsets; i++) { - void **ptr = (void**)(data + desc->ref_offsets[i]); + for (i = 0; i < desc->type.ref.nb_offsets; i++) { + void **ptr = (void**)(data + desc->type.ref.offsets[i]); av_buffer_unref((AVBufferRef**)(ptr + 1)); } } @@ -880,12 +880,12 @@ static const CodedBitstreamUnitTypeDescriptor if (desc->nb_unit_types == 0) break; if (desc->nb_unit_types == CBS_UNIT_TYPE_RANGE) { - if (unit->type >= desc->unit_type_range_start && - unit->type <= desc->unit_type_range_end) + if (unit->type >= desc->unit_type.range.start && + unit->type <= desc->unit_type.range.end) return desc; } else { for (j = 0; j < desc->nb_unit_types; j++) { - if (desc->unit_types[j] == unit->type) + if (desc->unit_type.list[j] == unit->type) return desc; } } @@ -910,7 +910,8 @@ int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, unit->content_ref = av_buffer_create(unit->content, desc->content_size, - desc->content_free ? desc->content_free + desc->content_type == CBS_CONTENT_TYPE_COMPLEX + ? desc->type.complex.content_free : cbs_default_free_unit_content, (void*)desc, 0); if (!unit->content_ref) { @@ -936,10 +937,10 @@ static int cbs_clone_internal_refs_unit_content(AVBufferRef **clone_ref, if (!copy) return AVERROR(ENOMEM); - for (i = 0; i < desc->nb_ref_offsets; i++) { - const uint8_t *const *src_ptr = (const uint8_t* const*)(src + desc->ref_offsets[i]); + for (i = 0; i < desc->type.ref.nb_offsets; i++) { + const uint8_t *const *src_ptr = (const uint8_t* const*)(src + desc->type.ref.offsets[i]); const AVBufferRef *src_buf = *(AVBufferRef**)(src_ptr + 1); - uint8_t **copy_ptr = (uint8_t**)(copy + desc->ref_offsets[i]); + uint8_t **copy_ptr = (uint8_t**)(copy + desc->type.ref.offsets[i]); AVBufferRef **copy_buf = (AVBufferRef**)(copy_ptr + 1); if (!*src_ptr) { @@ -962,7 +963,6 @@ static int cbs_clone_internal_refs_unit_content(AVBufferRef **clone_ref, } *clone_ref = av_buffer_create(copy, desc->content_size, - desc->content_free ? desc->content_free : cbs_default_free_unit_content, (void*)desc, 0); if (!*clone_ref) { @@ -974,7 +974,7 @@ static int cbs_clone_internal_refs_unit_content(AVBufferRef **clone_ref, fail: for (--i; i >= 0; i--) - av_buffer_unref((AVBufferRef**)(copy + desc->ref_offsets[i])); + av_buffer_unref((AVBufferRef**)(copy + desc->type.ref.offsets[i])); av_freep(©); *clone_ref = NULL; return err; @@ -1010,9 +1010,9 @@ static int cbs_clone_unit_content(CodedBitstreamContext *ctx, break; case CBS_CONTENT_TYPE_COMPLEX: - if (!desc->content_clone) + if (!desc->type.complex.content_clone) return AVERROR_PATCHWELCOME; - err = desc->content_clone(&ref, unit); + err = desc->type.complex.content_clone(&ref, unit); break; default: diff --git a/libavcodec/cbs_internal.h b/libavcodec/cbs_internal.h index 314d54daea..4030b76f1c 100644 --- a/libavcodec/cbs_internal.h +++ b/libavcodec/cbs_internal.h @@ -60,13 +60,16 @@ typedef const struct CodedBitstreamUnitTypeDescriptor { // used instead. int nb_unit_types; - // Array of unit types that this entry describes. - const CodedBitstreamUnitType unit_types[CBS_MAX_UNIT_TYPES]; - - // Start and end of unit type range, used if nb_unit_types is - // CBS_UNIT_TYPE_RANGE. - const CodedBitstreamUnitType unit_type_range_start; - const CodedBitstreamUnitType unit_type_range_end; + union { + // Array of unit types that this entry describes. + CodedBitstreamUnitType list[CBS_MAX_UNIT_TYPES]; + // Start and end of unit type range, used if nb_unit_types is + // CBS_UNIT_TYPE_RANGE. + struct { + CodedBitstreamUnitType start; + CodedBitstreamUnitType end; + } range; + } unit_type; // The type of content described. enum CBSContentType content_type; @@ -74,18 +77,24 @@ typedef const struct CodedBitstreamUnitTypeDescriptor { // the decomposed content of this type of unit. size_t content_size; - // Number of entries in the ref_offsets array. Only used if the - // content_type is CBS_CONTENT_TYPE_INTERNAL_REFS. - int nb_ref_offsets; - // The structure must contain two adjacent elements: - // type *field; - // AVBufferRef *field_ref; - // where field points to something in the buffer referred to by - // field_ref. This offset is then set to offsetof(struct, field). - size_t ref_offsets[CBS_MAX_REF_OFFSETS]; - - void (*content_free)(void *opaque, uint8_t *data); - int (*content_clone)(AVBufferRef **ref, CodedBitstreamUnit *unit); + union { + struct { + // Number of entries in the ref_offsets array. Only nonzero + // if the content_type is CBS_CONTENT_TYPE_INTERNAL_REFS. + int nb_offsets; + // The structure must contain two adjacent elements: + // type *field; + // AVBufferRef *field_ref; + // where field points to something in the buffer referred to by + // field_ref. This offset is then set to offsetof(struct, field). + size_t offsets[CBS_MAX_REF_OFFSETS]; + } ref; + + struct { + void (*content_free)(void *opaque, uint8_t *data); + int (*content_clone)(AVBufferRef **ref, CodedBitstreamUnit *unit); + } complex; + } type; } CodedBitstreamUnitTypeDescriptor; typedef struct CodedBitstreamType { @@ -184,38 +193,38 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, #define TYPE_LIST(...) { __VA_ARGS__ } #define CBS_UNIT_TYPE_POD(type, structure) { \ .nb_unit_types = 1, \ - .unit_types = { type }, \ + .unit_type.list = { type }, \ .content_type = CBS_CONTENT_TYPE_POD, \ .content_size = sizeof(structure), \ } #define CBS_UNIT_TYPES_INTERNAL_REF(types, structure, ref_field) { \ .nb_unit_types = FF_ARRAY_ELEMS((CodedBitstreamUnitType[])TYPE_LIST types), \ - .unit_types = TYPE_LIST types, \ + .unit_type.list = TYPE_LIST types, \ .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \ .content_size = sizeof(structure), \ - .nb_ref_offsets = 1, \ - .ref_offsets = { offsetof(structure, ref_field) }, \ + .type.ref = { .nb_offsets = 1, \ + .offsets = { offsetof(structure, ref_field) } }, \ } #define CBS_UNIT_TYPE_INTERNAL_REF(type, structure, ref_field) \ CBS_UNIT_TYPES_INTERNAL_REF((type), structure, ref_field) #define CBS_UNIT_RANGE_INTERNAL_REF(range_start, range_end, structure, ref_field) { \ - .nb_unit_types = CBS_UNIT_TYPE_RANGE, \ - .unit_type_range_start = range_start, \ - .unit_type_range_end = range_end, \ + .nb_unit_types = CBS_UNIT_TYPE_RANGE, \ + .unit_type.range.start = range_start, \ + .unit_type.range.end = range_end, \ .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, \ .content_size = sizeof(structure), \ - .nb_ref_offsets = 1, \ - .ref_offsets = { offsetof(structure, ref_field) }, \ + .type.ref = { .nb_offsets = 1, \ + .offsets = { offsetof(structure, ref_field) } }, \ } #define CBS_UNIT_TYPES_COMPLEX(types, structure, free_func) { \ .nb_unit_types = FF_ARRAY_ELEMS((CodedBitstreamUnitType[])TYPE_LIST types), \ - .unit_types = TYPE_LIST types, \ + .unit_type.list = TYPE_LIST types, \ .content_type = CBS_CONTENT_TYPE_COMPLEX, \ .content_size = sizeof(structure), \ - .content_free = free_func, \ + .type.complex = { .content_free = free_func }, \ } #define CBS_UNIT_TYPE_COMPLEX(type, structure, free_func) \ CBS_UNIT_TYPES_COMPLEX((type), structure, free_func) diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c index 33bd3e0998..1c9519cdaf 100644 --- a/libavcodec/cbs_mpeg2.c +++ b/libavcodec/cbs_mpeg2.c @@ -392,14 +392,14 @@ static const CodedBitstreamUnitTypeDescriptor cbs_mpeg2_unit_types[] = { { .nb_unit_types = CBS_UNIT_TYPE_RANGE, - .unit_type_range_start = 0x01, - .unit_type_range_end = 0xaf, + .unit_type.range.start = 0x01, + .unit_type.range.end = 0xaf, .content_type = CBS_CONTENT_TYPE_INTERNAL_REFS, .content_size = sizeof(MPEG2RawSlice), - .nb_ref_offsets = 2, - .ref_offsets = { offsetof(MPEG2RawSlice, header.extra_information_slice.extra_information), - offsetof(MPEG2RawSlice, data) }, + .type.ref = { .nb_offsets = 2, + .offsets = { offsetof(MPEG2RawSlice, header.extra_information_slice.extra_information), + offsetof(MPEG2RawSlice, data) } }, }, CBS_UNIT_TYPE_INTERNAL_REF(MPEG2_START_USER_DATA, MPEG2RawUserData,