1 | /*
|
---|
2 | * This file is part of uniaud.dll.
|
---|
3 | *
|
---|
4 | * Copyright (c) 2010 Mensys BV
|
---|
5 | * Copyright (c) 2007 Vlad Stelmahovsky aka Vladest
|
---|
6 | *
|
---|
7 | * This library is free software: you can redistribute it and/or modify
|
---|
8 | * it under the terms of the GNU Lesser General Public License as
|
---|
9 | * published by the Free Software Foundation, either version 3 of
|
---|
10 | * the License, or (at your option) any later version.
|
---|
11 | *
|
---|
12 | * This library is distributed in the hope that it will be useful,
|
---|
13 | * but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
15 | * GNU Lesser General Public License for more details.
|
---|
16 | *
|
---|
17 | * You should have received a copy of the GNU Lesser General Public
|
---|
18 | * License and the GNU General Public License along with this library.
|
---|
19 | * If not, see <http://www.gnu.org/licenses/>.
|
---|
20 | */
|
---|
21 | #ifndef __resample__
|
---|
22 | #define __resample__
|
---|
23 |
|
---|
24 | #include <stdint.h>
|
---|
25 |
|
---|
26 | #define FELEM int16_t
|
---|
27 | #define FELEM2 int32_t
|
---|
28 | #define FELEM_MAX INT16_MAX
|
---|
29 | #define FELEM_MIN INT16_MIN
|
---|
30 |
|
---|
31 | typedef struct AVResampleContext{
|
---|
32 | FELEM *filter_bank;
|
---|
33 | int filter_length;
|
---|
34 | int ideal_dst_incr;
|
---|
35 | int dst_incr;
|
---|
36 | int index;
|
---|
37 | int frac;
|
---|
38 | int src_incr;
|
---|
39 | int compensation_distance;
|
---|
40 | int phase_shift;
|
---|
41 | int phase_mask;
|
---|
42 | int linear;
|
---|
43 | }AVResampleContext;
|
---|
44 |
|
---|
45 | typedef struct ReSampleContext {
|
---|
46 | struct AVResampleContext *resample_context;
|
---|
47 | short *temp[2];
|
---|
48 | int temp_len;
|
---|
49 | float ratio;
|
---|
50 | /* channel convert */
|
---|
51 | int input_channels, output_channels, filter_channels;
|
---|
52 | }/* ReSampleContext*/;
|
---|
53 |
|
---|
54 | struct ReSampleContext *audio_resample_init(int output_channels, int input_channels,
|
---|
55 | int output_rate, int input_rate);
|
---|
56 |
|
---|
57 | int audio_resample(struct ReSampleContext *s, short *output, short *input, int nb_samples);
|
---|
58 |
|
---|
59 | void audio_resample_close(struct ReSampleContext *s);
|
---|
60 | AVResampleContext *av_resample_init(int out_rate, int in_rate, int filter_size, int phase_shift, int linear, double cutoff);
|
---|
61 | void av_resample_close(AVResampleContext *c);
|
---|
62 | int av_resample(AVResampleContext *c, short *dst, short *src, int *consumed, int src_size, int dst_size, int update_ctx);
|
---|
63 |
|
---|
64 | #endif /* __resample__ */
|
---|