From patchwork Sat Jul 24 15:29:46 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Nicolas George X-Patchwork-Id: 29042 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a5d:965a:0:0:0:0:0 with SMTP id d26csp2320741ios; Sat, 24 Jul 2021 08:30:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwM1XTVprbijgNlB6bImcKvvyZvh3eHlWewlRg9N4FMI+VUGF1rfzxXroeX9PsycH5Fs9HL X-Received: by 2002:a17:906:2541:: with SMTP id j1mr9763790ejb.128.1627140601776; Sat, 24 Jul 2021 08:30:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1627140601; cv=none; d=google.com; s=arc-20160816; b=lDptkIDqs1Ygi1lNLLJkfP9r4rfRlPB96kFjn6+rlCQlOMrvD5VHVFWQkVeWwLJ8dI 3qldBF2VyRqDo0cjjU0RD1T+x8CGJWBuzEOTGMQ0u0a20+WlN+i7MM51UVpT4coa75n1 V6F4U4MyzY6iMvzws4ieUjXuPO9D8sS5REo2VdhBL+vG1U9NNqFff+H41xUB0i2A2S04 kibMQDgmF57scP77g4YCirObgfdLxbe3LWP8navrvzzQ7cjbURT6EdqBhnn7m1zpo/Wm l6hj34RQ57ISUQ8AcrGuZW0u/s/oE7wV14Qtdjf/EPBk9VopVYVPUx9N6XSlXozZXdS4 F4eg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:reply-to:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:subject:mime-version:message-id:date:to:from :delivered-to; bh=KC9pqJGZyKIq3pd9gsoYJyIsaXE+JlbsZbMEcdRbwHs=; b=BzTlVWOpRus9VZtgVZsI6ObLJVt6sPTL7yDNBcHY2ujzAbib7BSx4CQeWsNsom+0xP OyDsw605AI45Uzwxhlsc5ytDxR9Vs/B18u42gGd7Z5aPJEMw2gncYXFjPiibHNFfNtLI VoGHhrpEPPSi00LjFm+jJpFt5ru4HyIS8DBj6cDXfMmhYcXg5MmN1A+5VFRHYjR7TNiJ ZHo8Jvtguzn00EMXsTDXrJBEEXHYInA7CB2eP7mEjYwI+vkZBETRsT69rLqknUILnnEp 6FlXuunnMdfoHYeTcRmBurfBIOrQTOG4HOq+rroQuQreKlZ1Mdf7gAINcRDNh2nO3tQ4 4yKQ== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id b18si2919555edw.290.2021.07.24.08.30.01; Sat, 24 Jul 2021 08:30:01 -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; 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 Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 6BA1C68AA07; Sat, 24 Jul 2021 18:29:58 +0300 (EEST) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from nef.ens.fr (nef2.ens.fr [129.199.96.40]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 639E768A5A8 for ; Sat, 24 Jul 2021 18:29:51 +0300 (EEST) X-ENS-nef-client: 129.199.129.80 ( name = phare.normalesup.org ) Received: from phare.normalesup.org (phare.normalesup.org [129.199.129.80]) by nef.ens.fr (8.14.4/1.01.28121999) with ESMTP id 16OFToEF004860 for ; Sat, 24 Jul 2021 17:29:50 +0200 Received: by phare.normalesup.org (Postfix, from userid 1001) id 499CCE0027; Sat, 24 Jul 2021 17:29:50 +0200 (CEST) From: Nicolas George To: ffmpeg-devel@ffmpeg.org Date: Sat, 24 Jul 2021 17:29:46 +0200 Message-Id: <20210724152947.258052-1-george@nsup.org> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.4.3 (nef.ens.fr [129.199.96.32]); Sat, 24 Jul 2021 17:29:50 +0200 (CEST) Subject: [FFmpeg-devel] [PATCH 1/2] lavu/internal: add FF_FIELD_AT(). 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 Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" X-TUID: B8SQrvvzr5rR Signed-off-by: Nicolas George --- libavutil/internal.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/libavutil/internal.h b/libavutil/internal.h index a33e8700c3..2011813932 100644 --- a/libavutil/internal.h +++ b/libavutil/internal.h @@ -103,6 +103,11 @@ #define FF_PTR_ADD(ptr, off) ((off) ? (ptr) + (off) : (ptr)) +/** + * Access a field in a structure by its offset. + */ +#define FF_FIELD_AT(type, off, obj) (*(type *)((char *)&(obj) + (off))) + #include "libm.h" /**