Commit a8c07773 authored by Michael Niedermayer's avatar Michael Niedermayer

Revert "Merge commit '0517c9e0'" bring the old...

Revert "Merge commit '0517c9e0'" bring the old audio resampling API back

This reverts commit d3edc65d, reversing
changes made to 150de78d.

Conflicts:

	libavcodec/version.h

It seems there are several applications still using it
Signed-off-by: 's avatarMichael Niedermayer <michaelni@gmx.at>
parent bbaa4432
...@@ -27,6 +27,8 @@ OBJS = allcodecs.o \ ...@@ -27,6 +27,8 @@ OBJS = allcodecs.o \
parser.o \ parser.o \
raw.o \ raw.o \
rawdec.o \ rawdec.o \
resample.o \
resample2.o \
utils.o \ utils.o \
# parts needed for many different codecs # parts needed for many different codecs
......
...@@ -4096,6 +4096,103 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size, ...@@ -4096,6 +4096,103 @@ int avcodec_encode_subtitle(AVCodecContext *avctx, uint8_t *buf, int buf_size,
* @} * @}
*/ */
#if FF_API_AVCODEC_RESAMPLE
/**
* @defgroup lavc_resample Audio resampling
* @ingroup libavc
* @deprecated use libswresample instead
*
* @{
*/
struct ReSampleContext;
struct AVResampleContext;
typedef struct ReSampleContext ReSampleContext;
/**
* Initialize audio resampling context.
*
* @param output_channels number of output channels
* @param input_channels number of input channels
* @param output_rate output sample rate
* @param input_rate input sample rate
* @param sample_fmt_out requested output sample format
* @param sample_fmt_in input sample format
* @param filter_length length of each FIR filter in the filterbank relative to the cutoff frequency
* @param log2_phase_count log2 of the number of entries in the polyphase filterbank
* @param linear if 1 then the used FIR filter will be linearly interpolated
between the 2 closest, if 0 the closest will be used
* @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
* @return allocated ReSampleContext, NULL if error occurred
*/
attribute_deprecated
ReSampleContext *av_audio_resample_init(int output_channels, int input_channels,
int output_rate, int input_rate,
enum AVSampleFormat sample_fmt_out,
enum AVSampleFormat sample_fmt_in,
int filter_length, int log2_phase_count,
int linear, double cutoff);
attribute_deprecated
int audio_resample(ReSampleContext *s, short *output, short *input, int nb_samples);
/**
* Free resample context.
*
* @param s a non-NULL pointer to a resample context previously
* created with av_audio_resample_init()
*/
attribute_deprecated
void audio_resample_close(ReSampleContext *s);
/**
* Initialize an audio resampler.
* Note, if either rate is not an integer then simply scale both rates up so they are.
* @param filter_length length of each FIR filter in the filterbank relative to the cutoff freq
* @param log2_phase_count log2 of the number of entries in the polyphase filterbank
* @param linear If 1 then the used FIR filter will be linearly interpolated
between the 2 closest, if 0 the closest will be used
* @param cutoff cutoff frequency, 1.0 corresponds to half the output sampling rate
*/
attribute_deprecated
struct AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_length, int log2_phase_count, int linear, double cutoff);
/**
* Resample an array of samples using a previously configured context.
* @param src an array of unconsumed samples
* @param consumed the number of samples of src which have been consumed are returned here
* @param src_size the number of unconsumed samples available
* @param dst_size the amount of space in samples available in dst
* @param update_ctx If this is 0 then the context will not be modified, that way several channels can be resampled with the same context.
* @return the number of samples written in dst or -1 if an error occurred
*/
attribute_deprecated
int av_resample(struct AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
/**
* Compensate samplerate/timestamp drift. The compensation is done by changing
* the resampler parameters, so no audible clicks or similar distortions occur
* @param compensation_distance distance in output samples over which the compensation should be performed
* @param sample_delta number of output samples which should be output less
*
* example: av_resample_compensate(c, 10, 500)
* here instead of 510 samples only 500 samples would be output
*
* note, due to rounding the actual compensation might be slightly different,
* especially if the compensation_distance is large and the in_rate used during init is small
*/
attribute_deprecated
void av_resample_compensate(struct AVResampleContext *c, int sample_delta, int compensation_distance);
attribute_deprecated
void av_resample_close(struct AVResampleContext *c);
/**
* @}
*/
#endif
/** /**
* @addtogroup lavc_picture * @addtogroup lavc_picture
* @{ * @{
......
This diff is collapsed.
This diff is collapsed.
...@@ -73,6 +73,9 @@ ...@@ -73,6 +73,9 @@
#ifndef FF_API_CODEC_ID #ifndef FF_API_CODEC_ID
#define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 56) #define FF_API_CODEC_ID (LIBAVCODEC_VERSION_MAJOR < 56)
#endif #endif
#ifndef FF_API_AVCODEC_RESAMPLE
#define FF_API_AVCODEC_RESAMPLE (LIBAVCODEC_VERSION_MAJOR < 56)
#endif
#ifndef FF_API_MMI #ifndef FF_API_MMI
#define FF_API_MMI (LIBAVCODEC_VERSION_MAJOR < 55) #define FF_API_MMI (LIBAVCODEC_VERSION_MAJOR < 55)
#endif #endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment