153a5a1b3Sopenharmony_ci#ifndef fooformathfoo 253a5a1b3Sopenharmony_ci#define fooformathfoo 353a5a1b3Sopenharmony_ci 453a5a1b3Sopenharmony_ci/*** 553a5a1b3Sopenharmony_ci This file is part of PulseAudio. 653a5a1b3Sopenharmony_ci 753a5a1b3Sopenharmony_ci Copyright 2011 Intel Corporation 853a5a1b3Sopenharmony_ci Copyright 2011 Collabora Multimedia 953a5a1b3Sopenharmony_ci Copyright 2011 Arun Raghavan <arun.raghavan@collabora.co.uk> 1053a5a1b3Sopenharmony_ci 1153a5a1b3Sopenharmony_ci PulseAudio is free software; you can redistribute it and/or modify 1253a5a1b3Sopenharmony_ci it under the terms of the GNU Lesser General Public License as published 1353a5a1b3Sopenharmony_ci by the Free Software Foundation; either version 2.1 of the License, 1453a5a1b3Sopenharmony_ci or (at your option) any later version. 1553a5a1b3Sopenharmony_ci 1653a5a1b3Sopenharmony_ci PulseAudio is distributed in the hope that it will be useful, but 1753a5a1b3Sopenharmony_ci WITHOUT ANY WARRANTY; without even the implied warranty of 1853a5a1b3Sopenharmony_ci MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 1953a5a1b3Sopenharmony_ci General Public License for more details. 2053a5a1b3Sopenharmony_ci 2153a5a1b3Sopenharmony_ci You should have received a copy of the GNU Lesser General Public License 2253a5a1b3Sopenharmony_ci along with PulseAudio; if not, see <http://www.gnu.org/licenses/>. 2353a5a1b3Sopenharmony_ci***/ 2453a5a1b3Sopenharmony_ci 2553a5a1b3Sopenharmony_ci#include <pulse/cdecl.h> 2653a5a1b3Sopenharmony_ci#include <pulse/gccmacro.h> 2753a5a1b3Sopenharmony_ci#include <pulse/proplist.h> 2853a5a1b3Sopenharmony_ci#include <pulse/sample.h> 2953a5a1b3Sopenharmony_ci#include <pulse/channelmap.h> 3053a5a1b3Sopenharmony_ci 3153a5a1b3Sopenharmony_ci/** \file 3253a5a1b3Sopenharmony_ci * Utility functions for handling a stream or sink format. */ 3353a5a1b3Sopenharmony_ci 3453a5a1b3Sopenharmony_ciPA_C_DECL_BEGIN 3553a5a1b3Sopenharmony_ci 3653a5a1b3Sopenharmony_ci/** Represents the type of encoding used in a stream or accepted by a sink. \since 1.0 */ 3753a5a1b3Sopenharmony_citypedef enum pa_encoding { 3853a5a1b3Sopenharmony_ci PA_ENCODING_ANY, 3953a5a1b3Sopenharmony_ci /**< Any encoding format, PCM or compressed */ 4053a5a1b3Sopenharmony_ci 4153a5a1b3Sopenharmony_ci PA_ENCODING_PCM, 4253a5a1b3Sopenharmony_ci /**< Any PCM format */ 4353a5a1b3Sopenharmony_ci 4453a5a1b3Sopenharmony_ci PA_ENCODING_AC3_IEC61937, 4553a5a1b3Sopenharmony_ci /**< AC3 data encapsulated in IEC 61937 header/padding */ 4653a5a1b3Sopenharmony_ci 4753a5a1b3Sopenharmony_ci PA_ENCODING_EAC3_IEC61937, 4853a5a1b3Sopenharmony_ci /**< EAC3 data encapsulated in IEC 61937 header/padding */ 4953a5a1b3Sopenharmony_ci 5053a5a1b3Sopenharmony_ci PA_ENCODING_MPEG_IEC61937, 5153a5a1b3Sopenharmony_ci /**< MPEG-1 or MPEG-2 (Part 3, not AAC) data encapsulated in IEC 61937 header/padding */ 5253a5a1b3Sopenharmony_ci 5353a5a1b3Sopenharmony_ci PA_ENCODING_DTS_IEC61937, 5453a5a1b3Sopenharmony_ci /**< DTS data encapsulated in IEC 61937 header/padding */ 5553a5a1b3Sopenharmony_ci 5653a5a1b3Sopenharmony_ci PA_ENCODING_MPEG2_AAC_IEC61937, 5753a5a1b3Sopenharmony_ci /**< MPEG-2 AAC data encapsulated in IEC 61937 header/padding. \since 4.0 */ 5853a5a1b3Sopenharmony_ci 5953a5a1b3Sopenharmony_ci PA_ENCODING_TRUEHD_IEC61937, 6053a5a1b3Sopenharmony_ci /**< Dolby TrueHD data encapsulated in IEC 61937 header/padding. \since 13.0 */ 6153a5a1b3Sopenharmony_ci 6253a5a1b3Sopenharmony_ci PA_ENCODING_DTSHD_IEC61937, 6353a5a1b3Sopenharmony_ci /**< DTS-HD Master Audio encapsulated in IEC 61937 header/padding. \since 13.0 */ 6453a5a1b3Sopenharmony_ci 6553a5a1b3Sopenharmony_ci /* Remeber to update 6653a5a1b3Sopenharmony_ci * https://www.freedesktop.org/wiki/Software/PulseAudio/Documentation/User/SupportedAudioFormats/ 6753a5a1b3Sopenharmony_ci * when adding new encodings! */ 6853a5a1b3Sopenharmony_ci 6953a5a1b3Sopenharmony_ci PA_ENCODING_MAX, 7053a5a1b3Sopenharmony_ci /**< Valid encoding types must be less than this value */ 7153a5a1b3Sopenharmony_ci 7253a5a1b3Sopenharmony_ci PA_ENCODING_INVALID = -1, 7353a5a1b3Sopenharmony_ci /**< Represents an invalid encoding */ 7453a5a1b3Sopenharmony_ci} pa_encoding_t; 7553a5a1b3Sopenharmony_ci 7653a5a1b3Sopenharmony_ci/** \cond fulldocs */ 7753a5a1b3Sopenharmony_ci#define PA_ENCODING_ANY PA_ENCODING_ANY 7853a5a1b3Sopenharmony_ci#define PA_ENCODING_PCM PA_ENCODING_PCM 7953a5a1b3Sopenharmony_ci#define PA_ENCODING_AC3_IEC61937 PA_ENCODING_AC3_IEC61937 8053a5a1b3Sopenharmony_ci#define PA_ENCODING_EAC3_IEC61937 PA_ENCODING_EAC3_IEC61937 8153a5a1b3Sopenharmony_ci#define PA_ENCODING_MPEG_IEC61937 PA_ENCODING_MPEG_IEC61937 8253a5a1b3Sopenharmony_ci#define PA_ENCODING_DTS_IEC61937 PA_ENCODING_DTS_IEC61937 8353a5a1b3Sopenharmony_ci#define PA_ENCODING_MPEG2_AAC_IEC61937 PA_ENCODING_MPEG2_AAC_IEC61937 8453a5a1b3Sopenharmony_ci#define PA_ENCODING_TRUEHD_IEC61937 PA_ENCODING_TRUEHD_IEC61937 8553a5a1b3Sopenharmony_ci#define PA_ENCODING_DTSHD_IEC61937 PA_ENCODING_DTSHD_IEC61937 8653a5a1b3Sopenharmony_ci#define PA_ENCODING_MAX PA_ENCODING_MAX 8753a5a1b3Sopenharmony_ci#define PA_ENCODING_INVALID PA_ENCODING_INVALID 8853a5a1b3Sopenharmony_ci/** \endcond */ 8953a5a1b3Sopenharmony_ci 9053a5a1b3Sopenharmony_ci/** Returns a printable string representing the given encoding type. \since 1.0 */ 9153a5a1b3Sopenharmony_ciconst char *pa_encoding_to_string(pa_encoding_t e) PA_GCC_CONST; 9253a5a1b3Sopenharmony_ci 9353a5a1b3Sopenharmony_ci/** Converts a string of the form returned by \a pa_encoding_to_string() back to 9453a5a1b3Sopenharmony_ci * a \a pa_encoding_t. \since 1.0 */ 9553a5a1b3Sopenharmony_cipa_encoding_t pa_encoding_from_string(const char *encoding); 9653a5a1b3Sopenharmony_ci 9753a5a1b3Sopenharmony_ci/** Represents the format of data provided in a stream or processed by a sink. \since 1.0 */ 9853a5a1b3Sopenharmony_citypedef struct pa_format_info { 9953a5a1b3Sopenharmony_ci pa_encoding_t encoding; 10053a5a1b3Sopenharmony_ci /**< The encoding used for the format */ 10153a5a1b3Sopenharmony_ci 10253a5a1b3Sopenharmony_ci pa_proplist *plist; 10353a5a1b3Sopenharmony_ci /**< Additional encoding-specific properties such as sample rate, bitrate, etc. */ 10453a5a1b3Sopenharmony_ci} pa_format_info; 10553a5a1b3Sopenharmony_ci 10653a5a1b3Sopenharmony_ci/** Allocates a new \a pa_format_info structure. Clients must initialise at 10753a5a1b3Sopenharmony_ci * least the encoding field themselves. Free with pa_format_info_free. \since 1.0 */ 10853a5a1b3Sopenharmony_cipa_format_info* pa_format_info_new(void); 10953a5a1b3Sopenharmony_ci 11053a5a1b3Sopenharmony_ci/** Returns a new \a pa_format_info struct and representing the same format as \a src. \since 1.0 */ 11153a5a1b3Sopenharmony_cipa_format_info* pa_format_info_copy(const pa_format_info *src); 11253a5a1b3Sopenharmony_ci 11353a5a1b3Sopenharmony_ci/** Frees a \a pa_format_info structure. \since 1.0 */ 11453a5a1b3Sopenharmony_civoid pa_format_info_free(pa_format_info *f); 11553a5a1b3Sopenharmony_ci 11653a5a1b3Sopenharmony_ci/** Returns non-zero when the format info structure is valid. \since 1.0 */ 11753a5a1b3Sopenharmony_ciint pa_format_info_valid(const pa_format_info *f); 11853a5a1b3Sopenharmony_ci 11953a5a1b3Sopenharmony_ci/** Returns non-zero when the format info structure represents a PCM 12053a5a1b3Sopenharmony_ci * (i.e.\ uncompressed data) format. \since 1.0 */ 12153a5a1b3Sopenharmony_ciint pa_format_info_is_pcm(const pa_format_info *f); 12253a5a1b3Sopenharmony_ci 12353a5a1b3Sopenharmony_ci/** Returns non-zero if the format represented by \a first is a subset of 12453a5a1b3Sopenharmony_ci * the format represented by \a second. This means that \a second must 12553a5a1b3Sopenharmony_ci * have all the fields that \a first does, but the reverse need not 12653a5a1b3Sopenharmony_ci * be true. This is typically expected to be used to check if a 12753a5a1b3Sopenharmony_ci * stream's format is compatible with a given sink. In such a case, 12853a5a1b3Sopenharmony_ci * \a first would be the sink's format and \a second would be the 12953a5a1b3Sopenharmony_ci * stream's. \since 1.0 */ 13053a5a1b3Sopenharmony_ciint pa_format_info_is_compatible(const pa_format_info *first, const pa_format_info *second); 13153a5a1b3Sopenharmony_ci 13253a5a1b3Sopenharmony_ci/** Maximum required string length for 13353a5a1b3Sopenharmony_ci * pa_format_info_snprint(). Please note that this value can change 13453a5a1b3Sopenharmony_ci * with any release without warning and without being considered API 13553a5a1b3Sopenharmony_ci * or ABI breakage. You should not use this definition anywhere where 13653a5a1b3Sopenharmony_ci * it might become part of an ABI. \since 1.0 */ 13753a5a1b3Sopenharmony_ci#define PA_FORMAT_INFO_SNPRINT_MAX 256 13853a5a1b3Sopenharmony_ci 13953a5a1b3Sopenharmony_ci/** Make a human-readable string representing the given format. Returns \a s. \since 1.0 */ 14053a5a1b3Sopenharmony_cichar *pa_format_info_snprint(char *s, size_t l, const pa_format_info *f); 14153a5a1b3Sopenharmony_ci 14253a5a1b3Sopenharmony_ci/** Parse a human-readable string of the form generated by 14353a5a1b3Sopenharmony_ci * \a pa_format_info_snprint() into a pa_format_info structure. \since 1.0 */ 14453a5a1b3Sopenharmony_cipa_format_info* pa_format_info_from_string(const char *str); 14553a5a1b3Sopenharmony_ci 14653a5a1b3Sopenharmony_ci/** Utility function to take a \a pa_sample_spec and generate the corresponding 14753a5a1b3Sopenharmony_ci * \a pa_format_info. 14853a5a1b3Sopenharmony_ci * 14953a5a1b3Sopenharmony_ci * Note that if you want the server to choose some of the stream parameters, 15053a5a1b3Sopenharmony_ci * for example the sample rate, so that they match the device parameters, then 15153a5a1b3Sopenharmony_ci * you shouldn't use this function. In order to allow the server to choose 15253a5a1b3Sopenharmony_ci * a parameter value, that parameter must be left unspecified in the 15353a5a1b3Sopenharmony_ci * pa_format_info object, and this function always specifies all parameters. An 15453a5a1b3Sopenharmony_ci * exception is the channel map: if you pass NULL for the channel map, then the 15553a5a1b3Sopenharmony_ci * channel map will be left unspecified, allowing the server to choose it. 15653a5a1b3Sopenharmony_ci * 15753a5a1b3Sopenharmony_ci * \since 2.0 */ 15853a5a1b3Sopenharmony_cipa_format_info* pa_format_info_from_sample_spec(const pa_sample_spec *ss, const pa_channel_map *map); 15953a5a1b3Sopenharmony_ci 16053a5a1b3Sopenharmony_ci/** Utility function to generate a \a pa_sample_spec and \a pa_channel_map corresponding to a given \a pa_format_info. The 16153a5a1b3Sopenharmony_ci * conversion for PCM formats is straight-forward. For non-PCM formats, if there is a fixed size-time conversion (i.e. all 16253a5a1b3Sopenharmony_ci * IEC61937-encapsulated formats), a "fake" sample spec whose size-time conversion corresponds to this format is provided and 16353a5a1b3Sopenharmony_ci * the channel map argument is ignored. For formats with variable size-time conversion, this function will fail. Returns a 16453a5a1b3Sopenharmony_ci * negative integer if conversion failed and 0 on success. \since 2.0 */ 16553a5a1b3Sopenharmony_ciint pa_format_info_to_sample_spec(const pa_format_info *f, pa_sample_spec *ss, pa_channel_map *map); 16653a5a1b3Sopenharmony_ci 16753a5a1b3Sopenharmony_ci/** Represents the type of value type of a property on a \ref pa_format_info. \since 2.0 */ 16853a5a1b3Sopenharmony_citypedef enum pa_prop_type_t { 16953a5a1b3Sopenharmony_ci PA_PROP_TYPE_INT, 17053a5a1b3Sopenharmony_ci /**< Integer property */ 17153a5a1b3Sopenharmony_ci 17253a5a1b3Sopenharmony_ci PA_PROP_TYPE_INT_RANGE, 17353a5a1b3Sopenharmony_ci /**< Integer range property */ 17453a5a1b3Sopenharmony_ci 17553a5a1b3Sopenharmony_ci PA_PROP_TYPE_INT_ARRAY, 17653a5a1b3Sopenharmony_ci /**< Integer array property */ 17753a5a1b3Sopenharmony_ci 17853a5a1b3Sopenharmony_ci PA_PROP_TYPE_STRING, 17953a5a1b3Sopenharmony_ci /**< String property */ 18053a5a1b3Sopenharmony_ci 18153a5a1b3Sopenharmony_ci PA_PROP_TYPE_STRING_ARRAY, 18253a5a1b3Sopenharmony_ci /**< String array property */ 18353a5a1b3Sopenharmony_ci 18453a5a1b3Sopenharmony_ci PA_PROP_TYPE_INVALID = -1, 18553a5a1b3Sopenharmony_ci /**< Represents an invalid type */ 18653a5a1b3Sopenharmony_ci} pa_prop_type_t; 18753a5a1b3Sopenharmony_ci 18853a5a1b3Sopenharmony_ci/** \cond fulldocs */ 18953a5a1b3Sopenharmony_ci#define PA_PROP_TYPE_INT PA_PROP_TYPE_INT 19053a5a1b3Sopenharmony_ci#define PA_PROP_TYPE_INT_RANGE PA_PROP_TYPE_INT_RANGE 19153a5a1b3Sopenharmony_ci#define PA_PROP_TYPE_INT_ARRAY PA_PROP_TYPE_INT_ARRAY 19253a5a1b3Sopenharmony_ci#define PA_PROP_TYPE_STRING PA_PROP_TYPE_STRING 19353a5a1b3Sopenharmony_ci#define PA_PROP_TYPE_STRING_ARRAY PA_PROP_TYPE_STRING_ARRAY 19453a5a1b3Sopenharmony_ci#define PA_PROP_TYPE_INVALID PA_PROP_TYPE_INVALID 19553a5a1b3Sopenharmony_ci/** \endcond */ 19653a5a1b3Sopenharmony_ci 19753a5a1b3Sopenharmony_ci/** Gets the type of property \a key in a given \ref pa_format_info. \since 2.0 */ 19853a5a1b3Sopenharmony_cipa_prop_type_t pa_format_info_get_prop_type(const pa_format_info *f, const char *key); 19953a5a1b3Sopenharmony_ci 20053a5a1b3Sopenharmony_ci/** Gets an integer property from the given format info. Returns 0 on success and a negative integer on failure. \since 2.0 */ 20153a5a1b3Sopenharmony_ciint pa_format_info_get_prop_int(const pa_format_info *f, const char *key, int *v); 20253a5a1b3Sopenharmony_ci/** Gets an integer range property from the given format info. Returns 0 on success and a negative integer on failure. 20353a5a1b3Sopenharmony_ci * \since 2.0 */ 20453a5a1b3Sopenharmony_ciint pa_format_info_get_prop_int_range(const pa_format_info *f, const char *key, int *min, int *max); 20553a5a1b3Sopenharmony_ci/** Gets an integer array property from the given format info. \a values contains the values and \a n_values contains the 20653a5a1b3Sopenharmony_ci * number of elements. The caller must free \a values using \ref pa_xfree. Returns 0 on success and a negative integer on 20753a5a1b3Sopenharmony_ci * failure. \since 2.0 */ 20853a5a1b3Sopenharmony_ciint pa_format_info_get_prop_int_array(const pa_format_info *f, const char *key, int **values, int *n_values); 20953a5a1b3Sopenharmony_ci/** Gets a string property from the given format info. The caller must free the returned string using \ref pa_xfree. Returns 21053a5a1b3Sopenharmony_ci * 0 on success and a negative integer on failure. \since 2.0 */ 21153a5a1b3Sopenharmony_ciint pa_format_info_get_prop_string(const pa_format_info *f, const char *key, char **v); 21253a5a1b3Sopenharmony_ci/** Gets a string array property from the given format info. \a values contains the values and \a n_values contains 21353a5a1b3Sopenharmony_ci * the number of elements. The caller must free \a values using \ref pa_format_info_free_string_array. Returns 0 on success and 21453a5a1b3Sopenharmony_ci * a negative integer on failure. \since 2.0 */ 21553a5a1b3Sopenharmony_ciint pa_format_info_get_prop_string_array(const pa_format_info *f, const char *key, char ***values, int *n_values); 21653a5a1b3Sopenharmony_ci 21753a5a1b3Sopenharmony_ci/** Frees a string array returned by \ref pa_format_info_get_prop_string_array. \since 2.0 */ 21853a5a1b3Sopenharmony_civoid pa_format_info_free_string_array(char **values, int n_values); 21953a5a1b3Sopenharmony_ci 22053a5a1b3Sopenharmony_ci/** Gets the sample format stored in the format info. Returns a negative error 22153a5a1b3Sopenharmony_ci * code on failure. If the sample format property is not set at all, returns a 22253a5a1b3Sopenharmony_ci * negative integer. \since 13.0 */ 22353a5a1b3Sopenharmony_ciint pa_format_info_get_sample_format(const pa_format_info *f, pa_sample_format_t *sf); 22453a5a1b3Sopenharmony_ci 22553a5a1b3Sopenharmony_ci/** Gets the sample rate stored in the format info. Returns a negative error 22653a5a1b3Sopenharmony_ci * code on failure. If the sample rate property is not set at all, returns a 22753a5a1b3Sopenharmony_ci * negative integer. \since 13.0 */ 22853a5a1b3Sopenharmony_ciint pa_format_info_get_rate(const pa_format_info *f, uint32_t *rate); 22953a5a1b3Sopenharmony_ci 23053a5a1b3Sopenharmony_ci/** Gets the channel count stored in the format info. Returns a negative error 23153a5a1b3Sopenharmony_ci * code on failure. If the channels property is not set at all, returns a 23253a5a1b3Sopenharmony_ci * negative integer. \since 13.0 */ 23353a5a1b3Sopenharmony_ciint pa_format_info_get_channels(const pa_format_info *f, uint8_t *channels); 23453a5a1b3Sopenharmony_ci 23553a5a1b3Sopenharmony_ci/** Gets the channel map stored in the format info. Returns a negative error 23653a5a1b3Sopenharmony_ci * code on failure. If the channel map property is not 23753a5a1b3Sopenharmony_ci * set at all, returns a negative integer. \since 13.0 */ 23853a5a1b3Sopenharmony_ciint pa_format_info_get_channel_map(const pa_format_info *f, pa_channel_map *map); 23953a5a1b3Sopenharmony_ci 24053a5a1b3Sopenharmony_ci/** Sets an integer property on the given format info. \since 1.0 */ 24153a5a1b3Sopenharmony_civoid pa_format_info_set_prop_int(pa_format_info *f, const char *key, int value); 24253a5a1b3Sopenharmony_ci/** Sets a property with a list of integer values on the given format info. \since 1.0 */ 24353a5a1b3Sopenharmony_civoid pa_format_info_set_prop_int_array(pa_format_info *f, const char *key, const int *values, int n_values); 24453a5a1b3Sopenharmony_ci/** Sets a property which can have any value in a given integer range on the given format info. \since 1.0 */ 24553a5a1b3Sopenharmony_civoid pa_format_info_set_prop_int_range(pa_format_info *f, const char *key, int min, int max); 24653a5a1b3Sopenharmony_ci/** Sets a string property on the given format info. \since 1.0 */ 24753a5a1b3Sopenharmony_civoid pa_format_info_set_prop_string(pa_format_info *f, const char *key, const char *value); 24853a5a1b3Sopenharmony_ci/** Sets a property with a list of string values on the given format info. \since 1.0 */ 24953a5a1b3Sopenharmony_civoid pa_format_info_set_prop_string_array(pa_format_info *f, const char *key, const char **values, int n_values); 25053a5a1b3Sopenharmony_ci 25153a5a1b3Sopenharmony_ci/** Convenience method to set the sample format as a property on the given 25253a5a1b3Sopenharmony_ci * format. 25353a5a1b3Sopenharmony_ci * 25453a5a1b3Sopenharmony_ci * Note for PCM: If the sample format is left unspecified in the pa_format_info 25553a5a1b3Sopenharmony_ci * object, then the server will select the stream sample format. In that case 25653a5a1b3Sopenharmony_ci * the stream sample format will most likely match the device sample format, 25753a5a1b3Sopenharmony_ci * meaning that sample format conversion will be avoided. 25853a5a1b3Sopenharmony_ci * 25953a5a1b3Sopenharmony_ci * \since 1.0 */ 26053a5a1b3Sopenharmony_civoid pa_format_info_set_sample_format(pa_format_info *f, pa_sample_format_t sf); 26153a5a1b3Sopenharmony_ci 26253a5a1b3Sopenharmony_ci/** Convenience method to set the sampling rate as a property on the given 26353a5a1b3Sopenharmony_ci * format. 26453a5a1b3Sopenharmony_ci * 26553a5a1b3Sopenharmony_ci * Note for PCM: If the sample rate is left unspecified in the pa_format_info 26653a5a1b3Sopenharmony_ci * object, then the server will select the stream sample rate. In that case the 26753a5a1b3Sopenharmony_ci * stream sample rate will most likely match the device sample rate, meaning 26853a5a1b3Sopenharmony_ci * that sample rate conversion will be avoided. 26953a5a1b3Sopenharmony_ci * 27053a5a1b3Sopenharmony_ci * \since 1.0 */ 27153a5a1b3Sopenharmony_civoid pa_format_info_set_rate(pa_format_info *f, int rate); 27253a5a1b3Sopenharmony_ci 27353a5a1b3Sopenharmony_ci/** Convenience method to set the number of channels as a property on the given 27453a5a1b3Sopenharmony_ci * format. 27553a5a1b3Sopenharmony_ci * 27653a5a1b3Sopenharmony_ci * Note for PCM: If the channel count is left unspecified in the pa_format_info 27753a5a1b3Sopenharmony_ci * object, then the server will select the stream channel count. In that case 27853a5a1b3Sopenharmony_ci * the stream channel count will most likely match the device channel count, 27953a5a1b3Sopenharmony_ci * meaning that up/downmixing will be avoided. 28053a5a1b3Sopenharmony_ci * 28153a5a1b3Sopenharmony_ci * \since 1.0 */ 28253a5a1b3Sopenharmony_civoid pa_format_info_set_channels(pa_format_info *f, int channels); 28353a5a1b3Sopenharmony_ci 28453a5a1b3Sopenharmony_ci/** Convenience method to set the channel map as a property on the given 28553a5a1b3Sopenharmony_ci * format. 28653a5a1b3Sopenharmony_ci * 28753a5a1b3Sopenharmony_ci * Note for PCM: If the channel map is left unspecified in the pa_format_info 28853a5a1b3Sopenharmony_ci * object, then the server will select the stream channel map. In that case the 28953a5a1b3Sopenharmony_ci * stream channel map will most likely match the device channel map, meaning 29053a5a1b3Sopenharmony_ci * that remixing will be avoided. 29153a5a1b3Sopenharmony_ci * 29253a5a1b3Sopenharmony_ci * \since 1.0 */ 29353a5a1b3Sopenharmony_civoid pa_format_info_set_channel_map(pa_format_info *f, const pa_channel_map *map); 29453a5a1b3Sopenharmony_ci 29553a5a1b3Sopenharmony_ciPA_C_DECL_END 29653a5a1b3Sopenharmony_ci 29753a5a1b3Sopenharmony_ci#endif 298