From patchwork Wed Feb 21 23:32:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Rheinhardt X-Patchwork-Id: 46422 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6a20:26a3:b0:19e:cdac:8cce with SMTP id h35csp22206pze; Wed, 21 Feb 2024 15:45:29 -0800 (PST) X-Forwarded-Encrypted: i=2; AJvYcCWfPUt7giYjxNK1gG+vUIz2H6o6E9uL9ekzlqyMzMjRLfuhxib8/PRguZRZ2JFQa7+ynQCH0wmrbrybMkKs56Rn9i6tmsXA7DkHOg== X-Google-Smtp-Source: AGHT+IEx2S4J1Z8xLzV5WqiGLeELZ8vX1iCzpDHrYSuSLDBiwZO90rZBEuAHIzYPyUWWsf3U87rB X-Received: by 2002:a17:906:4e97:b0:a3f:7fac:6aca with SMTP id v23-20020a1709064e9700b00a3f7fac6acamr97514eju.57.1708559129445; Wed, 21 Feb 2024 15:45:29 -0800 (PST) Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id d9-20020a170906344900b00a3f67171f57si363779ejb.96.2024.02.21.15.45.28; Wed, 21 Feb 2024 15:45:29 -0800 (PST) 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=JnmGf28v; 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 649F968D1B3; Thu, 22 Feb 2024 01:45:26 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01olkn2051.outbound.protection.outlook.com [40.92.66.51]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 701EF68D089 for ; Thu, 22 Feb 2024 01:45:24 +0200 (EET) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HrU1pYucYI0SswRyBwr1TrrNwC9DeUg1LUQOTcMzhdMKQMpRsrBKwL7NCjRjCr+OWau4wYhTJfeo3DifflX0V9a+qET3cqnODZaTHsuRxJz9w4FqnscSbeqde36gpYmK87UTiaVocNbVvV9bR/kUsu4c20lwC3iN5WFijOZCvDXqC72wkOeNTDM7R/4HPluHOPhKJk3EFSfuldFmOKzYXKA8Zj98x7sGuuafNo1J1P5SuMy4mSBPYbj/sdp8QDxsqjGQB9CSb8wBkdhNkMP+qf8/uWwiBzmzeU04owkr4wu8emOnl6m+dZRLiL03MzpYjQS9q0SVJqKFJI9wNqN9tw== 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=9LnnjpIERxtzgIkOP+faVUftysVvgnemv/bXG7wK7yc=; b=nYXHbXWEsmukGUs85ggtEqRvzebwr/1CNqPRDVAM3EsGlz5bHXh9TpGU/fZkaFS4krQKySYrmW0HZdej6yJ/zHpnOhymB3zJBNLJBFzLFWgHodYAYmY8ZD6+elgduQmRc86orJwmmHUZc7L4tKFZwyTmEFUjsH9WtFyCvBVS/+jslmSzQ2AjQsbFtmi57TwNDMohn3V01svKs1VGD79RvE4CoFhhr2TEteqyspjmlOHC4Fr4TluIqHIxOq5Ve8ZvhdaCx4EG2GC9pMnsyENGS1jFE4M9FH/utEAwUXFzqD4Hr1z9n2R1LV/B3BugA8WoYpfQNE2W93IQ+MjlQzS4Bg== 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=9LnnjpIERxtzgIkOP+faVUftysVvgnemv/bXG7wK7yc=; b=JnmGf28vYOy9TDq6Qu5gWkzLTXQNIvJJ6ke30Cs3Rr+9uNc/WgcKBe5I/W9uuJukpjjFTQywlPY6tRsMKMk3mip9bZvPLMqr8dF/sVPeFeGbYqkmkduAfdbhWRw+apdnuGj92SE0k7LMT3QfuNY3L3Ao0ysICtZ44iU1DTKrBb75giHr4THbPOulEaB1pc3GzuUYPKge7k2X/GcNdl57mBslpojvJ7IKemYTvqOxuo3jmjGPQTNUdHD92H16+A4fFMwB7wMuo3y0f6HEuaWhVipFXzQ8U4g0iBYxKOXuOIM/ymp0X84KZx7/3tFOMtanE8VScohPhHCFpi/h9xQuKA== Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) by PR3P250MB0258.EURP250.PROD.OUTLOOK.COM (2603:10a6:102:17d::5) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7316.21; Wed, 21 Feb 2024 23:30:18 +0000 Received: from AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d]) by AS8P250MB0744.EURP250.PROD.OUTLOOK.COM ([fe80::65aa:deb0:a18e:d48d%5]) with mapi id 15.20.7292.033; Wed, 21 Feb 2024 23:30:18 +0000 From: Andreas Rheinhardt To: ffmpeg-devel@ffmpeg.org Date: Thu, 22 Feb 2024 00:32:09 +0100 Message-ID: X-Mailer: git-send-email 2.40.1 In-Reply-To: References: X-TMN: [s52b4fUujbGllq6Uu0IsrJ638Q9DJVSllDcxtDkhAXM=] X-ClientProxiedBy: ZR0P278CA0205.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:6a::12) To AS8P250MB0744.EURP250.PROD.OUTLOOK.COM (2603:10a6:20b:541::14) X-Microsoft-Original-Message-ID: <20240221233209.1862129-2-andreas.rheinhardt@outlook.com> MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AS8P250MB0744:EE_|PR3P250MB0258:EE_ X-MS-Office365-Filtering-Correlation-Id: 8493e03e-8f85-4a63-cd44-08dc33351065 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: oF0BsuLVvB30edoQBxLFWFGf3jMsIDWcdDlnqTz4O/pGiq9ciZAww+fWLUTi3IdYgGBU/hlrYYbcsRyaUdzHaCeXF3hEEst6Vv+qpTT6WJyBLZcD3CgCthUszfp3MyZQrudIhzDiUEPJVexRtJyPIQQOI3BN5q1kDzAm940V8814cK2ObchNaU7i7MCJ714LjlAmuHure3mM/F6yylVWfiO/CDiPyXjHTS33lipohaD9WLpNejPmJfiFxBRQ4zVRPzNjiYED0iPSNlqay2P6s8m+gUwMJZ0tqvUDa0tBB/Lxt19YyXBenuFfoOerfF94DzbOxn6It0FUPiVD4l0/O3cN3nL8oijhIiAYxdc+kLbmgi4HZWjgu1nzoGIBsqBr3oR0aT5LRNG6NidZhkZtJsApdcRsamdER7S2B2v28TpCxeU4hYC6KPe1PyMcytJJXMEaJIAFTomjotPcvtJfnkSQ38x47zhvOsE7u1lFWJKbAZNQqNhOQ9Oxi4vYAF5uzxZNtI36iG6+4eMcAbnbFdzeNnDtb0c32Hbfa9z2mR3ACbG4QhnACyYAjwj8eKiBLiqEHv9/iOrPYAn/mVN47NPPAKxzJBAWL33vmrQIUmrYEnCZbaE8wRjvbDst3mrU X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: dNvogVCw0gXKGhW9+2liv3N50BA6QpbSanMzLcQCNMpzO5CWAFbTXvnab6C0E/nvX7iJRN5xwTGyCVNKSm2097va92GkNkH2Me6vMhLl80MZfqIiY8jsKpuAHkqdcj3Dq40mLzAkJ9jA7Ph0u9BFBidf/g8iOd1J3ngWOA8S+zuVCs4teJa9+vwQJb4Hfxto5s8OBjTd5jB9UlrezbxRn5YHhwBpXUjlY8ondkZKIZZlCz/IRAJ17vhvRsW0H5NbBycpIQ8DsSXKDqm2vlLu6wOhGkdT9Pc17oo/f/mnXe9kNdAqhGcZUcdPOq3MTB7+CSzvPr5SoogrhH0IhK3F0/6GW8xQbAaxr2ncj32pKAe8qabiuNZFjlChNP/pA4zpYyLYo6bszkR4i1KK3G/fRH9RsyKq/MMiiWIOhfTN6fbz/JTo91ZPLXWwIj4slUkExhRmVLuU6aILjIPF6qLIgdlJdNzv0dKEku1ZvRGnWxya14A0EeVCMBFH8FXJOn0WgqyMv/LrvMgqYoAgAZyuUJYxyxG5f01gpn25fG6Tuivkh3zLSNcdLBkUCm/wEo8sA8mGVZnTclkL5ICEHuPa6iEmdf3Ie/HOK5Hs8v9ZH7agcuzmqAYcNd+D4mIvdOXbiVWmdpqJ7EiOKdioug3Yg9EKgJTGVYw0/gAORTUcDeO/ur87Cj4p2dxFPHMmMAWL5asnt20G/QXm68zLge8//ZqAT2DAxvt96RTye62o1Kx7Zyq3t70JjuIL8TgYYqQ4DHLWAXkDAuJs1Ro3v4OGRfE2tgPyk4DWh5a6/fyN69T8t6i3BoogeiL9UnOVyCGDWmktE4Hho3tjkTmDAj4THl5Ko4uvqYw+/arOJZAkY0lvYtLBRd9YbgQFpCTRObNK7u7RLPE7zh8q5WHHbT4gz+VaFSVE5hxrRYzKpTjm78ZvNjpoHAxxW0I8ovDLnaKXftk/p9BFdn1RvXyI6I9aKI+XkYUcOZF+YWkdHV0oLVjVm1zUmUOWptrZwOP6990HDMpRRQNIrl5HMgKuZwDlvnX5Z/Sb20dlpOGo9Cc5OJHUmhBQWpZdhqApXpmAwEq5U0RiMwmgwSxRs6c4ztCSe0ke/HAlgRtMRYJuxkEsFJNGnw19YLt2LUVZ9lcbocDyp8s4b3rDz70RNoMnD42i8W3Zq7OrE1/pkRK18nZi/rg9TW2XXQm1A4tQe/nSrGklFDmf8JM6LkYH0kuoxXEUZcFoRq3W0+yQYEzO0oGGkSNvWfu/Pq6ku7wqB+8uPI2ryGKtk6Um6umVbW1CFCNf4A== X-OriginatorOrg: outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 8493e03e-8f85-4a63-cd44-08dc33351065 X-MS-Exchange-CrossTenant-AuthSource: AS8P250MB0744.EURP250.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 21 Feb 2024 23:30:18.2827 (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: PR3P250MB0258 Subject: [FFmpeg-devel] [PATCH 3/3] avcodec/cbs_h2645: Avoid function pointer casts, fix UB 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: 4BwZSmJyKRci The SEI message read/write functions are called via function pointers where the SEI message-specific context is passed as void*. But the actual function definitions use a pointer to their proper context in place of void*, making the calls undefined behaviour. Clang UBSan 17 warns about this. This commit fixes this by making the functions match the type of the call. This reduced the number of failing FATE tests with UBSan from 164 to 85 here. Signed-off-by: Andreas Rheinhardt --- libavcodec/cbs_h264_syntax_template.c | 24 ++++++++++----------- libavcodec/cbs_h265_syntax_template.c | 31 +++++++++++++++++---------- libavcodec/cbs_h266_syntax_template.c | 6 +++--- libavcodec/cbs_sei.h | 8 +++---- libavcodec/cbs_sei_syntax_template.c | 23 ++++++++++++-------- 5 files changed, 52 insertions(+), 40 deletions(-) diff --git a/libavcodec/cbs_h264_syntax_template.c b/libavcodec/cbs_h264_syntax_template.c index 0f8bba4a0d..282cd24292 100644 --- a/libavcodec/cbs_h264_syntax_template.c +++ b/libavcodec/cbs_h264_syntax_template.c @@ -511,9 +511,9 @@ static int FUNC(pps)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_buffering_period)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIBufferingPeriod *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIBufferingPeriod *current = current_; CodedBitstreamH264Context *h264 = ctx->priv_data; const H264RawSPS *sps; int err, i, length; @@ -605,9 +605,9 @@ static int FUNC(sei_pic_timestamp)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIPicTiming *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIPicTiming *current = current_; CodedBitstreamH264Context *h264 = ctx->priv_data; const H264RawSPS *sps; int err; @@ -677,9 +677,9 @@ static int FUNC(sei_pic_timing)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_pan_scan_rect)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIPanScanRect *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIPanScanRect *current = current_; int err, i; HEADER("Pan-Scan Rectangle"); @@ -704,9 +704,9 @@ static int FUNC(sei_pan_scan_rect)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_recovery_point)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIRecoveryPoint *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIRecoveryPoint *current = current_; int err; HEADER("Recovery Point"); @@ -720,9 +720,9 @@ static int FUNC(sei_recovery_point)(CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawFilmGrainCharacteristics *current, - SEIMessageState *state) + void *current_, SEIMessageState *state) { + H264RawFilmGrainCharacteristics *current = current_; CodedBitstreamH264Context *h264 = ctx->priv_data; const H264RawSPS *sps; int err, c, i, j; @@ -803,9 +803,9 @@ static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContex } static int FUNC(sei_display_orientation)(CodedBitstreamContext *ctx, RWContext *rw, - H264RawSEIDisplayOrientation *current, - SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H264RawSEIDisplayOrientation *current = current_; int err; HEADER("Display Orientation"); diff --git a/libavcodec/cbs_h265_syntax_template.c b/libavcodec/cbs_h265_syntax_template.c index 2d4b954718..53ae0cabff 100644 --- a/libavcodec/cbs_h265_syntax_template.c +++ b/libavcodec/cbs_h265_syntax_template.c @@ -1620,8 +1620,9 @@ static int FUNC(slice_segment_header)(CodedBitstreamContext *ctx, RWContext *rw, static int FUNC(sei_buffering_period) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIBufferingPeriod *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIBufferingPeriod *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawSPS *sps; const H265RawHRDParameters *hrd; @@ -1730,8 +1731,9 @@ static int FUNC(sei_buffering_period) static int FUNC(sei_pic_timing) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIPicTiming *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIPicTiming *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawSPS *sps; const H265RawHRDParameters *hrd; @@ -1806,8 +1808,9 @@ static int FUNC(sei_pic_timing) static int FUNC(sei_pan_scan_rect) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIPanScanRect *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIPanScanRect *current = current_; int err, i; HEADER("Pan-Scan Rectangle"); @@ -1833,8 +1836,9 @@ static int FUNC(sei_pan_scan_rect) static int FUNC(sei_recovery_point) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIRecoveryPoint *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIRecoveryPoint *current = current_; int err; HEADER("Recovery Point"); @@ -1848,9 +1852,9 @@ static int FUNC(sei_recovery_point) } static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContext *rw, - H265RawFilmGrainCharacteristics *current, - SEIMessageState *state) + void *current_, SEIMessageState *state) { + H265RawFilmGrainCharacteristics *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawSPS *sps = h265->active_sps; int err, c, i, j; @@ -1914,8 +1918,9 @@ static int FUNC(film_grain_characteristics)(CodedBitstreamContext *ctx, RWContex static int FUNC(sei_display_orientation) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIDisplayOrientation *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIDisplayOrientation *current = current_; int err; HEADER("Display Orientation"); @@ -1933,8 +1938,9 @@ static int FUNC(sei_display_orientation) static int FUNC(sei_active_parameter_sets) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIActiveParameterSets *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIActiveParameterSets *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawVPS *vps; int err, i; @@ -1970,8 +1976,9 @@ static int FUNC(sei_active_parameter_sets) static int FUNC(sei_decoded_picture_hash) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIDecodedPictureHash *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIDecodedPictureHash *current = current_; CodedBitstreamH265Context *h265 = ctx->priv_data; const H265RawSPS *sps = h265->active_sps; int err, c, i; @@ -2002,8 +2009,9 @@ static int FUNC(sei_decoded_picture_hash) static int FUNC(sei_time_code) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEITimeCode *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEITimeCode *current = current_; int err, i; HEADER("Time Code"); @@ -2053,8 +2061,9 @@ static int FUNC(sei_time_code) static int FUNC(sei_alpha_channel_info) (CodedBitstreamContext *ctx, RWContext *rw, - H265RawSEIAlphaChannelInfo *current, SEIMessageState *sei) + void *current_, SEIMessageState *sei) { + H265RawSEIAlphaChannelInfo *current = current_; int err, length; HEADER("Alpha Channel Information"); diff --git a/libavcodec/cbs_h266_syntax_template.c b/libavcodec/cbs_h266_syntax_template.c index e75f2f6971..8a2adeb9e4 100644 --- a/libavcodec/cbs_h266_syntax_template.c +++ b/libavcodec/cbs_h266_syntax_template.c @@ -3428,10 +3428,10 @@ static int FUNC(slice_header) (CodedBitstreamContext *ctx, RWContext *rw, } static int FUNC(sei_decoded_picture_hash) (CodedBitstreamContext *ctx, - RWContext *rw, - H266RawSEIDecodedPictureHash * - current, SEIMessageState *unused) + RWContext *rw, void *current_, + SEIMessageState *unused) { + H266RawSEIDecodedPictureHash *current = current_; int err, c_idx, i; HEADER("Decoded Picture Hash"); diff --git a/libavcodec/cbs_sei.h b/libavcodec/cbs_sei.h index 4511c506cc..6d1bed4171 100644 --- a/libavcodec/cbs_sei.h +++ b/libavcodec/cbs_sei.h @@ -126,12 +126,10 @@ typedef struct SEIMessageTypeDescriptor { SEIMessageWriteFunction write; } SEIMessageTypeDescriptor; -// Macro for the read/write pair. The clumsy cast is needed because the -// current pointer is typed in all of the read/write functions but has to -// be void here to fit all cases. +// Macro for the read/write pair. #define SEI_MESSAGE_RW(codec, name) \ - .read = (SEIMessageReadFunction) cbs_ ## codec ## _read_ ## name, \ - .write = (SEIMessageWriteFunction)cbs_ ## codec ## _write_ ## name + .read = cbs_ ## codec ## _read_ ## name, \ + .write = cbs_ ## codec ## _write_ ## name // End-of-list sentinel element. #define SEI_MESSAGE_TYPE_END { .type = -1 } diff --git a/libavcodec/cbs_sei_syntax_template.c b/libavcodec/cbs_sei_syntax_template.c index 62dd1dabaa..16d2cbc406 100644 --- a/libavcodec/cbs_sei_syntax_template.c +++ b/libavcodec/cbs_sei_syntax_template.c @@ -18,8 +18,9 @@ static int FUNC(filler_payload) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawFillerPayload *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawFillerPayload *current = current_; int err, i; HEADER("Filler Payload"); @@ -36,8 +37,9 @@ static int FUNC(filler_payload) static int FUNC(user_data_registered) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawUserDataRegistered *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawUserDataRegistered *current = current_; int err, i, j; HEADER("User Data Registered ITU-T T.35"); @@ -68,8 +70,9 @@ static int FUNC(user_data_registered) static int FUNC(user_data_unregistered) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawUserDataUnregistered *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawUserDataUnregistered *current = current_; int err, i; HEADER("User Data Unregistered"); @@ -96,8 +99,9 @@ static int FUNC(user_data_unregistered) static int FUNC(mastering_display_colour_volume) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawMasteringDisplayColourVolume *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawMasteringDisplayColourVolume *current = current_; int err, c; HEADER("Mastering Display Colour Volume"); @@ -118,8 +122,9 @@ static int FUNC(mastering_display_colour_volume) static int FUNC(content_light_level_info) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawContentLightLevelInfo *current, SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawContentLightLevelInfo *current = current_; int err; HEADER("Content Light Level Information"); @@ -132,9 +137,9 @@ static int FUNC(content_light_level_info) static int FUNC(alternative_transfer_characteristics) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawAlternativeTransferCharacteristics *current, - SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawAlternativeTransferCharacteristics *current = current_; int err; HEADER("Alternative Transfer Characteristics"); @@ -146,9 +151,9 @@ static int FUNC(alternative_transfer_characteristics) static int FUNC(ambient_viewing_environment) (CodedBitstreamContext *ctx, RWContext *rw, - SEIRawAmbientViewingEnvironment *current, - SEIMessageState *state) + void *current_, SEIMessageState *state) { + SEIRawAmbientViewingEnvironment *current = current_; static const uint16_t max_ambient_light_value = 50000; int err;