From patchwork Thu Aug 4 17:36:54 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 37136 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a21:1649:b0:8b:613a:194d with SMTP id no9csp536887pzb; Thu, 4 Aug 2022 10:38:06 -0700 (PDT) X-Google-Smtp-Source: AA6agR7xXp/c5oARS6Wyqb/ix8tBlpLGTyuaD/lkUej95yh6NVdP4bWpwTuEghajv/BP/AIgxeyW X-Received: by 2002:a05:6402:149:b0:431:7dde:9b59 with SMTP id s9-20020a056402014900b004317dde9b59mr3128636edu.339.1659634686581; Thu, 04 Aug 2022 10:38:06 -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 s2-20020a1709066c8200b0073061fb686dsi1213449ejr.343.2022.08.04.10.38.06; Thu, 04 Aug 2022 10:38:06 -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=rSfXhKum; 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 54F8268B93A; Thu, 4 Aug 2022 20:37:36 +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 B324868B9F8 for ; Thu, 4 Aug 2022 20:37:33 +0300 (EEST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=cVLHAAhxMAzb4UoupaCTcRbj8MtFK05oF6wqT0orMCSdMj1Iv01o3vELMnrU0nu/9H9uCe0buHfvkL7Bh1N8ixzhezlYfGMADSq0GZ/JRBY098HrJVyqGC0dstUz7nKVZYmOg159Uq5GYTPGJoBxPwuvHgrRZc/3jYHgwcv/Wr4oET5iw7wzBepTOMeUSdISq2Cj9XPL9DPuYRFypQdd7hPvj0oiK0zcZ65/bVTvmliqdWJ9/8dWFJSRDs6qwWcjPWYZzhQ4l7vb8ldzA1xSl3F0V2LiugGu6pD14+4YeN8dkTqwDw4N4XNqJKiKpKFPsZhkz5P15GIYjgi3CGXWQQ== 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=SeZCHjp9ZGbF4SGXrVNrBcg84UY39jhfj6Cpkb4Pqc8=; b=EsziJMbBZJ3PFpTFSIJYHCVelOF56xjnHQnVqcK8WGzM/+uaB7e6q3N8yKDb+/hYPduS+UpGrCpnzfJxt34404wgOb041jHJwRAmM21U8TDqsY4AFSicWRjLF/Oyr/Ulw5LEDMjLpoTMex8kv0fEG9Pnk7OtycDt7RV6SgxBDSD4LAxsWHXimuCmcqXWa9xFpdyPIvGIxmh+qBsHdjZV5ey9eumMoOZubD8LpeUexN5B+QxrE/EGIiXP6UXxEeVVjQ7KiFXJsOmflns9Ph92p8ylDxCyTMXmfMhN188E9GRfIMTQAu6APVXzBvPN5S0icjPv6GUKppF03hD22QK3Pg== 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=SeZCHjp9ZGbF4SGXrVNrBcg84UY39jhfj6Cpkb4Pqc8=; b=rSfXhKumy88QKq3eNAsRtS0G8UhsXClOjXOQopZpvYd6iR4aJbbrcrdMvsIRYZcJZwkI1O+vji4ulv6Il/fRnvua/ZIVNmHqFFJe9wDx6G16cL7mBuxy5gW7bv7NNZMzNArIJb6YGexvoyOrZiSqi4GtdcQyfuhLy8IvXh6zTVxiT2IZPlxwluDjzX1sp7uJKBb/JqmEWShF3YdQTR3iF8NFCtW86OnPgf+5rDNiY1mHMM9j2+5ftLMhKmZQ+uee41qSHYar9vL7tRo/4g79tSfvCa+EVBwku9s51fKuGHpJj0u3LDsJ/pnhJJ51TFPwBiNReie0E0W+mUdqbyyWoA== 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:19 +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:19 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 4 Aug 2022 19:36:54 +0200 Message-ID: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: X-TMN: [j/yLdUBg9lBKR13k7OI1hJhKIpqQ0xvL] 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-7-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 77af1872-5356-4b47-96aa-08da763ffb01 X-MS-Exchange-SLBlob-MailProps: dEG5jEBie8mQ1Nbr3MDquWuavSVdwHSdwdGDVTR/qZK8yEEwqz4y3G8uJHXzIs/mPVSjupUC3RUGuCzR6JXyfnHtSFWbIdSX9mvjyTbhML/a+JMhk+bFchZunyqes8sZrOix7LqbaKOhNHiRyzJuLpMyszFMnr790nsN1NZ+XTkMZjXbqPdysPs94PbVz3yCaRWg6KeRaUZJ6S8a7xmHmxbw97K+XDKhv+izObO3zO0OoM9lDoBW6ZmspzWgRQz/5TkzypdTHXH+1EUU1/HTqEushQJOoBRzWHCsaOHMyJ4Y6a48Ol9u2i/Hr2o2/WZC0wwJtE/mpLtYLuvz3prgn91f8OUWeBcq2kb19//PZP2aYJ7cq+PxhuzppFVSFLABu5QptHa0+FB4y6HBoUTiHdC6OeTLle16VVT+7J3Y8Eh7hv/9lP0McRmLmhOEI8c51/N7Y1gcTkKF+/PjxJxDd+pPEoJGCuxQkxGJHYZLvugRZfXWscYmXbQSc6wT8q4ZZX/l1yJd5rVGm3LqHRyqwPFDZqveHiZ0YxwBBzWDR6sEPvecCrRrkSDabwlKOm5pqgA0+V7HlRzINbf+jqu+2qH2f4fLw6cdjzPY8NKs/ikQz2Z391vVO+naRUg9w3J4zzITBQNDjFsHKC/IYeuTh6euXOmPwS0pi9I0RE+R3DGkA1hwNges+A== X-MS-TrafficTypeDiagnostic: DB8PR01MB6503:EE_ X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 6jKqgah/JRcn+rT+gFa+/m62k3K9+byT8gr7fcRmV1Co3UU+ZuVk9ANBXVm1K8evnGZU+5Bj72SlYyLA595e32PaEcGb9A0gVgM6StO2DlxLl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WkSebGlHA8YH+ZEE/DTgtG/sKoWFZUGrbJ/pzc6Pu0exSy+7EOgxxHA+nANfcHyQyMyhjHOdjhLJQzFNnHP4FoUyKwFdPSBxHZUZ8QnW3aF7wGrnbw2lGoM6J+iMK/xe+omWYC2bFILXQ3rfcjzJgcYb9SnkhM3ZCv+zzcr2noMbiB6gaEmkgbfdxt2svf13KlYlSSXN+I7uxL3gptDISl7NaM3nh12Fc63utgLpunIqL/DSGxpiKqCmoTybW0q5TlSlgPGIIfXomnNCaBwo09Cyz/d9WG7FCx2lQW2wP4mIWbG5VX8lFoEHXg2S1hO3oG7z+jJlrPESaxDpfTirRn08w69Dl7XVz3oFlSzqoTbaiILy5CsVEx3qLd9BtZcqfx0wBqo4K1bW06/ahiqsKAz929d97szf+nNtHTa+ZMqufBplK+wAmcBB6ptuYTV7ZPkGeeTfZ10CMXeIcmJK6SWUc0TXlNIDNVwk0fmVQBukvN5RBDcwbpsncYrkLj+tPZUxLMI+R5zIdCSVyo8zoAgdzaclAthMxoEfrAfzQ8dTtzhi6vxwMvlA71t3QQ3cUSYqiYA8CFEzlf/1/ILFHN7Iuq3SEZXHAB0wO21rK2EdqsHXIQ42v5gns4W9R9mact0lvCPflwg0Tj+IjMQG7JBFxgvhdu5gLbHyuaig3lDKyvzSZhLYQn4IrgYkd0Tb94UnA11jMSCLPay8eG5teh58ZATQsxWWcIfJ9e61+MeAwVMn/tKQbYqpp5p9MSvWvLk1QbeLqC2h1MM6LKOtxWIyU5v/2NoJaiMm/KTQjIKrx3T+EsIzczTC6K7tTViecjEbW31aVt6M= X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 77af1872-5356-4b47-96aa-08da763ffb01 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:19.4892 (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 8/9] avcodec/cbs: Remove ff_cbs_alloc_unit_content 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: pRRF1QhDuXgy It is no longer used. Also rename ff_cbs_alloc_unit_content2 to ff_cbs_alloc_unit_content. Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs.c | 24 ++---------------------- libavcodec/cbs.h | 13 ++----------- libavcodec/cbs_av1.c | 2 +- libavcodec/cbs_h2645.c | 4 ++-- libavcodec/cbs_jpeg.c | 2 +- libavcodec/cbs_mpeg2.c | 2 +- libavcodec/cbs_sei.c | 2 +- libavcodec/cbs_vp9.c | 2 +- 8 files changed, 11 insertions(+), 40 deletions(-) diff --git a/libavcodec/cbs.c b/libavcodec/cbs.c index 57b57238ed..07ae658a4c 100644 --- a/libavcodec/cbs.c +++ b/libavcodec/cbs.c @@ -695,26 +695,6 @@ int ff_cbs_write_signed(CodedBitstreamContext *ctx, PutBitContext *pbc, } -int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, - size_t size, - void (*free)(void *opaque, uint8_t *data)) -{ - av_assert0(!unit->content && !unit->content_ref); - - unit->content = av_mallocz(size); - if (!unit->content) - return AVERROR(ENOMEM); - - unit->content_ref = av_buffer_create(unit->content, size, - free, NULL, 0); - if (!unit->content_ref) { - av_freep(&unit->content); - return AVERROR(ENOMEM); - } - - return 0; -} - static int cbs_insert_unit(CodedBitstreamFragment *frag, int position) { @@ -893,8 +873,8 @@ static const CodedBitstreamUnitTypeDescriptor return NULL; } -int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, - CodedBitstreamUnit *unit) +int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, + CodedBitstreamUnit *unit) { const CodedBitstreamUnitTypeDescriptor *desc; diff --git a/libavcodec/cbs.h b/libavcodec/cbs.h index 5583063b5e..ee21623dac 100644 --- a/libavcodec/cbs.h +++ b/libavcodec/cbs.h @@ -363,22 +363,13 @@ void ff_cbs_fragment_reset(CodedBitstreamFragment *frag); */ void ff_cbs_fragment_free(CodedBitstreamFragment *frag); -/** - * Allocate a new internal content buffer of the given size in the unit. - * - * The content will be zeroed. - */ -int ff_cbs_alloc_unit_content(CodedBitstreamUnit *unit, - size_t size, - void (*free)(void *opaque, uint8_t *content)); - /** * Allocate a new internal content buffer matching the type of the unit. * * The content will be zeroed. */ -int ff_cbs_alloc_unit_content2(CodedBitstreamContext *ctx, - CodedBitstreamUnit *unit); +int ff_cbs_alloc_unit_content(CodedBitstreamContext *ctx, + CodedBitstreamUnit *unit); /** * Insert a new unit into a fragment with the given content. diff --git a/libavcodec/cbs_av1.c b/libavcodec/cbs_av1.c index 1229480567..154d9156cf 100644 --- a/libavcodec/cbs_av1.c +++ b/libavcodec/cbs_av1.c @@ -878,7 +878,7 @@ static int cbs_av1_read_unit(CodedBitstreamContext *ctx, GetBitContext gbc; int err, start_pos, end_pos; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; obu = unit->content; diff --git a/libavcodec/cbs_h2645.c b/libavcodec/cbs_h2645.c index 117b609dc3..e0c617e81d 100644 --- a/libavcodec/cbs_h2645.c +++ b/libavcodec/cbs_h2645.c @@ -702,7 +702,7 @@ static int cbs_h264_read_nal_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; @@ -821,7 +821,7 @@ static int cbs_h265_read_nal_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; diff --git a/libavcodec/cbs_jpeg.c b/libavcodec/cbs_jpeg.c index 2afeecfa79..5921d624a1 100644 --- a/libavcodec/cbs_jpeg.c +++ b/libavcodec/cbs_jpeg.c @@ -227,7 +227,7 @@ static int cbs_jpeg_read_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; diff --git a/libavcodec/cbs_mpeg2.c b/libavcodec/cbs_mpeg2.c index 1c9519cdaf..04b0c7f87d 100644 --- a/libavcodec/cbs_mpeg2.c +++ b/libavcodec/cbs_mpeg2.c @@ -204,7 +204,7 @@ static int cbs_mpeg2_read_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; diff --git a/libavcodec/cbs_sei.c b/libavcodec/cbs_sei.c index 141e97ec58..50a513f592 100644 --- a/libavcodec/cbs_sei.c +++ b/libavcodec/cbs_sei.c @@ -179,7 +179,7 @@ static int cbs_sei_get_unit(CodedBitstreamContext *ctx, unit = &au->units[position]; unit->type = sei_type; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; diff --git a/libavcodec/cbs_vp9.c b/libavcodec/cbs_vp9.c index ae7f88a8a3..184fdcade6 100644 --- a/libavcodec/cbs_vp9.c +++ b/libavcodec/cbs_vp9.c @@ -489,7 +489,7 @@ static int cbs_vp9_read_unit(CodedBitstreamContext *ctx, if (err < 0) return err; - err = ff_cbs_alloc_unit_content2(ctx, unit); + err = ff_cbs_alloc_unit_content(ctx, unit); if (err < 0) return err; frame = unit->content;