diff mbox series

[FFmpeg-devel] avcodec/options: deprecate avcodec_get_frame_class()

Message ID 20210225203728.2106-1-jamrial@gmail.com
State Accepted
Headers show
Series [FFmpeg-devel] avcodec/options: deprecate avcodec_get_frame_class() | expand

Checks

Context Check Description
andriy/x86_make success Make finished
andriy/x86_make_fate success Make fate finished
andriy/PPC64_make success Make finished
andriy/PPC64_make_fate success Make fate finished

Commit Message

James Almer Feb. 25, 2021, 8:37 p.m. UTC
AVFrame hasn't been a struct defined in libavcodec for a decade now, when
it was moved to libavutil.

Found-by: mkver
Signed-off-by: James Almer <jamrial@gmail.com>
---
 libavcodec/avcodec.h | 8 ++++----
 libavcodec/options.c | 2 ++
 libavcodec/version.h | 3 +++
 3 files changed, 9 insertions(+), 4 deletions(-)

Comments

James Almer Feb. 26, 2021, 9:24 p.m. UTC | #1
On 2/25/2021 5:37 PM, James Almer wrote:
> AVFrame hasn't been a struct defined in libavcodec for a decade now, when
> it was moved to libavutil.

Will apply.

> 
> Found-by: mkver
> Signed-off-by: James Almer <jamrial@gmail.com>
> ---
>   libavcodec/avcodec.h | 8 ++++----
>   libavcodec/options.c | 2 ++
>   libavcodec/version.h | 3 +++
>   3 files changed, 9 insertions(+), 4 deletions(-)
> 
> diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
> index ddca770cc4..f1380e0c4c 100644
> --- a/libavcodec/avcodec.h
> +++ b/libavcodec/avcodec.h
> @@ -2770,13 +2770,13 @@ int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
>    */
>   const AVClass *avcodec_get_class(void);
>   
> +#if FF_API_GET_FRAME_CLASS
>   /**
> - * Get the AVClass for AVFrame. It can be used in combination with
> - * AV_OPT_SEARCH_FAKE_OBJ for examining options.
> - *
> - * @see av_opt_find().
> + * @deprecated This function should not be used.
>    */
> +attribute_deprecated
>   const AVClass *avcodec_get_frame_class(void);
> +#endif
>   
>   /**
>    * Get the AVClass for AVSubtitleRect. It can be used in combination with
> diff --git a/libavcodec/options.c b/libavcodec/options.c
> index ff16e2cbfd..6e904b61d8 100644
> --- a/libavcodec/options.c
> +++ b/libavcodec/options.c
> @@ -312,6 +312,7 @@ const AVClass *avcodec_get_class(void)
>       return &av_codec_context_class;
>   }
>   
> +#if FF_API_GET_FRAME_CLASS
>   #define FOFFSET(x) offsetof(AVFrame,x)
>   
>   static const AVOption frame_options[]={
> @@ -338,6 +339,7 @@ const AVClass *avcodec_get_frame_class(void)
>   {
>       return &av_frame_class;
>   }
> +#endif
>   
>   #define SROFFSET(x) offsetof(AVSubtitleRect,x)
>   
> diff --git a/libavcodec/version.h b/libavcodec/version.h
> index e5a5ec8abc..2962d94df2 100644
> --- a/libavcodec/version.h
> +++ b/libavcodec/version.h
> @@ -150,5 +150,8 @@
>   #ifndef FF_API_DEBUG_MV
>   #define FF_API_DEBUG_MV          (LIBAVCODEC_VERSION_MAJOR < 60)
>   #endif
> +#ifndef FF_API_GET_FRAME_CLASS
> +#define FF_API_GET_FRAME_CLASS     (LIBAVCODEC_VERSION_MAJOR < 60)
> +#endif
>   
>   #endif /* AVCODEC_VERSION_H */
>
diff mbox series

Patch

diff --git a/libavcodec/avcodec.h b/libavcodec/avcodec.h
index ddca770cc4..f1380e0c4c 100644
--- a/libavcodec/avcodec.h
+++ b/libavcodec/avcodec.h
@@ -2770,13 +2770,13 @@  int avcodec_get_context_defaults3(AVCodecContext *s, const AVCodec *codec);
  */
 const AVClass *avcodec_get_class(void);
 
+#if FF_API_GET_FRAME_CLASS
 /**
- * Get the AVClass for AVFrame. It can be used in combination with
- * AV_OPT_SEARCH_FAKE_OBJ for examining options.
- *
- * @see av_opt_find().
+ * @deprecated This function should not be used.
  */
+attribute_deprecated
 const AVClass *avcodec_get_frame_class(void);
+#endif
 
 /**
  * Get the AVClass for AVSubtitleRect. It can be used in combination with
diff --git a/libavcodec/options.c b/libavcodec/options.c
index ff16e2cbfd..6e904b61d8 100644
--- a/libavcodec/options.c
+++ b/libavcodec/options.c
@@ -312,6 +312,7 @@  const AVClass *avcodec_get_class(void)
     return &av_codec_context_class;
 }
 
+#if FF_API_GET_FRAME_CLASS
 #define FOFFSET(x) offsetof(AVFrame,x)
 
 static const AVOption frame_options[]={
@@ -338,6 +339,7 @@  const AVClass *avcodec_get_frame_class(void)
 {
     return &av_frame_class;
 }
+#endif
 
 #define SROFFSET(x) offsetof(AVSubtitleRect,x)
 
diff --git a/libavcodec/version.h b/libavcodec/version.h
index e5a5ec8abc..2962d94df2 100644
--- a/libavcodec/version.h
+++ b/libavcodec/version.h
@@ -150,5 +150,8 @@ 
 #ifndef FF_API_DEBUG_MV
 #define FF_API_DEBUG_MV          (LIBAVCODEC_VERSION_MAJOR < 60)
 #endif
+#ifndef FF_API_GET_FRAME_CLASS
+#define FF_API_GET_FRAME_CLASS     (LIBAVCODEC_VERSION_MAJOR < 60)
+#endif
 
 #endif /* AVCODEC_VERSION_H */