]> code.delx.au - pulseaudio/blob - src/pulsecore/core-format.h
9342acc33a080e62f3c62cb7e7cb8e842a757c4e
[pulseaudio] / src / pulsecore / core-format.h
1 #ifndef foocoreformathfoo
2 #define foocoreformathfoo
3
4 /***
5 This file is part of PulseAudio.
6
7 PulseAudio is free software; you can redistribute it and/or modify
8 it under the terms of the GNU Lesser General Public License as published
9 by the Free Software Foundation; either version 2.1 of the License,
10 or (at your option) any later version.
11
12 PulseAudio is distributed in the hope that it will be useful, but
13 WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 General Public License for more details.
16
17 You should have received a copy of the GNU Lesser General Public License
18 along with PulseAudio; if not, write to the Free Software
19 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
20 USA.
21 ***/
22
23 #include <pulse/format.h>
24
25 /* Gets the sample format stored in the format info. Returns a negative error
26 * code on failure. If the sample format property is not set at all, returns
27 * -PA_ERR_NOENTITY. */
28 int pa_format_info_get_sample_format(pa_format_info *f, pa_sample_format_t *sf);
29
30 /* Gets the sample rate stored in the format info. Returns a negative error
31 * code on failure. If the sample rate property is not set at all, returns
32 * -PA_ERR_NOENTITY. */
33 int pa_format_info_get_rate(pa_format_info *f, uint32_t *rate);
34
35 /* Gets the channel count stored in the format info. Returns a negative error
36 * code on failure. If the channels property is not set at all, returns
37 * -PA_ERR_NOENTITY. */
38 int pa_format_info_get_channels(pa_format_info *f, uint8_t *channels);
39
40 /* Gets the channel map stored in the format info. Returns a negative error
41 * code on failure. If the channel map property is not set at all, returns
42 * -PA_ERR_NOENTITY. */
43 int pa_format_info_get_channel_map(pa_format_info *f, pa_channel_map *map);
44
45 /* Convert the format info into a sample spec and a channel map. If the format
46 * info doesn't contain some information, the fallback sample spec and channel
47 * map are used to populate the output.
48 *
49 * pa_format_info_to_sample_spec() exists too. This "version 2" was created,
50 * because the original function doesn't provide the possibility of specifying
51 * a fallback sample spec and channel map. That functionality can't be added to
52 * the original function, because the function is part of the public API and
53 * adding parameters to it would break the API. */
54 int pa_format_info_to_sample_spec2(pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map, pa_sample_spec *fallback_ss,
55 pa_channel_map *fallback_map);
56
57 /* For compressed formats. Converts the format info into a sample spec and a
58 * channel map that an ALSA device can use as its configuration parameters when
59 * playing back the compressed data. That is, the returned sample spec doesn't
60 * describe the audio content, but the device parameters. */
61 int pa_format_info_to_sample_spec_fake(pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map);
62
63 #endif