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

Rostislav Pehlivanov atomnuker at gmail.com
Thu Jan 4 05:14:37 EET 2018


On 2 January 2018 at 16:47, Rostislav Pehlivanov <atomnuker at gmail.com>
wrote:

>
>
> On 30 December 2017 at 14:59, Rostislav Pehlivanov <atomnuker at gmail.com>
> wrote:
>
>> 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>
>> ---
>> I've kept the deprecations on the enums - they can't hurt.
>>  configure                  |   4 +-
>>  doc/APIchanges             |   9 ++++
>>  libavresample/avresample.h | 106 ++++++++++++++++++++++++++++++
>> ++++++++++++---
>>  3 files changed, 110 insertions(+), 9 deletions(-)
>>
>> diff --git a/configure b/configure
>> index 688f6ab803..f2fdb93668 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]
>> @@ -6521,7 +6521,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 3c9f237596..38c1be61c7 100644
>> --- a/doc/APIchanges
>> +++ b/doc/APIchanges
>> @@ -15,6 +15,15 @@ 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, 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-xx-xx - xxxxxxx - lavc 58.9.100 - avcodec.h
>>    Deprecate av_lockmgr_register(). You need to build FFmpeg with
>> threading
>>    support enabled to get basic thread-safety (which is the default build
>> diff --git a/libavresample/avresample.h b/libavresample/avresample.h
>> index 193443e2a6..440e1a16e7 100644
>> --- a/libavresample/avresample.h
>> +++ b/libavresample/avresample.h
>> @@ -103,24 +103,33 @@
>>
>>  #define AVRESAMPLE_MAX_CHANNELS 32
>>
>> -typedef struct AVAudioResampleContext AVAudioResampleContext;
>> +typedef attribute_deprecated struct AVAudioResampleContext
>> AVAudioResampleContext;
>>
>> -/** Mixing Coefficient Types */
>> -enum AVMixCoeffType {
>> +/**
>> + * @deprecated use libswresample
>> + *
>> + * Mixing Coefficient Types */
>> +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
>>     */
>>      AV_MIX_COEFF_TYPE_NB,   /** Number of coeff types. Not part of ABI
>>     */
>>  };
>>
>> -/** Resampling Filter Types */
>> -enum AVResampleFilterType {
>> +/**
>> + * @deprecated use libswresample
>> + *
>> + * Resampling Filter Types */
>> +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 {
>> +/**
>> + * @deprecated use libswresample
>> + */
>> +enum attribute_deprecated AVResampleDitherMethod {
>>      AV_RESAMPLE_DITHER_NONE,            /**< Do not use dithering */
>>      AV_RESAMPLE_DITHER_RECTANGULAR,     /**< Rectangular Dither */
>>      AV_RESAMPLE_DITHER_TRIANGULAR,      /**< Triangular Dither*/
>> @@ -130,22 +139,37 @@ enum AVResampleDitherMethod {
>>  };
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Return the LIBAVRESAMPLE_VERSION_INT constant.
>>   */
>> +attribute_deprecated
>>  unsigned avresample_version(void);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Return the libavresample build-time configuration.
>>   * @return  configure string
>>   */
>> +attribute_deprecated
>>  const char *avresample_configuration(void);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Return the libavresample license.
>>   */
>> +attribute_deprecated
>>  const char *avresample_license(void);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Get the AVClass for AVAudioResampleContext.
>>   *
>>   * Can be used in combination with AV_OPT_SEARCH_FAKE_OBJ for examining
>> options
>> @@ -155,16 +179,24 @@ const char *avresample_license(void);
>>   *
>>   * @return AVClass for AVAudioResampleContext
>>   */
>> +attribute_deprecated
>>  const AVClass *avresample_get_class(void);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Allocate AVAudioResampleContext and set options.
>>   *
>>   * @return  allocated audio resample context, or NULL on failure
>>   */
>> +attribute_deprecated
>>  AVAudioResampleContext *avresample_alloc_context(void);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Initialize AVAudioResampleContext.
>>   * @note The context must be configured using the AVOption API.
>>   * @note The fields "in_channel_layout", "out_channel_layout",
>> @@ -178,17 +210,25 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Check whether an AVAudioResampleContext is open or closed.
>>   *
>>   * @param avr AVAudioResampleContext to check
>>   * @return 1 if avr is open, 0 if avr is closed.
>>   */
>> +attribute_deprecated
>>  int avresample_is_open(AVAudioResampleContext *avr);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Close AVAudioResampleContext.
>>   *
>>   * This closes the context, but it does not change the parameters. The
>> context
>> @@ -201,18 +241,26 @@ int avresample_is_open(AVAudioResampleContext
>> *avr);
>>   *
>>   * @param avr  audio resample context
>>   */
>> +attribute_deprecated
>>  void avresample_close(AVAudioResampleContext *avr);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Free AVAudioResampleContext and associated AVOption values.
>>   *
>>   * This also calls avresample_close() before freeing.
>>   *
>>   * @param avr  audio resample context
>>   */
>> +attribute_deprecated
>>  void avresample_free(AVAudioResampleContext **avr);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Generate a channel mixing matrix.
>>   *
>>   * This function is the one used internally by libavresample for
>> building the
>> @@ -234,12 +282,16 @@ 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,
>>                              int stride, enum AVMatrixEncoding
>> matrix_encoding);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Get the current channel mixing matrix.
>>   *
>>   * If no custom matrix has been previously set or the
>> AVAudioResampleContext is
>> @@ -251,10 +303,14 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Set channel mixing matrix.
>>   *
>>   * Allows for setting a custom mixing matrix, overriding the default
>> matrix
>> @@ -272,10 +328,14 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Set a customized input channel mapping.
>>   *
>>   * This function can only be called when the allocated context is not
>> open.
>> @@ -302,10 +362,14 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Set compensation for resampling.
>>   *
>>   * This can be called anytime after avresample_open(). If resampling is
>> not
>> @@ -318,10 +382,14 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Provide the upper bound on the number of samples the configured
>>   * conversion would output.
>>   *
>> @@ -331,10 +399,13 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Convert input samples and write them to the output FIFO.
>>   *
>>   * The upper bound on the number of output samples can be obtained
>> through
>> @@ -376,12 +447,16 @@ 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,
>>                         int in_samples);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Return the number of samples currently in the resampling delay buffer.
>>   *
>>   * When resampling, there may be a delay between the input and output.
>> Any
>> @@ -394,9 +469,13 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Return the number of available samples in the output FIFO.
>>   *
>>   * During conversion, if the user does not specify an output buffer or
>> @@ -411,9 +490,13 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Read samples from the output FIFO.
>>   *
>>   * During conversion, if the user does not specify an output buffer or
>> @@ -430,9 +513,13 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Convert the samples in the input AVFrame and write them to the output
>> AVFrame.
>>   *
>>   * Input and output AVFrames must have channel_layout, sample_rate and
>> format set.
>> @@ -476,10 +563,14 @@ 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);
>>
>>  /**
>> + *
>> + * @deprecated use libswresample
>> + *
>>   * Configure or reconfigure the AVAudioResampleContext using the
>> information
>>   * provided by the AVFrames.
>>   *
>> @@ -494,6 +585,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
>>
>>
> Going to push this tomorrow.
>


Pushed, thanks for the reviews and comments.


More information about the ffmpeg-devel mailing list