Skip to content

Commit

Permalink
lavr: deprecate the entire library
Browse files Browse the repository at this point in the history
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@gmail.com>
  • Loading branch information
Rostislav Pehlivanov committed Jan 4, 2018
1 parent 88cbd25 commit c29038f
Show file tree
Hide file tree
Showing 3 changed files with 110 additions and 9 deletions.
4 changes: 2 additions & 2 deletions configure
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand Down Expand Up @@ -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
Expand Down
9 changes: 9 additions & 0 deletions doc/APIchanges
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
106 changes: 99 additions & 7 deletions libavresample/avresample.h
Original file line number Diff line number Diff line change
Expand Up @@ -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*/
Expand All @@ -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
Expand All @@ -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",
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand All @@ -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
Expand All @@ -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.
*
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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.
Expand Down Expand Up @@ -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.
*
Expand All @@ -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);

/**
Expand Down

0 comments on commit c29038f

Please sign in to comment.