From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <ffmpeg-devel-bounces@ffmpeg.org>
Received: from ffbox0-bg.mplayerhq.hu (ffbox0-bg.ffmpeg.org [79.124.17.100])
	by master.gitmailbox.com (Postfix) with ESMTP id 4048441012
	for <ffmpegdev@gitmailbox.com>; Sat, 12 Feb 2022 11:46:35 +0000 (UTC)
Received: from [127.0.1.1] (localhost [127.0.0.1])
	by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTP id 7066E68B27E;
	Sat, 12 Feb 2022 13:46:33 +0200 (EET)
Received: from mail-oo1-f41.google.com (mail-oo1-f41.google.com
 [209.85.161.41])
 by ffbox0-bg.mplayerhq.hu (Postfix) with ESMTPS id EA2C768B1C4
 for <ffmpeg-devel@ffmpeg.org>; Sat, 12 Feb 2022 13:46:27 +0200 (EET)
Received: by mail-oo1-f41.google.com with SMTP id
 i10-20020a4aab0a000000b002fccf890d5fso13458590oon.5
 for <ffmpeg-devel@ffmpeg.org>; Sat, 12 Feb 2022 03:46: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=IzGTjCyM9l0sHeUSuFwm6dK+hZothZAUm1ZU7ap54iA=;
 b=HXAzZLfL7xFzIGFAirIpIxNHuci1/CL+D+w2T+75dYo2f/hU8Al7xQyDM7mHf91gUX
 xIpzNe+rj76I3U/1bl62W72SizFXShYgQxXK7CCYd38NxZh8gzdZrQ7uErAcH8YD2DHS
 tcwMuCXjk/VM+ca9W2Q0BErZLOzzzmnRCUo04BgkkBrcFK7OUWq0zsw8MvcilfIOArEN
 HtcqxZVkXd1lYzkhCi3vsZsOQEO5NaC8YTvoV4CHChxAncE+lxWyarpJfYgKniFEqBR1
 d6Y3e3QGxNScXUeJ2TbhOMb/C9c/M3fkqNQ9/8jPz66h4+8m4PYCVCTSm9XyYl6l8o7T
 w6+w==
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=IzGTjCyM9l0sHeUSuFwm6dK+hZothZAUm1ZU7ap54iA=;
 b=hlWNYaCIJ+bybf3zK3bNwhBrf92rIJx3b0IiTaTAmBkNvQhc0dzXbV7h0BSAKncREI
 KMijJrSgQGUoyD3BD7VWqjdg8oY4c8SpBpdyLB41A9VADpboNDj8cux9MuZLvfykiAzh
 tEPas+g9LZ0k1DMMvroFzIppk8l+ObMwchmFv3Rp8JgXw5+pjZkA/bMztBtyXJoX5ONh
 fr+RrJQbHNgG1A0+q1i91PLcEqnsBwqEyg9E3SlD6eQ6gTCuJrFCk+U1uvOrTnKsIfRW
 j2hB5FiNo0wIVbzI7dPlhCLn+My9aHe00eGAIggTGmOpu7aBgTRpR/h/cEmVTDmKfk7N
 2BGA==
X-Gm-Message-State: AOAM533ojOOLuIIK+sk6/GhaeFyZZglsZPR3RfffMy2i85eEWZ06GQ7Z
 lV0iUGabef0UZd0ghbT/a4XA+PX9QDA=
X-Google-Smtp-Source: ABdhPJzvFm8y2BjinfEPeg9jjIoIaqL7FFg/oXxDOhxRegZ6ncLdTbufAPkAtEqDod8PGitghFmuFg==
X-Received: by 2002:a05:6870:85c6:: with SMTP id
 g6mr1526034oal.63.1644666385199; 
 Sat, 12 Feb 2022 03:46:25 -0800 (PST)
Received: from [192.168.1.55] ([191.83.214.101])
 by smtp.gmail.com with ESMTPSA id 12sm11447580oaj.31.2022.02.12.03.46.23
 for <ffmpeg-devel@ffmpeg.org>
 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128);
 Sat, 12 Feb 2022 03:46:24 -0800 (PST)
Message-ID: <dbe91f3e-f119-ea86-024d-4e5a66f2d02c@gmail.com>
Date: Sat, 12 Feb 2022 08:46: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>
 <AM7PR03MB66608C38E26CFB2B0491C4698F319@AM7PR03MB6660.eurprd03.prod.outlook.com>
From: James Almer <jamrial@gmail.com>
In-Reply-To: <AM7PR03MB66608C38E26CFB2B0491C4698F319@AM7PR03MB6660.eurprd03.prod.outlook.com>
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 <ffmpeg-devel.ffmpeg.org>
List-Unsubscribe: <https://ffmpeg.org/mailman/options/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=unsubscribe>
List-Archive: <https://ffmpeg.org/pipermail/ffmpeg-devel>
List-Post: <mailto:ffmpeg-devel@ffmpeg.org>
List-Help: <mailto:ffmpeg-devel-request@ffmpeg.org?subject=help>
List-Subscribe: <https://ffmpeg.org/mailman/listinfo/ffmpeg-devel>,
 <mailto:ffmpeg-devel-request@ffmpeg.org?subject=subscribe>
Reply-To: FFmpeg development discussions and patches <ffmpeg-devel@ffmpeg.org>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Errors-To: ffmpeg-devel-bounces@ffmpeg.org
Sender: "ffmpeg-devel" <ffmpeg-devel-bounces@ffmpeg.org>
Archived-At: <https://master.gitmailbox.com/ffmpegdev/dbe91f3e-f119-ea86-024d-4e5a66f2d02c@gmail.com/>
List-Archive: <https://master.gitmailbox.com/ffmpegdev/>
List-Post: <mailto:ffmpegdev@gitmailbox.com>

On 2/12/2022 2:29 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 <jamrial@gmail.com>
>> ---
>> 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 <stdint.h>
> 
> size_t is in stddef.h and some other headers, but not in stdint.h.
> 
>> +
>> +#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 */
> 
> Missing av_export_avutil. (And aren't there systems where exporting data
> is always problematic?)

Wouldn't that mean that existing constants like av_md5_size and 
av_sha_size are not working?

> 
> - Andreas
> _______________________________________________
> 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".