From patchwork Sat Feb 12 00:12:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Almer X-Patchwork-Id: 34235 Delivered-To: ffmpegpatchwork2@gmail.com Received: by 2002:a05:6838:14aa:0:0:0:0 with SMTP id bz10csp3674213nkb; Fri, 11 Feb 2022 16:14:12 -0800 (PST) X-Google-Smtp-Source: ABdhPJyTsniVpAbWX2iUvpLGDjhjpS698j8CJQ0i8iPnxEZFAy9rGfXut5SQUhObXt9Wn4MRFnva X-Received: by 2002:a17:907:97cd:: with SMTP id js13mr3279663ejc.365.1644624852328; Fri, 11 Feb 2022 16:14:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1644624852; cv=none; d=google.com; s=arc-20160816; b=ZkoDg7CxlyX71nGDq6VQ+zwlwh0+IOjTIC/wCvayAQPrXWepx8Q3xZ/WtJ60jE4WB1 LOpUrYweHM7inJ+BCMbAm1dve/tXR9KFAO+4PiNlDv5XoOXR7z8Reqe94ggji8UQKFl8 1Wts86pBPK6wcw8kfwvP6gsrm0QRQFb4GWJMfUZBFzEzBF+xHib8iAQSvy8C8ILnXblp odelC7hTYgz2YAT4qxYAzUUfMh7s9CUVOJxr5M/hx9JtQ0Q58fHxLfvwDBsd9WTCfWJJ DW7MdAJoKcGv7GskOPUEpNzmntJX0QmZOcy+vuhXTTpb3l4F8ebkMHJCANz/MnY63LJ7 puow== 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 :dkim-signature:delivered-to; bh=vDUfFOGvj5wXvGA+YMWJdTMk6MMrKvucjKnBz5/vxB4=; b=flT0vgzmZtSH/IKYkh4gur8RwEDtuZAECzNO6jfypArokrMlW2BdblkFbojUMAeUrR MiZzAchPxBLzCnrXXxri5Yt1ajWy15WXuXhvbZtecPY26er/R34ohwg6Kjltms+pHz2Q Bu24gKzR2lgPNQhjz5vRoteSmbSjFT77Xia5JFyw0k+Qo8IvAAK4Xj6kVfj6y9Srocae li4icwit8jwi2G4JY0M5VWBAH0XS3VLh0hnqB8MrjIzhUMQJ94bi6MoAVF0/cSxfmzqr 8mZ+8vpn8/YGoQKUD0rVUN9idacaaRRBAeBBqYWEjYkBwchd8lJjT2N730Tl0FyxZIyD OJTQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20210112 header.b=QkLiM6LQ; 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=gmail.com Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org. [79.124.17.100]) by mx.google.com with ESMTP id fj2si18937274ejc.300.2022.02.11.16.14.11; Fri, 11 Feb 2022 16:14:12 -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=@gmail.com header.s=20210112 header.b=QkLiM6LQ; 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=gmail.com Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 0C82F68A628; Sat, 12 Feb 2022 02:14:06 +0200 (EET) X-Original-To: ffmpeg-devel@ffmpeg.org Delivered-To: ffmpeg-devel@ffmpeg.org Received: from mail-oo1-f46.google.com (mail-oo1-f46.google.com [209.85.161.46]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id E3F3368A628 for ; Sat, 12 Feb 2022 02:13:58 +0200 (EET) Received: by mail-oo1-f46.google.com with SMTP id p190-20020a4a2fc7000000b0031820de484aso12196697oop.9 for ; Fri, 11 Feb 2022 16:13:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=luJzv9ZmcXAa6iwi+KH2DHe06a0C+hmyTNCmpMtGrUE=; b=QkLiM6LQRb33uTdl9ZyPVLGLPoPtN2K90s111+5h0y14qsq2Wn4kYD6dvg0x3c+Zn7 00WVULPimItq7ZcW1L1cCn5y5NmCw8pYPxh6Ll3Zr6oRKFBZeZRPcwf2XhwzcHEDQtOb 0DxI1sBjNb1PoZXd+lX91FYkJpz5LZzBuP/64IudO/ZHyYxhZsHwGSXYOtKQ1pJowslx VLSE6bAboQ2t0eo9+R1Wtoj3GdceWmURh6hEUL/zJpkyC8nKA/lp/SO4GkuUaA3EBhid IXQh2ZuoWgdy/8MoyWHYiCMTd0wrHxMaMP4eSUsP/N1FpirJ+tEAss1Tc6caMilgl5We LRhQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=luJzv9ZmcXAa6iwi+KH2DHe06a0C+hmyTNCmpMtGrUE=; b=UZVtZsYDhZ6FZtIhjxTNI3aHscrsKzlth8svzA6lNZcSWDVW+x4ozi0RYinxqnripj P44rlhL92CoqYSVJ7QD8hQ/T0N+srZr7CX64aiLKEYgVY1Md1mx+dqzXFOmwOIVdiwrP kVez8CyXrPtxvCoHjMlbm04pRZD7ILSAHeLxRN1MlBcsK4R2hLXsdIW4Q7ka6M3SVjNl mx6A1D4piZQ2bsBGyEqCilinXsL/07xSg5kWtviQsCDmFBx4YzJoS4gxrWPwHJQlkrKw 9hmhEl4eeEjRWU+mO9lYEKcvJs+1PZmFk5F03Od5cU0j8IU8iBWzgRPjLnhyuyfnXPK7 yEqA== X-Gm-Message-State: AOAM530Ku2zeNGuBbF1P+f/ltYkfOIDx+W1LtFidhoNAUEU9Ga89IEm5 6CAmMOLELy9QOFlTjPv0hTI1kORM3qE= X-Received: by 2002:a05:6870:d385:: with SMTP id k5mr976066oag.33.1644624835982; Fri, 11 Feb 2022 16:13:55 -0800 (PST) Received: from localhost.localdomain ([191.83.214.101]) by smtp.gmail.com with ESMTPSA id k19sm9777448oot.41.2022.02.11.16.13.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Feb 2022 16:13:55 -0800 (PST) From: James Almer To: ffmpeg-devel@ffmpeg.org Date: Fri, 11 Feb 2022 21:12:58 -0300 Message-Id: <20220212001301.4090-1-jamrial@gmail.com> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 Subject: [FFmpeg-devel] [RFC][PATCH 1/4] avutil/frame: add an internal field to store the size of AVFrame 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: vIlivi/SyJcE This is unfortunately needed to remove (or reduce the awfulness) of certain modules violating the AVFrame API and using sizeof(AVFrame). With this, the sizeof(AVFrame) value of the libavutil loaded at runtime can be used instead of the compile time value of whatever library included frame.h Signed-off-by: James Almer --- This is sucks, but at least less so than the current situation. I don't see wrapped_avframe going away anytime soon, so something must be done, and last time i tried to change how the packets are generated my approach was shut down, so here's another attempt. libavutil/frame.c | 3 +++ libavutil/frame_internal.h | 33 +++++++++++++++++++++++++++++++++ 2 files changed, 36 insertions(+) create mode 100644 libavutil/frame_internal.h diff --git a/libavutil/frame.c b/libavutil/frame.c index 8997c85e35..a63d2979db 100644 --- a/libavutil/frame.c +++ b/libavutil/frame.c @@ -23,6 +23,7 @@ #include "cpu.h" #include "dict.h" #include "frame.h" +#include "frame_internal.h" #include "imgutils.h" #include "mem.h" #include "samplefmt.h" @@ -33,6 +34,8 @@ (frame)->channels == \ av_get_channel_layout_nb_channels((frame)->channel_layout)) +const size_t avpriv_avframe_size = sizeof(AVFrame); + #if FF_API_COLORSPACE_NAME const char *av_get_colorspace_name(enum AVColorSpace val) { diff --git a/libavutil/frame_internal.h b/libavutil/frame_internal.h new file mode 100644 index 0000000000..07c246f86a --- /dev/null +++ b/libavutil/frame_internal.h @@ -0,0 +1,33 @@ +/* + * This file is part of FFmpeg. + * + * FFmpeg is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * FFmpeg is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with FFmpeg; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + */ + +#ifndef AVUTIL_FRAME_INTERNAL_H +#define AVUTIL_FRAME_INTERNAL_H + +#include + +#include "frame.h" + +/** + * sizeof(AVFrame). If you think you need to use it, then you need to change + * your code so you don't instead. + * Meant for exceptions like wrapped_avframe. + */ +extern const size_t avpriv_avframe_size; + +#endif /* AVUTIL_FRAME_INTERNAL_H */