[FFmpeg-devel] Process for adding new fields to various contexts

Michael Niedermayer michaelni
Wed Jan 28 00:52:20 CET 2009

On Wed, Jan 28, 2009 at 12:37:05AM +0100, Ivan Schreter wrote:
> Stefano Sabatini wrote:
> > On date Tuesday 2009-01-27 20:14:00 +0100, Ivan Schreter encoded:
> >   
> >> I intend to fix something in H.264 decoder, but for that I need to 
> >> communicate additional information from parser in libavcodec to 
> >> libavformat (one flag and one count), for instance as variable in 
> >> AVCodecParserContext. I don't want to break binary compatibility, though.
> >>
> >> What is the proper way to do this (in particular and in general)? I 
> >> didn't find any howto (maybe would be interesting to put it online).
> >>     
> >
> > Add the field just at the end of the struct, this way you're not going
> > to change the offsets of all the other fields, this way you save ABI
> > compatibility.
> >   
> Sure. But this is a struct, which is used by both libavformat and 
> libavcodec. I assume that it's allocated inside of libavcodec (didn't 
> check yet). If the versions of libavformat and libavcodec don't match, 
> then it will most probably break.
> I suppose that the version of libavformat must be less than or equal to 
> version of libavcodec in order to guarantee compatibility. In that case 
> (and provided structures are allocated in libavcodec) this should work. 
> Am I correct?

#if no major bump yet
if(avcodec_version() > 123)
    use some new field


Michael     GnuPG fingerprint: 9FF2128B147EF6730BADF133611EC787040B0FAB

There will always be a question for which you do not know the correct awnser.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: Digital signature
URL: <http://lists.mplayerhq.hu/pipermail/ffmpeg-devel/attachments/20090128/b0523a37/attachment.pgp>

More information about the ffmpeg-devel mailing list