/*
* This file is part of uniaud.dll.
*
* Copyright (c) 2010 Mensys BV
* Copyright (c) 2007 Vlad Stelmahovsky aka Vladest
*
* This library is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License as
* published by the Free Software Foundation, either version 3 of
* the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License and the GNU General Public License along with this library.
* If not, see .
*/
#ifndef __resample__
#define __resample__
#include
#define FELEM int16_t
#define FELEM2 int32_t
#define FELEM_MAX INT16_MAX
#define FELEM_MIN INT16_MIN
typedef struct AVResampleContext{
FELEM *filter_bank;
int filter_length;
int ideal_dst_incr;
int dst_incr;
int index;
int frac;
int src_incr;
int compensation_distance;
int phase_shift;
int phase_mask;
int linear;
}AVResampleContext;
typedef struct ReSampleContext {
struct AVResampleContext *resample_context;
short *temp[2];
int temp_len;
float ratio;
/* channel convert */
int input_channels, output_channels, filter_channels;
}/* ReSampleContext*/;
struct ReSampleContext *audio_resample_init(int output_channels, int input_channels,
int output_rate, int input_rate);
int audio_resample(struct ReSampleContext *s, short *output, short *input, int nb_samples);
void audio_resample_close(struct ReSampleContext *s);
AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
void av_resample_close(AVResampleContext *c);
int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
#endif /* __resample__ */