From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100]) by master.gitmailbox.com (Postfix) with ESMTP id BB06B40F8A for ; Sat, 12 Feb 2022 00:14:09 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id BEDD468AFEB; Sat, 12 Feb 2022 02:14:05 +0200 (EET) 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-Google-Smtp-Source: ABdhPJyz256453KAWK/OlGEUBpdgeSp0+l4cPubz/z1q+syew2eN3abenZ6dntZQJM5FnycWRowHDA== 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 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: 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 */ -- 2.35.1 _______________________________________________ ffmpeg-devel mailing list ffmpeg-devel@ffmpeg.org https://ffmpeg.org/mailman/listinfo/ffmpeg-devel To unsubscribe, visit link above, or email ffmpeg-devel-request@ffmpeg.org with subject "unsubscribe".