[FFmpeg-devel] [RFC][PATCH 1/4] avutil/frame: add an internal field to store the size of AVFrame

Michael Niedermayer michael at niedermayer.cc
Sun Feb 13 14:08:46 EET 2022


On Sat, Feb 12, 2022 at 09:16:36AM -0300, James Almer wrote:
> On 2/12/2022 9:08 AM, Michael Niedermayer wrote:
> > On Fri, Feb 11, 2022 at 09:12:58PM -0300, James Almer wrote:
> > > 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 at 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.
> > 
> > iam probably missing something but if the goal is to wrap AVFrame in some
> > other structure as a array or buffer
> > without the sizeof(AVFrame) cant the wraping/unwraping code be put in
> > libavutil ?
> 
> How would that fix the situation of setting AVPacket.size to sizeof(AVFrame)
> and AVPacket.data to an structure that big + padding bytes in packets
> returned to the caller?

If you had a function which turned a AVFrame into a AVBufferRef

pkt->data = buf->data;
pkt->size = buf->size;

If done carefully, this might work even independant of how that function
does it, by reference, copy or full serialization

If that direction would be pursued (possibly later), the wraping function
could have a flag that switches between zero copy reference and 
full serialization of AVFrames which could be passed accross a network 
or stored on disk and used later/elsewhere

thx

[...]
-- 
Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

Let us carefully observe those good qualities wherein our enemies excel us
and endeavor to excel them, by avoiding what is faulty, and imitating what
is excellent in them. -- Plutarch
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 195 bytes
Desc: not available
URL: <https://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20220213/670a823e/attachment.sig>


More information about the ffmpeg-devel mailing list