[FFmpeg-devel] [PATCH] lavr: deprecate the entire library

Rostislav Pehlivanov atomnuker at gmail.com
Mon Dec 25 19:53:35 EET 2017


Deprecate the entire library. Merged years ago to provide compatibility
with Libav, it remained unmaintained by the FFmpeg project and duplicated
functionality provided by libswresample.

In order to improve consistency and reduce attack surface, as well as to ease
burden on maintainers, it has been deprecated. Users of this library are asked
to migrate to libswresample, which, as well as providing more functionality,
is faster and has higher accuracy.

Signed-off-by: Rostislav Pehlivanov <atomnuker at gmail.com>
---
 configure                  |  4 ++--
 doc/APIchanges             | 10 ++++++++++
 libavresample/avresample.h | 30 +++++++++++++++++++++++++-----
 3 files changed, 37 insertions(+), 7 deletions(-)

diff --git a/configure b/configure
index d3187d71ed..33afedfb77 100755
--- a/configure
+++ b/configure
@@ -133,7 +133,7 @@ Component options:
   --disable-swscale        disable libswscale build
   --disable-postproc       disable libpostproc build
   --disable-avfilter       disable libavfilter build
-  --enable-avresample      enable libavresample build [no]
+  --enable-avresample      enable libavresample build (deprecated) [no]
   --disable-pthreads       disable pthreads [autodetect]
   --disable-w32threads     disable Win32 threads [autodetect]
   --disable-os2threads     disable OS/2 threads [autodetect]
@@ -6516,7 +6516,7 @@ check_deps $CONFIG_LIST       \
            $ALL_COMPONENTS    \
 
 enabled threads && ! enabled pthreads && ! enabled atomics_native && die "non pthread threading without atomics not supported, try adding --enable-pthreads or --cpu=i486 or higher if you are on x86"
-
+enabled avresample && warn "Building with deprecated library libavresample"
 
 if test $target_os = "haiku"; then
     disable memalign
diff --git a/doc/APIchanges b/doc/APIchanges
index df79758e86..5232bbca7f 100644
--- a/doc/APIchanges
+++ b/doc/APIchanges
@@ -15,6 +15,16 @@ libavutil:     2017-10-21
 
 API changes, most recent first:
 
+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
+  functionality provided by libswresample.
+
+  In order to improve consistency and reduce attack surface, as well as to ease
+  burden on maintainers, it has been deprecated. Users of this library are asked
+  to migrate to libswresample, which, as well as providing more functionality,
+  is faster and has higher accuracy.
+
 2017-12-xx - xxxxxxx - lavu 56.7.100 - cpu.h
   AVX-512 flags added.
 
diff --git a/libavresample/avresample.h b/libavresample/avresample.h
index 193443e2a6..57889c572c 100644
--- a/libavresample/avresample.h
+++ b/libavresample/avresample.h
@@ -103,10 +103,10 @@
 
 #define AVRESAMPLE_MAX_CHANNELS 32
 
-typedef struct AVAudioResampleContext AVAudioResampleContext;
+typedef attribute_deprecated struct AVAudioResampleContext AVAudioResampleContext;
 
 /** Mixing Coefficient Types */
