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 BA4F24100A for ; Sat, 12 Feb 2022 11:58:35 +0000 (UTC) Received: from [127.0.1.1] (localhost [127.0.0.1]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 4C92868B290; Sat, 12 Feb 2022 13:58:33 +0200 (EET) Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id 175B668B180 for ; Sat, 12 Feb 2022 13:58:27 +0200 (EET) Received: by mail-ot1-f54.google.com with SMTP id p3-20020a0568301d4300b005a7a702f921so8019211oth.9 for ; Sat, 12 Feb 2022 03:58:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=message-id:date:mime-version:user-agent:subject:content-language:to :references:from:in-reply-to:content-transfer-encoding; bh=piQy66egRFs2dQ3TKPSUxqHIq0wIiUCG7hyx1g0JDRM=; b=btYxgehFqxz+nKg/5UD33LE7IWm6jCgknHUouQictYPlpsItWdNZZayoMV05aN/hBG 7qAEqgRswP/fnyJZmhMXJUbRriAfJD5BSNz8c/OsT3tT2h7sZUwQWAuffTUIRzlLiljI pd3CyD4SJziupwawM8WGNoBJnrpEepoaMfXCqfqa26f4yVhXOKuwBoQp5aD4GOIw1qFw xMzHBEsh22NYuw7gkSLJ5zTI08ZtQDTmQljKr14itYG7b7ce31g/+XfGXmpQwNJXaDvZ NHOTYA3NGxiHUk2pUm31OGUp4yCAh3WrSMlquhg+X/nSIeAq3Ja/yt36Pu0yRY6j1Hgv pcng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:message-id:date:mime-version:user-agent:subject :content-language:to:references:from:in-reply-to :content-transfer-encoding; bh=piQy66egRFs2dQ3TKPSUxqHIq0wIiUCG7hyx1g0JDRM=; b=jxLRmHJgNX4jNf0uaYN6INsmQKa4FXcUDAswMeO5GZhgF9vchmX/SQxMD312tHnEEZ KJad0whS6vQhdyXaYSyzVn04WxOYj/NAHw3lIe2/cHq9LZWukAiUchsyQej8HgHzjL1w 51v/Bq0yzhvEQQlkh1YtsfCF3NAsLd/E+UlKKdiGQCwNysAzu6+OvLAtZv73WDfjqZGA ojvOaAvf4QvhOF/HD5HVMQzlKhz8JHBsVZIltKbfMQ8da/Sm36tCWMcuzvP6g8W90qGm Uh+/ob80r05pwF0l8WpweW0kLHFxIQj/YFyT0VdGt6VPvrVqDavTevlu7o0h7cjjqKK1 b9/A== X-Gm-Message-State: AOAM531+cYUwzumep5vK6NWZ5e6/iLgVjYod9LIw6k0lVgjFEXAt5NYJ 9qOceZBakwOkfPJs0YJJ1W6UZzsXpHg= X-Google-Smtp-Source: ABdhPJwUFQiAItKKiBYdxVK2W1nArd3W/tEiMdXJDMF08jIAD++dbprabYm9V5DIiDO7z7Kh/kf6EA== X-Received: by 2002:a9d:6647:: with SMTP id q7mr2045222otm.268.1644667105104; Sat, 12 Feb 2022 03:58:25 -0800 (PST) Received: from [192.168.1.55] ([191.83.214.101]) by smtp.gmail.com with ESMTPSA id w7sm10578653oou.13.2022.02.12.03.58.23 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 12 Feb 2022 03:58:24 -0800 (PST) Message-ID: <4bb99492-a8cb-7faf-e7dd-94bd7d7461b7@gmail.com> Date: Sat, 12 Feb 2022 08:58:22 -0300 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:91.0) Gecko/20100101 Thunderbird/91.6.0 Content-Language: en-US To: ffmpeg-devel@ffmpeg.org References: <20220212001301.4090-1-jamrial@gmail.com> From: James Almer In-Reply-To: Subject: Re: [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-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Errors-To: ffmpeg-devel-bounces@ffmpeg.org Sender: "ffmpeg-devel" Archived-At: List-Archive: List-Post: On 2/12/2022 3:45 AM, Andreas Rheinhardt wrote: > James Almer: >> 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. >> > > Where can I find this earlier approach? I think it was https://ffmpeg.org/pipermail/ffmpeg-devel/2021-March/277762.html and https://ffmpeg.org/pipermail/ffmpeg-devel/2021-March/277759.html (Which you looked at, back then). > (Also why don't we just switch to something like what is done for > uncoded frames in libavformat/mux.c?) What would that be? Remember that AVPackets with wrapped AVFrames are propagated to the user if the "codec" is wrapped_avframe. We have not forbidden them to look at any specific field, including size, so any change will probably be backwards incompatible. With uncoded frame the user passes an AVFrame to lavf and never sees or deals with it being added to a packet. > >> 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" > > This header is completely unnecessary. > >> + >> +/** >> + * 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 */ > > _______________________________________________ > 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". _______________________________________________ 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".