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, see <http://www.gnu.org/licenses/>. 19 ***/ 20 21 #include <pulse/format.h> 22 23 #include <stdbool.h> 24 25 /* Convert a sample spec and an optional channel map to a new PCM format info 26 * object (remember to free it). If map is NULL, then the channel map will be 27 * left unspecified. If some fields of the sample spec should be ignored, pass 28 * false for set_format, set_rate and set_channels as appropriate, then those 29 * fields will be left unspecified. This function returns NULL if the input is 30 * invalid (for example, setting the sample rate was requested, but the rate 31 * in ss is invalid). 32 * 33 * pa_format_info_from_sample_spec() exists too. This "version 2" was created, 34 * because the original function doesn't provide the possibility of ignoring 35 * some of the sample spec fields. That functionality can't be added to the 36 * original function, because the function is a part of the public API and 37 * adding parameters to it would break the API. */ 38 pa_format_info *pa_format_info_from_sample_spec2(const pa_sample_spec *ss, const pa_channel_map *map, bool set_format, 39 bool set_rate, bool set_channels); 40 41 /* Convert the format info into a sample spec and a channel map. If the format 42 * info doesn't contain some information, the fallback sample spec and channel 43 * map are used to populate the output. 44 * 45 * pa_format_info_to_sample_spec() exists too. This "version 2" was created, 46 * because the original function doesn't provide the possibility of specifying 47 * a fallback sample spec and channel map. That functionality can't be added to 48 * the original function, because the function is part of the public API and 49 * adding parameters to it would break the API. */ 50 int pa_format_info_to_sample_spec2(const pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map, 51 const pa_sample_spec *fallback_ss, const pa_channel_map *fallback_map); 52 53 /* For compressed formats. Converts the format info into a sample spec and a 54 * channel map that an ALSA device can use as its configuration parameters when 55 * playing back the compressed data. That is, the returned sample spec doesn't 56 * describe the audio content, but the device parameters. */ 57 int pa_format_info_to_sample_spec_fake(const pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map); 58 59 #endif 60