diff mbox

[FFmpeg-devel] avutil/frame: deprecate getters and setters for AVFrame fields

Message ID 20171023141352.5032-1-jamrial@gmail.com
State Accepted
Commit 7df37dd319f2d9d3e1becd5d433884e3ccfa1ee2
Headers show

Commit Message

James Almer Oct. 23, 2017, 2:13 p.m. UTC
The fields can be accessed directly, so these are not needed anymore.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavutil/frame.c   |  2 ++
 libavutil/frame.h   | 26 ++++++++++++++++++++++++++
 libavutil/version.h |  3 +++
 3 files changed, 31 insertions(+)

Comments

James Almer Oct. 28, 2017, 1:33 a.m. UTC | #1
On 10/23/2017 11:13 AM, James Almer wrote:
> The fields can be accessed directly, so these are not needed anymore.
> 
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>  libavutil/frame.c   |  2 ++
>  libavutil/frame.h   | 26 ++++++++++++++++++++++++++
>  libavutil/version.h |  3 +++
>  3 files changed, 31 insertions(+)
> 
> diff --git a/libavutil/frame.c b/libavutil/frame.c
> index 09dd98a6b5..982fbb5c81 100644
> --- a/libavutil/frame.c
> +++ b/libavutil/frame.c
> @@ -31,6 +31,7 @@ static AVFrameSideData *frame_new_side_data(AVFrame *frame,
>                                              enum AVFrameSideDataType type,
>                                              AVBufferRef *buf);
>  
> +#if FF_API_FRAME_GET_SET
>  MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
>  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
>  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
> @@ -42,6 +43,7 @@ MAKE_ACCESSORS(AVFrame, frame, int,     decode_error_flags)
>  MAKE_ACCESSORS(AVFrame, frame, int,     pkt_size)
>  MAKE_ACCESSORS(AVFrame, frame, enum AVColorSpace, colorspace)
>  MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
> +#endif
>  
>  #define CHECK_CHANNELS_CONSISTENCY(frame) \
>      av_assert2(!(frame)->channel_layout || \
> diff --git a/libavutil/frame.h b/libavutil/frame.h
> index fef558ea2f..0c6aab1c02 100644
> --- a/libavutil/frame.h
> +++ b/libavutil/frame.h
> @@ -565,36 +565,62 @@ typedef struct AVFrame {
>       */
>  } AVFrame;
>  
> +#if FF_API_FRAME_GET_SET
>  /**
>   * Accessors for some AVFrame fields. These used to be provided for ABI
>   * compatibility, and do not need to be used anymore.
>   */
> +attribute_deprecated
>  int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
> +attribute_deprecated
>  int64_t av_frame_get_pkt_duration         (const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_pkt_duration         (AVFrame *frame, int64_t val);
> +attribute_deprecated
>  int64_t av_frame_get_pkt_pos              (const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_pkt_pos              (AVFrame *frame, int64_t val);
> +attribute_deprecated
>  int64_t av_frame_get_channel_layout       (const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_channel_layout       (AVFrame *frame, int64_t val);
> +attribute_deprecated
>  int     av_frame_get_channels             (const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_channels             (AVFrame *frame, int     val);
> +attribute_deprecated
>  int     av_frame_get_sample_rate          (const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_sample_rate          (AVFrame *frame, int     val);
> +attribute_deprecated
>  AVDictionary *av_frame_get_metadata       (const AVFrame *frame);
> +attribute_deprecated
>  void          av_frame_set_metadata       (AVFrame *frame, AVDictionary *val);
> +attribute_deprecated
>  int     av_frame_get_decode_error_flags   (const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_decode_error_flags   (AVFrame *frame, int     val);
> +attribute_deprecated
>  int     av_frame_get_pkt_size(const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_pkt_size(AVFrame *frame, int val);
>  #if FF_API_FRAME_QP
> +attribute_deprecated
>  int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
> +attribute_deprecated
>  int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
>  #endif
> +attribute_deprecated
>  enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
> +attribute_deprecated
>  enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
> +attribute_deprecated
>  void    av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
> +#endif
>  
>  /**
>   * Get the name of a colorspace.
> diff --git a/libavutil/version.h b/libavutil/version.h
> index aa56ad2fbd..7b4ae9beab 100644
> --- a/libavutil/version.h
> +++ b/libavutil/version.h
> @@ -136,6 +136,9 @@
>  #ifndef FF_API_CRYPTO_SIZE_T
>  #define FF_API_CRYPTO_SIZE_T            (LIBAVUTIL_VERSION_MAJOR < 57)
>  #endif
> +#ifndef FF_API_FRAME_GET_SET
> +#define FF_API_FRAME_GET_SET            (LIBAVUTIL_VERSION_MAJOR < 57)
> +#endif
>  
>  
>  /**

Ping.
Paul B Mahol Oct. 28, 2017, 8:16 a.m. UTC | #2
On 10/28/17, James Almer <jamrial@gmail.com> wrote:
> On 10/23/2017 11:13 AM, James Almer wrote:
>> The fields can be accessed directly, so these are not needed anymore.
>>
>> Signed-off-by: James Almer <jamrial@gmail.com>
>> ---
>>  libavutil/frame.c   |  2 ++
>>  libavutil/frame.h   | 26 ++++++++++++++++++++++++++
>>  libavutil/version.h |  3 +++
>>  3 files changed, 31 insertions(+)
>>
>> diff --git a/libavutil/frame.c b/libavutil/frame.c
>> index 09dd98a6b5..982fbb5c81 100644
>> --- a/libavutil/frame.c
>> +++ b/libavutil/frame.c
>> @@ -31,6 +31,7 @@ static AVFrameSideData *frame_new_side_data(AVFrame
>> *frame,
>>                                              enum AVFrameSideDataType
>> type,
>>                                              AVBufferRef *buf);
>>
>> +#if FF_API_FRAME_GET_SET
>>  MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
>>  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
>>  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
>> @@ -42,6 +43,7 @@ MAKE_ACCESSORS(AVFrame, frame, int,
>> decode_error_flags)
>>  MAKE_ACCESSORS(AVFrame, frame, int,     pkt_size)
>>  MAKE_ACCESSORS(AVFrame, frame, enum AVColorSpace, colorspace)
>>  MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
>> +#endif
>>
>>  #define CHECK_CHANNELS_CONSISTENCY(frame) \
>>      av_assert2(!(frame)->channel_layout || \
>> diff --git a/libavutil/frame.h b/libavutil/frame.h
>> index fef558ea2f..0c6aab1c02 100644
>> --- a/libavutil/frame.h
>> +++ b/libavutil/frame.h
>> @@ -565,36 +565,62 @@ typedef struct AVFrame {
>>       */
>>  } AVFrame;
>>
>> +#if FF_API_FRAME_GET_SET
>>  /**
>>   * Accessors for some AVFrame fields. These used to be provided for ABI
>>   * compatibility, and do not need to be used anymore.
>>   */
>> +attribute_deprecated
>>  int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
>> +attribute_deprecated
>>  int64_t av_frame_get_pkt_duration         (const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_pkt_duration         (AVFrame *frame, int64_t val);
>> +attribute_deprecated
>>  int64_t av_frame_get_pkt_pos              (const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_pkt_pos              (AVFrame *frame, int64_t val);
>> +attribute_deprecated
>>  int64_t av_frame_get_channel_layout       (const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_channel_layout       (AVFrame *frame, int64_t val);
>> +attribute_deprecated
>>  int     av_frame_get_channels             (const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_channels             (AVFrame *frame, int     val);
>> +attribute_deprecated
>>  int     av_frame_get_sample_rate          (const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_sample_rate          (AVFrame *frame, int     val);
>> +attribute_deprecated
>>  AVDictionary *av_frame_get_metadata       (const AVFrame *frame);
>> +attribute_deprecated
>>  void          av_frame_set_metadata       (AVFrame *frame, AVDictionary
>> *val);
>> +attribute_deprecated
>>  int     av_frame_get_decode_error_flags   (const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_decode_error_flags   (AVFrame *frame, int     val);
>> +attribute_deprecated
>>  int     av_frame_get_pkt_size(const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_pkt_size(AVFrame *frame, int val);
>>  #if FF_API_FRAME_QP
>> +attribute_deprecated
>>  int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
>> +attribute_deprecated
>>  int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int
>> type);
>>  #endif
>> +attribute_deprecated
>>  enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
>> +attribute_deprecated
>>  enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
>> +attribute_deprecated
>>  void    av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
>> +#endif
>>
>>  /**
>>   * Get the name of a colorspace.
>> diff --git a/libavutil/version.h b/libavutil/version.h
>> index aa56ad2fbd..7b4ae9beab 100644
>> --- a/libavutil/version.h
>> +++ b/libavutil/version.h
>> @@ -136,6 +136,9 @@
>>  #ifndef FF_API_CRYPTO_SIZE_T
>>  #define FF_API_CRYPTO_SIZE_T            (LIBAVUTIL_VERSION_MAJOR < 57)
>>  #endif
>> +#ifndef FF_API_FRAME_GET_SET
>> +#define FF_API_FRAME_GET_SET            (LIBAVUTIL_VERSION_MAJOR < 57)
>> +#endif
>>
>>
>>  /**
>
> Ping.
> _______________________________________________
> ffmpeg-devel mailing list
> ffmpeg-devel@ffmpeg.org
> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>

lgtm
James Almer Oct. 29, 2017, 1:32 p.m. UTC | #3
On 10/28/2017 5:16 AM, Paul B Mahol wrote:
> On 10/28/17, James Almer <jamrial@gmail.com> wrote:
>> On 10/23/2017 11:13 AM, James Almer wrote:
>>> The fields can be accessed directly, so these are not needed anymore.
>>>
>>> Signed-off-by: James Almer <jamrial@gmail.com>
>>> ---
>>>  libavutil/frame.c   |  2 ++
>>>  libavutil/frame.h   | 26 ++++++++++++++++++++++++++
>>>  libavutil/version.h |  3 +++
>>>  3 files changed, 31 insertions(+)
>>>
>>> diff --git a/libavutil/frame.c b/libavutil/frame.c
>>> index 09dd98a6b5..982fbb5c81 100644
>>> --- a/libavutil/frame.c
>>> +++ b/libavutil/frame.c
>>> @@ -31,6 +31,7 @@ static AVFrameSideData *frame_new_side_data(AVFrame
>>> *frame,
>>>                                              enum AVFrameSideDataType
>>> type,
>>>                                              AVBufferRef *buf);
>>>
>>> +#if FF_API_FRAME_GET_SET
>>>  MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
>>>  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
>>>  MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
>>> @@ -42,6 +43,7 @@ MAKE_ACCESSORS(AVFrame, frame, int,
>>> decode_error_flags)
>>>  MAKE_ACCESSORS(AVFrame, frame, int,     pkt_size)
>>>  MAKE_ACCESSORS(AVFrame, frame, enum AVColorSpace, colorspace)
>>>  MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
>>> +#endif
>>>
>>>  #define CHECK_CHANNELS_CONSISTENCY(frame) \
>>>      av_assert2(!(frame)->channel_layout || \
>>> diff --git a/libavutil/frame.h b/libavutil/frame.h
>>> index fef558ea2f..0c6aab1c02 100644
>>> --- a/libavutil/frame.h
>>> +++ b/libavutil/frame.h
>>> @@ -565,36 +565,62 @@ typedef struct AVFrame {
>>>       */
>>>  } AVFrame;
>>>
>>> +#if FF_API_FRAME_GET_SET
>>>  /**
>>>   * Accessors for some AVFrame fields. These used to be provided for ABI
>>>   * compatibility, and do not need to be used anymore.
>>>   */
>>> +attribute_deprecated
>>>  int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
>>> +attribute_deprecated
>>>  int64_t av_frame_get_pkt_duration         (const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_pkt_duration         (AVFrame *frame, int64_t val);
>>> +attribute_deprecated
>>>  int64_t av_frame_get_pkt_pos              (const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_pkt_pos              (AVFrame *frame, int64_t val);
>>> +attribute_deprecated
>>>  int64_t av_frame_get_channel_layout       (const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_channel_layout       (AVFrame *frame, int64_t val);
>>> +attribute_deprecated
>>>  int     av_frame_get_channels             (const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_channels             (AVFrame *frame, int     val);
>>> +attribute_deprecated
>>>  int     av_frame_get_sample_rate          (const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_sample_rate          (AVFrame *frame, int     val);
>>> +attribute_deprecated
>>>  AVDictionary *av_frame_get_metadata       (const AVFrame *frame);
>>> +attribute_deprecated
>>>  void          av_frame_set_metadata       (AVFrame *frame, AVDictionary
>>> *val);
>>> +attribute_deprecated
>>>  int     av_frame_get_decode_error_flags   (const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_decode_error_flags   (AVFrame *frame, int     val);
>>> +attribute_deprecated
>>>  int     av_frame_get_pkt_size(const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_pkt_size(AVFrame *frame, int val);
>>>  #if FF_API_FRAME_QP
>>> +attribute_deprecated
>>>  int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
>>> +attribute_deprecated
>>>  int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int
>>> type);
>>>  #endif
>>> +attribute_deprecated
>>>  enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
>>> +attribute_deprecated
>>>  enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
>>> +attribute_deprecated
>>>  void    av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
>>> +#endif
>>>
>>>  /**
>>>   * Get the name of a colorspace.
>>> diff --git a/libavutil/version.h b/libavutil/version.h
>>> index aa56ad2fbd..7b4ae9beab 100644
>>> --- a/libavutil/version.h
>>> +++ b/libavutil/version.h
>>> @@ -136,6 +136,9 @@
>>>  #ifndef FF_API_CRYPTO_SIZE_T
>>>  #define FF_API_CRYPTO_SIZE_T            (LIBAVUTIL_VERSION_MAJOR < 57)
>>>  #endif
>>> +#ifndef FF_API_FRAME_GET_SET
>>> +#define FF_API_FRAME_GET_SET            (LIBAVUTIL_VERSION_MAJOR < 57)
>>> +#endif
>>>
>>>
>>>  /**
>>
>> Ping.
>> _______________________________________________
>> ffmpeg-devel mailing list
>> ffmpeg-devel@ffmpeg.org
>> http://ffmpeg.org/mailman/listinfo/ffmpeg-devel
>>
> 
> lgtm

Pushed, thanks.
diff mbox

Patch

diff --git a/libavutil/frame.c b/libavutil/frame.c
index 09dd98a6b5..982fbb5c81 100644
--- a/libavutil/frame.c
+++ b/libavutil/frame.c
@@ -31,6 +31,7 @@  static AVFrameSideData *frame_new_side_data(AVFrame *frame,
                                             enum AVFrameSideDataType type,
                                             AVBufferRef *buf);
 
+#if FF_API_FRAME_GET_SET
 MAKE_ACCESSORS(AVFrame, frame, int64_t, best_effort_timestamp)
 MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_duration)
 MAKE_ACCESSORS(AVFrame, frame, int64_t, pkt_pos)
@@ -42,6 +43,7 @@  MAKE_ACCESSORS(AVFrame, frame, int,     decode_error_flags)
 MAKE_ACCESSORS(AVFrame, frame, int,     pkt_size)
 MAKE_ACCESSORS(AVFrame, frame, enum AVColorSpace, colorspace)
 MAKE_ACCESSORS(AVFrame, frame, enum AVColorRange, color_range)
+#endif
 
 #define CHECK_CHANNELS_CONSISTENCY(frame) \
     av_assert2(!(frame)->channel_layout || \
diff --git a/libavutil/frame.h b/libavutil/frame.h
index fef558ea2f..0c6aab1c02 100644
--- a/libavutil/frame.h
+++ b/libavutil/frame.h
@@ -565,36 +565,62 @@  typedef struct AVFrame {
      */
 } AVFrame;
 
+#if FF_API_FRAME_GET_SET
 /**
  * Accessors for some AVFrame fields. These used to be provided for ABI
  * compatibility, and do not need to be used anymore.
  */
+attribute_deprecated
 int64_t av_frame_get_best_effort_timestamp(const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_best_effort_timestamp(AVFrame *frame, int64_t val);
+attribute_deprecated
 int64_t av_frame_get_pkt_duration         (const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_pkt_duration         (AVFrame *frame, int64_t val);
+attribute_deprecated
 int64_t av_frame_get_pkt_pos              (const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_pkt_pos              (AVFrame *frame, int64_t val);
+attribute_deprecated
 int64_t av_frame_get_channel_layout       (const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_channel_layout       (AVFrame *frame, int64_t val);
+attribute_deprecated
 int     av_frame_get_channels             (const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_channels             (AVFrame *frame, int     val);
+attribute_deprecated
 int     av_frame_get_sample_rate          (const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_sample_rate          (AVFrame *frame, int     val);
+attribute_deprecated
 AVDictionary *av_frame_get_metadata       (const AVFrame *frame);
+attribute_deprecated
 void          av_frame_set_metadata       (AVFrame *frame, AVDictionary *val);
+attribute_deprecated
 int     av_frame_get_decode_error_flags   (const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_decode_error_flags   (AVFrame *frame, int     val);
+attribute_deprecated
 int     av_frame_get_pkt_size(const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_pkt_size(AVFrame *frame, int val);
 #if FF_API_FRAME_QP
+attribute_deprecated
 int8_t *av_frame_get_qp_table(AVFrame *f, int *stride, int *type);
+attribute_deprecated
 int av_frame_set_qp_table(AVFrame *f, AVBufferRef *buf, int stride, int type);
 #endif
+attribute_deprecated
 enum AVColorSpace av_frame_get_colorspace(const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_colorspace(AVFrame *frame, enum AVColorSpace val);
+attribute_deprecated
 enum AVColorRange av_frame_get_color_range(const AVFrame *frame);
+attribute_deprecated
 void    av_frame_set_color_range(AVFrame *frame, enum AVColorRange val);
+#endif
 
 /**
  * Get the name of a colorspace.
diff --git a/libavutil/version.h b/libavutil/version.h
index aa56ad2fbd..7b4ae9beab 100644
--- a/libavutil/version.h
+++ b/libavutil/version.h
@@ -136,6 +136,9 @@ 
 #ifndef FF_API_CRYPTO_SIZE_T
 #define FF_API_CRYPTO_SIZE_T            (LIBAVUTIL_VERSION_MAJOR < 57)
 #endif
+#ifndef FF_API_FRAME_GET_SET
+#define FF_API_FRAME_GET_SET            (LIBAVUTIL_VERSION_MAJOR < 57)
+#endif
 
 
 /**