[FFmpeg-devel,1/2] avfilter: deprecate avfilter_link_get_channels()

Submitted by James Almer on Jan. 5, 2018, 8:50 p.m.

Details

Message ID 20180105205055.4120-1-jamrial@gmail.com
State New
Headers show

Commit Message

James Almer Jan. 5, 2018, 8:50 p.m.
And move the channels field to the public section of the struct.

Signed-off-by: James Almer <jamrial@gmail.com>
---
 doc/APIchanges         |  4 ++++
 libavfilter/avfilter.c |  2 ++
 libavfilter/avfilter.h | 15 ++++++++++-----
 libavfilter/version.h  |  5 ++++-
 4 files changed, 20 insertions(+), 6 deletions(-)

Comments

Nicolas George Jan. 6, 2018, 1:06 p.m.
James Almer (2018-01-05):
> Subject: Re: [FFmpeg-devel] [PATCH 1/2] avfilter: deprecate
>  avfilter_link_get_channels()

Ok.

> And move the channels field to the public section of the struct.

Not necessary, and potentially harmful. See my comment on the other
patch.

Regards,
James Almer Jan. 6, 2018, 2:01 p.m.
On 1/6/2018 10:06 AM, Nicolas George wrote:
> James Almer (2018-01-05):
>> Subject: Re: [FFmpeg-devel] [PATCH 1/2] avfilter: deprecate
>>  avfilter_link_get_channels()
> 
> Ok.
> 
>> And move the channels field to the public section of the struct.
> 
> Not necessary, and potentially harmful. See my comment on the other
> patch.
> 
> Regards,

Applied the deprecation part only then. Thanks.

Patch hide | download patch | download mbox

diff --git a/doc/APIchanges b/doc/APIchanges
index 38c1be61c7..6e48c8707e 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,10 @@  libavutil:     2017-10-21
 
 API changes, most recent first:
 
+2018-01-xx - xxxxxxx - lavfi 7.11.101 - avfilter.h
+  Deprecate avfilter_link_get_channels(), and make AVFilterLink->channels
+  public.
+
 2017-xx-xx - xxxxxxx - lavr 4.0.0 - avresample.h
   Deprecate the entire library. Merged years ago to provide compatibility
   with Libav, it remained unmaintained by the FFmpeg project and duplicated
diff --git a/libavfilter/avfilter.c b/libavfilter/avfilter.c
index ff7df672fd..ea75467a75 100644
--- a/libavfilter/avfilter.c
+++ b/libavfilter/avfilter.c
@@ -183,10 +183,12 @@  void avfilter_link_free(AVFilterLink **link)
     av_freep(link);
 }
 
+#if FF_API_FILTER_GET_SET
 int avfilter_link_get_channels(AVFilterLink *link)
 {
     return link->channels;
 }
+#endif
 
 void ff_filter_set_ready(AVFilterContext *filter, unsigned priority)
 {
diff --git a/libavfilter/avfilter.h b/libavfilter/avfilter.h
index 47546c15e5..410d8bbdd7 100644
--- a/libavfilter/avfilter.h
+++ b/libavfilter/avfilter.h
@@ -448,6 +448,11 @@  struct AVFilterLink {
      */
     AVRational time_base;
 
+    /**
+     * Number of channels.
+     */
+    int channels;
+
     /*****************************************************************
      * All fields below this line are not part of the public API. They
      * may not be used outside of libavfilter and can be changed and
@@ -551,11 +556,6 @@  struct AVFilterLink {
      */
     int max_samples;
 
-    /**
-     * Number of channels.
-     */
-    int channels;
-
     /**
      * Link processing flags.
      */
@@ -647,10 +647,15 @@  int avfilter_link(AVFilterContext *src, unsigned srcpad,
  */
 void avfilter_link_free(AVFilterLink **link);
 
+#if FF_API_FILTER_GET_SET
 /**
  * Get the number of channels of a link.
+ * @deprecated This accessor used to be provided for ABI compatibility, and
+ * does not need to be used anymore.
  */
+attribute_deprecated
 int avfilter_link_get_channels(AVFilterLink *link);
+#endif
 
 /**
  * Set the closed field of a link.
diff --git a/libavfilter/version.h b/libavfilter/version.h
index c07f4d30d9..0f11721822 100644
--- a/libavfilter/version.h
+++ b/libavfilter/version.h
@@ -31,7 +31,7 @@ 
 
 #define LIBAVFILTER_VERSION_MAJOR   7
 #define LIBAVFILTER_VERSION_MINOR  11
-#define LIBAVFILTER_VERSION_MICRO 100
+#define LIBAVFILTER_VERSION_MICRO 101
 
 #define LIBAVFILTER_VERSION_INT AV_VERSION_INT(LIBAVFILTER_VERSION_MAJOR, \
                                                LIBAVFILTER_VERSION_MINOR, \
@@ -55,5 +55,8 @@ 
 #ifndef FF_API_LAVR_OPTS
 #define FF_API_LAVR_OPTS                    (LIBAVFILTER_VERSION_MAJOR < 8)
 #endif
+#ifndef FF_API_FILTER_GET_SET
+#define FF_API_FILTER_GET_SET               (LIBAVFILTER_VERSION_MAJOR < 8)
+#endif
 
 #endif /* AVFILTER_VERSION_H */