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

Ivan Schreter schreter
Wed Jan 28 00:37:05 CET 2009

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?



More information about the ffmpeg-devel mailing list