-enum AVMixCoeffType {
+enum attribute_deprecated AVMixCoeffType {
     AV_MIX_COEFF_TYPE_Q8,   /** 16-bit 8.8 fixed-point                      */
     AV_MIX_COEFF_TYPE_Q15,  /** 32-bit 17.15 fixed-point                    */
     AV_MIX_COEFF_TYPE_FLT,  /** floating-point                              */
@@ -114,13 +114,13 @@ enum AVMixCoeffType {
 };
 
 /** Resampling Filter Types */
-enum AVResampleFilterType {
+enum attribute_deprecated AVResampleFilterType {
     AV_RESAMPLE_FILTER_TYPE_CUBIC,              /**< Cubic */
     AV_RESAMPLE_FILTER_TYPE_BLACKMAN_NUTTALL,   /**< Blackman Nuttall Windowed Sinc */
     AV_RESAMPLE_FILTER_TYPE_KAISER,             /**< Kaiser Windowed Sinc */
 };
 
-enum AVResampleDitherMethod {
+enum attribute_deprecated AVResampleDitherMethod {
     AV_RESAMPLE_DITHER_NONE,            /**< Do not use dithering */
     AV_RESAMPLE_DITHER_RECTANGULAR,     /**< Rectangular Dither */
     AV_RESAMPLE_DITHER_TRIANGULAR,      /**< Triangular Dither*/
@@ -132,17 +132,20 @@ enum AVResampleDitherMethod {
 /**
  * Return the LIBAVRESAMPLE_VERSION_INT constant.
  */
+attribute_deprecated
 unsigned avresample_version(void);
 
 /**
  * Return the libavresample build-time configuration.
  * @return  configure string
  */
+attribute_deprecated
 const char *avresample_configuration(void);
 
 /**
  * Return the libavresample license.
  */
+attribute_deprecated
 const char *avresample_license(void);
 
 /**
@@ -155,6 +158,7 @@ const char *avresample_license(void);
  *
  * @return AVClass for AVAudioResampleContext
  */
+attribute_deprecated
 const AVClass *avresample_get_class(void);
 
 /**
@@ -162,6 +166,7 @@ const AVClass *avresample_get_class(void);
  *
  * @return  allocated audio resample context, or NULL on failure
  */
+attribute_deprecated
 AVAudioResampleContext *avresample_alloc_context(void);
 
 /**
@@ -178,6 +183,7 @@ AVAudioResampleContext *avresample_alloc_context(void);
  * @param avr  audio resample context
  * @return     0 on success, negative AVERROR code on failure
  */
+attribute_deprecated
 int avresample_open(AVAudioResampleContext *avr);
 
 /**
@@ -186,6 +192,7 @@ int avresample_open(AVAudioResampleContext *avr);
  * @param avr AVAudioResampleContext to check
  * @return 1 if avr is open, 0 if avr is closed.
  */
+attribute_deprecated
 int avresample_is_open(AVAudioResampleContext *avr);
 
 /**
@@ -201,6 +208,7 @@ int avresample_is_open(AVAudioResampleContext *avr);
  *
  * @param avr  audio resample context
  */
+attribute_deprecated
 void avresample_close(AVAudioResampleContext *avr);
 
 /**
@@ -210,6 +218,7 @@ void avresample_close(AVAudioResampleContext *avr);
  *
  * @param avr  audio resample context
  */
+attribute_deprecated
 void avresample_free(AVAudioResampleContext **avr);
 
 /**
@@ -234,6 +243,7 @@ void avresample_free(AVAudioResampleContext **avr);
  * @param matrix_encoding     matrixed stereo downmix mode (e.g. dplii)
  * @return                    0 on success, negative AVERROR code on failure
  */
+attribute_deprecated
 int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout,
                             double center_mix_level, double surround_mix_level,
                             double lfe_mix_level, int normalize, double *matrix,
@@ -251,6 +261,7 @@ int avresample_build_matrix(uint64_t in_layout, uint64_t out_layout,
  * @param stride  distance between adjacent input channels in the matrix array
  * @return        0 on success, negative AVERROR code on failure
  */
+attribute_deprecated
 int avresample_get_matrix(AVAudioResampleContext *avr, double *matrix,
                           int stride);
 
@@ -272,6 +283,7 @@ int avresample_get_matrix(AVAudioResampleContext *avr, double *matrix,
  * @param stride  distance between adjacent input channels in the matrix array
  * @return        0 on success, negative AVERROR code on failure
  */
+attribute_deprecated
 int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix,
                           int stride);
 
@@ -302,6 +314,7 @@ int avresample_set_matrix(AVAudioResampleContext *avr, const double *matrix,
  * @param channel_map customized input channel mapping
  * @return            0 on success, negative AVERROR code on failure
  */
+attribute_deprecated
 int avresample_set_channel_mapping(AVAudioResampleContext *avr,
                                    const int *channel_map);
 
@@ -318,6 +331,7 @@ int avresample_set_channel_mapping(AVAudioResampleContext *avr,
  * @param compensation_distance  compensation distance, in samples
  * @return                       0 on success, negative AVERROR code on failure
  */
+attribute_deprecated
 int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
                                 int compensation_distance);
 
@@ -331,7 +345,7 @@ int avresample_set_compensation(AVAudioResampleContext *avr, int sample_delta,
  * @return              number of samples or AVERROR(EINVAL) if the value
  *                      would exceed INT_MAX
  */
-
+attribute_deprecated
 int avresample_get_out_samples(AVAudioResampleContext *avr, int in_nb_samples);
 
 /**
@@ -376,6 +390,7 @@ int avresample_get_out_samples(AVAudioResampleContext *avr, int in_nb_samples);
  *                        not including converted samples added to the internal
  *                        output FIFO
  */
+attribute_deprecated
 int avresample_convert(AVAudioResampleContext *avr, uint8_t **output,
                        int out_plane_size, int out_samples,
                        uint8_t * const *input, int in_plane_size,
@@ -394,6 +409,7 @@ int avresample_convert(AVAudioResampleContext *avr, uint8_t **output,
  * @param avr  audio resample context
  * @return     number of samples currently in the resampling delay buffer
  */
+attribute_deprecated
 int avresample_get_delay(AVAudioResampleContext *avr);
 
 /**
@@ -411,6 +427,7 @@ int avresample_get_delay(AVAudioResampleContext *avr);
  * @param avr  audio resample context
  * @return     number of samples available for reading
  */
+attribute_deprecated
 int avresample_available(AVAudioResampleContext *avr);
 
 /**
@@ -430,6 +447,7 @@ int avresample_available(AVAudioResampleContext *avr);
  * @param nb_samples  number of samples to read from the FIFO
  * @return            the number of samples written to output
  */
+attribute_deprecated
 int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_samples);
 
 /**
@@ -476,6 +494,7 @@ int avresample_read(AVAudioResampleContext *avr, uint8_t **output, int nb_sample
  * @return                0 on success, AVERROR on failure or nonmatching
  *                        configuration.
  */
+attribute_deprecated
 int avresample_convert_frame(AVAudioResampleContext *avr,
                              AVFrame *output, AVFrame *input);
 
@@ -494,6 +513,7 @@ int avresample_convert_frame(AVAudioResampleContext *avr,
  * @param in              input AVFrame
  * @return                0 on success, AVERROR on failure.
  */
+attribute_deprecated
 int avresample_config(AVAudioResampleContext *avr, AVFrame *out, AVFrame *in);
 
 /**
-- 
2.15.1.620.gb9897f4670



More information about the ffmpeg-devel mailing list