[FFmpeg-devel] [PATCH 1/3] avutil/frame: add a (private) struct_version to AVFrame

Michael Niedermayer michaelni at gmx.at
Tue Dec 17 16:50:40 CET 2013


On Tue, Dec 17, 2013 at 03:22:12PM +0100, wm4 wrote:
> On Tue, 17 Dec 2013 14:34:08 +0100
> Michael Niedermayer <michaelni at gmx.at> wrote:
> 
> > This will be used to check for mixups of AVFrame allocations, like when
> > multiple libavutil versions get linked in.
> > 
> > Signed-off-by: Michael Niedermayer <michaelni at gmx.at>
> > ---
> >  libavutil/frame.c |    2 ++
> >  libavutil/frame.h |    6 ++++++
> >  2 files changed, 8 insertions(+)
> > 
> > diff --git a/libavutil/frame.c b/libavutil/frame.c
> > index 1b44400..013e439 100644
> > --- a/libavutil/frame.c
> > +++ b/libavutil/frame.c
> > @@ -92,6 +92,7 @@ static void get_frame_defaults(AVFrame *frame)
> >          av_freep(&frame->extended_data);
> >  
> >      memset(frame, 0, sizeof(*frame));
> > +    frame->struct_version        = LIBAVUTIL_VERSION_MAJOR + (sizeof(AVFrame)<<8) + ((uint64_t)MKTAG('A','V','F','r')<<32);
> >  
> >      frame->pts                   =
> >      frame->pkt_dts               =
> > @@ -414,6 +415,7 @@ int av_frame_make_writable(AVFrame *frame)
> >          return 0;
> >  
> >      memset(&tmp, 0, sizeof(tmp));
> > +    tmp.struct_version = frame->struct_version;
> >      tmp.format         = frame->format;
> >      tmp.width          = frame->width;
> >      tmp.height         = frame->height;
> > diff --git a/libavutil/frame.h b/libavutil/frame.h
> > index b31cc3e..c1c2c17 100644
> > --- a/libavutil/frame.h
> > +++ b/libavutil/frame.h
> > @@ -502,6 +502,12 @@ typedef struct AVFrame {
> >       * Not to be accessed directly from outside libavutil
> >       */
> >      AVBufferRef *qp_table_buf;
> > +
> > +    /**
> > +     * Not to be accessed from outside libavutil
> > +     */
> > +    uint64_t struct_version;
> > +
> >  } AVFrame;
> >  
> >  /**
> 
> This is really starting to get awkward.

rest assured, i share your oppinon but IMHO its still better than
mysterious crashes that could cost others as well as us a moderate
amount of time to debug,
dont you think so too ?


> Why not stop pretending that
> libavcodec, libavutil, etc. are independent libraries instead?

feel free to submit a patch that adds a --enable-monolithic to
configure and produces a single lib out of all.
Iam quite interrested to see how well that will work and or if
people/distros will prefer to use that


[...]

-- 
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: not available
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://ffmpeg.org/pipermail/ffmpeg-devel/attachments/20131217/ec943242/attachment.asc>


More information about the ffmpeg-devel mailing list