[FFmpeg-devel] [PATCH] avutil/frame: Move new field to the end of AVFrame

James Almer jamrial at gmail.com
Wed Jun 29 23:05:10 CEST 2016


On 6/29/2016 5:31 PM, Michael Niedermayer wrote:
> This is a similar ABI fix to 1eb43af1a0e542ad83dcbf327197785d815fc42d
> ---
>  libavutil/frame.h |   11 +++++------
>  1 file changed, 5 insertions(+), 6 deletions(-)
> 
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index 44adec4..2b5c332 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -428,12 +428,6 @@ typedef struct AVFrame {
>      enum AVChromaLocation chroma_location;
>  
>      /**
> -     * For hwaccel-format frames, this should be a reference to the
> -     * AVHWFramesContext describing the frame.
> -     */
> -    AVBufferRef *hw_frames_ctx;
> -
> -    /**
>       * frame timestamp estimated using various heuristics, in stream time base
>       * Code outside libavutil should access this field using:
>       * av_frame_get_best_effort_timestamp(frame)
> @@ -524,6 +518,11 @@ typedef struct AVFrame {
>       */
>      AVBufferRef *qp_table_buf;
>  #endif
> +    /**
> +     * For hwaccel-format frames, this should be a reference to the
> +     * AVHWFramesContext describing the frame.
> +     */
> +    AVBufferRef *hw_frames_ctx;
>  } AVFrame;
>  
>  /**
> 

As Hendrik said, every field below hw_frames_ctx is clearly stated as no direct
access. Library users should have not used any of those fields directly to begin
with. Any breakage product of the addition of a new public field moving the
offset of no direct access fields is their responsibility.
This is not something new. Private fields in public structs is something ffmpeg
and even libav has featured for years now.

This commit will break libavutil ABI from 3.1 to 3.1.1 by moving a public access
field around. In contrast, leaving things as is will keep everything from 3.0
onwards compatible if every field is properly accessed.


More information about the ffmpeg-devel mailing list