[FFmpeg-devel] [PATCH] avutil/frame: Remove requirements to use accessors for AVFrame

wm4 nfxjfg at googlemail.com
Mon Jan 9 14:15:04 EET 2017


On Mon,  9 Jan 2017 13:06:35 +0100
Michael Niedermayer <michael at niedermayer.cc> wrote:

> After this it is not allowed to remove, insert or change fields except to
> add them at the end.
> 
> The accessors were in the past required to achieve ABI compatibility
> with the fork. The community decided long ago that this ABI compatibility
> is not needed and should be dropped, so the accessors lost their main
> reason for existence.
> 
> Several people prefer not using accessors, the fields affected did not
> move since 3.0 AFAICS.
> 
> Signed-off-by: Michael Niedermayer <michael at niedermayer.cc>
> ---
>  libavutil/frame.h | 19 +------------------
>  1 file changed, 1 insertion(+), 18 deletions(-)
> 
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index b4500923af..38dd767a90 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -420,8 +420,6 @@ typedef struct AVFrame {
>  
>      /**
>       * MPEG vs JPEG YUV range.
> -     * It must be accessed using av_frame_get_color_range() and
> -     * av_frame_set_color_range().
>       * - encoding: Set by user
>       * - decoding: Set by libavcodec
>       */
> @@ -433,8 +431,6 @@ typedef struct AVFrame {
>  
>      /**
>       * YUV colorspace type.
> -     * It must be accessed using av_frame_get_colorspace() and
> -     * av_frame_set_colorspace().
>       * - encoding: Set by user
>       * - decoding: Set by libavcodec
>       */
> @@ -444,8 +440,6 @@ typedef struct AVFrame {
>  
>      /**
>       * 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)
>       * - encoding: unused
>       * - decoding: set by libavcodec, read by user.
>       */
> @@ -453,8 +447,6 @@ typedef struct AVFrame {
>  
>      /**
>       * reordered pos from the last AVPacket that has been input into the decoder
> -     * Code outside libavutil should access this field using:
> -     * av_frame_get_pkt_pos(frame)
>       * - encoding: unused
>       * - decoding: Read by user.
>       */
> @@ -463,8 +455,6 @@ typedef struct AVFrame {
>      /**
>       * duration of the corresponding packet, expressed in
>       * AVStream->time_base units, 0 if unknown.
> -     * Code outside libavutil should access this field using:
> -     * av_frame_get_pkt_duration(frame)
>       * - encoding: unused
>       * - decoding: Read by user.
>       */
> @@ -472,8 +462,6 @@ typedef struct AVFrame {
>  
>      /**
>       * metadata.
> -     * Code outside libavutil should access this field using:
> -     * av_frame_get_metadata(frame)
>       * - encoding: Set by user.
>       * - decoding: Set by libavcodec.
>       */
> @@ -483,8 +471,6 @@ typedef struct AVFrame {
>       * decode error flags of the frame, set to a combination of
>       * FF_DECODE_ERROR_xxx flags if the decoder produced a frame, but there
>       * were errors during the decoding.
> -     * Code outside libavutil should access this field using:
> -     * av_frame_get_decode_error_flags(frame)
>       * - encoding: unused
>       * - decoding: set by libavcodec, read by user.
>       */
> @@ -494,8 +480,6 @@ typedef struct AVFrame {
>  
>      /**
>       * number of audio channels, only used for audio.
> -     * Code outside libavutil should access this field using:
> -     * av_frame_get_channels(frame)
>       * - encoding: unused
>       * - decoding: Read by user.
>       */
> @@ -503,8 +487,7 @@ typedef struct AVFrame {
>  
>      /**
>       * size of the corresponding packet containing the compressed
> -     * frame. It must be accessed using av_frame_get_pkt_size() and
> -     * av_frame_set_pkt_size().
> +     * frame.
>       * It is set to a negative value if unknown.
>       * - encoding: unused
>       * - decoding: set by libavcodec, read by user.

+1

This was broken anyway, because hw_frames_ctx (at the end of AVFrame)
allowed direct access.

Also:

    /**
     * Not to be accessed directly from outside libavutil
     */
    AVBufferRef *qp_table_buf;

The comment should be adjusted and allow direct access. Also,
it should be moved out of the FF_API_FRAME_QP ifdef (why was
it under it anyway).



More information about the ffmpeg-devel mailing list