]> code.delx.au - pulseaudio/blob - src/pulsecore/resampler.h
add makefiles to speex/ and ffmpeg/ to easy compilation from emacs
[pulseaudio] / src / pulsecore / resampler.h
1 #ifndef fooresamplerhfoo
2 #define fooresamplerhfoo
3
4 /* $Id$ */
5
6 /***
7 This file is part of PulseAudio.
8
9 Copyright 2004-2006 Lennart Poettering
10
11 PulseAudio is free software; you can redistribute it and/or modify
12 it under the terms of the GNU Lesser General Public License as published
13 by the Free Software Foundation; either version 2 of the License,
14 or (at your option) any later version.
15
16 PulseAudio is distributed in the hope that it will be useful, but
17 WITHOUT ANY WARRANTY; without even the implied warranty of
18 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
19 General Public License for more details.
20
21 You should have received a copy of the GNU Lesser General Public License
22 along with PulseAudio; if not, write to the Free Software
23 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
24 USA.
25 ***/
26
27 #include <samplerate.h>
28
29 #include <pulse/sample.h>
30 #include <pulse/channelmap.h>
31 #include <pulsecore/memblock.h>
32 #include <pulsecore/memchunk.h>
33
34 typedef struct pa_resampler pa_resampler;
35
36 typedef enum pa_resample_method {
37 PA_RESAMPLER_INVALID = -1,
38 PA_RESAMPLER_SRC_SINC_BEST_QUALITY = SRC_SINC_BEST_QUALITY,
39 PA_RESAMPLER_SRC_SINC_MEDIUM_QUALITY = SRC_SINC_MEDIUM_QUALITY,
40 PA_RESAMPLER_SRC_SINC_FASTEST = SRC_SINC_FASTEST,
41 PA_RESAMPLER_SRC_ZERO_ORDER_HOLD = SRC_ZERO_ORDER_HOLD,
42 PA_RESAMPLER_SRC_LINEAR = SRC_LINEAR,
43 PA_RESAMPLER_TRIVIAL,
44 PA_RESAMPLER_SPEEX_FLOAT_BASE,
45 PA_RESAMPLER_SPEEX_FLOAT_MAX = PA_RESAMPLER_SPEEX_FLOAT_BASE + 10,
46 PA_RESAMPLER_SPEEX_FIXED_BASE,
47 PA_RESAMPLER_SPEEX_FIXED_MAX = PA_RESAMPLER_SPEEX_FIXED_BASE + 10,
48 PA_RESAMPLER_FFMPEG,
49 PA_RESAMPLER_AUTO, /* automatic select based on sample format */
50 PA_RESAMPLER_MAX
51 } pa_resample_method_t;
52
53 pa_resampler* pa_resampler_new(
54 pa_mempool *pool,
55 const pa_sample_spec *a,
56 const pa_channel_map *am,
57 const pa_sample_spec *b,
58 const pa_channel_map *bm,
59 pa_resample_method_t resample_method,
60 int variable_rate);
61
62 void pa_resampler_free(pa_resampler *r);
63
64 /* Returns the size of an input memory block which is required to return the specified amount of output data */
65 size_t pa_resampler_request(pa_resampler *r, size_t out_length);
66
67 /* Pass the specified memory chunk to the resampler and return the newly resampled data */
68 void pa_resampler_run(pa_resampler *r, const pa_memchunk *in, pa_memchunk *out);
69
70 /* Change the input rate of the resampler object */
71 void pa_resampler_set_input_rate(pa_resampler *r, uint32_t rate);
72
73 /* Change the output rate of the resampler object */
74 void pa_resampler_set_output_rate(pa_resampler *r, uint32_t rate);
75
76 /* Return the resampling method of the resampler object */
77 pa_resample_method_t pa_resampler_get_method(pa_resampler *r);
78
79 /* Try to parse the resampler method */
80 pa_resample_method_t pa_parse_resample_method(const char *string);
81
82 /* return a human readable string for the specified resampling method. Inverse of pa_parse_resample_method() */
83 const char *pa_resample_method_to_string(pa_resample_method_t m);
84
85 #endif