153a5a1b3Sopenharmony_ci#ifndef foochannelmaphfoo
253a5a1b3Sopenharmony_ci#define foochannelmaphfoo
353a5a1b3Sopenharmony_ci
453a5a1b3Sopenharmony_ci/***
553a5a1b3Sopenharmony_ci  This file is part of PulseAudio.
653a5a1b3Sopenharmony_ci
753a5a1b3Sopenharmony_ci  Copyright 2005-2006 Lennart Poettering
853a5a1b3Sopenharmony_ci  Copyright 2006 Pierre Ossman <ossman@cendio.se> for Cendio AB
953a5a1b3Sopenharmony_ci
1053a5a1b3Sopenharmony_ci  PulseAudio is free software; you can redistribute it and/or modify
1153a5a1b3Sopenharmony_ci  it under the terms of the GNU Lesser General Public License as published
1253a5a1b3Sopenharmony_ci  by the Free Software Foundation; either version 2.1 of the License,
1353a5a1b3Sopenharmony_ci  or (at your option) any later version.
1453a5a1b3Sopenharmony_ci
1553a5a1b3Sopenharmony_ci  PulseAudio is distributed in the hope that it will be useful, but
1653a5a1b3Sopenharmony_ci  WITHOUT ANY WARRANTY; without even the implied warranty of
1753a5a1b3Sopenharmony_ci  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
1853a5a1b3Sopenharmony_ci  General Public License for more details.
1953a5a1b3Sopenharmony_ci
2053a5a1b3Sopenharmony_ci  You should have received a copy of the GNU Lesser General Public License
2153a5a1b3Sopenharmony_ci  along with PulseAudio; if not, see <http://www.gnu.org/licenses/>.
2253a5a1b3Sopenharmony_ci***/
2353a5a1b3Sopenharmony_ci
2453a5a1b3Sopenharmony_ci#include <pulse/sample.h>
2553a5a1b3Sopenharmony_ci#include <pulse/cdecl.h>
2653a5a1b3Sopenharmony_ci#include <pulse/gccmacro.h>
2753a5a1b3Sopenharmony_ci#include <pulse/version.h>
2853a5a1b3Sopenharmony_ci
2953a5a1b3Sopenharmony_ci/** \page channelmap Channel Maps
3053a5a1b3Sopenharmony_ci *
3153a5a1b3Sopenharmony_ci * \section overv_sec Overview
3253a5a1b3Sopenharmony_ci *
3353a5a1b3Sopenharmony_ci * Channel maps provide a way to associate channels in a stream with a
3453a5a1b3Sopenharmony_ci * specific speaker position. This relieves applications of having to
3553a5a1b3Sopenharmony_ci * make sure their channel order is identical to the final output.
3653a5a1b3Sopenharmony_ci *
3753a5a1b3Sopenharmony_ci * \section init_sec Initialisation
3853a5a1b3Sopenharmony_ci *
3953a5a1b3Sopenharmony_ci * A channel map consists of an array of \ref pa_channel_position values,
4053a5a1b3Sopenharmony_ci * one for each channel. This array is stored together with a channel count
4153a5a1b3Sopenharmony_ci * in a pa_channel_map structure.
4253a5a1b3Sopenharmony_ci *
4353a5a1b3Sopenharmony_ci * Before filling the structure, the application must initialise it using
4453a5a1b3Sopenharmony_ci * pa_channel_map_init(). There are also a number of convenience functions
4553a5a1b3Sopenharmony_ci * for standard channel mappings:
4653a5a1b3Sopenharmony_ci *
4753a5a1b3Sopenharmony_ci * \li pa_channel_map_init_mono() - Create a channel map with only mono audio.
4853a5a1b3Sopenharmony_ci * \li pa_channel_map_init_stereo() - Create a standard stereo mapping.
4953a5a1b3Sopenharmony_ci * \li pa_channel_map_init_auto() - Create a standard channel map for a specific
5053a5a1b3Sopenharmony_ci *                                  number of channels.
5153a5a1b3Sopenharmony_ci * \li pa_channel_map_init_extend() - Similar to pa_channel_map_init_auto() but
5253a5a1b3Sopenharmony_ci *                                    synthesize a channel map if no predefined
5353a5a1b3Sopenharmony_ci *                                    one is known for the specified number of
5453a5a1b3Sopenharmony_ci *                                    channels.
5553a5a1b3Sopenharmony_ci *
5653a5a1b3Sopenharmony_ci * \section conv_sec Convenience Functions
5753a5a1b3Sopenharmony_ci *
5853a5a1b3Sopenharmony_ci * The library contains a number of convenience functions for dealing with
5953a5a1b3Sopenharmony_ci * channel maps:
6053a5a1b3Sopenharmony_ci *
6153a5a1b3Sopenharmony_ci * \li pa_channel_map_valid() - Tests if a channel map is valid.
6253a5a1b3Sopenharmony_ci * \li pa_channel_map_equal() - Tests if two channel maps are identical.
6353a5a1b3Sopenharmony_ci * \li pa_channel_map_snprint() - Creates a textual description of a channel
6453a5a1b3Sopenharmony_ci *                                map.
6553a5a1b3Sopenharmony_ci */
6653a5a1b3Sopenharmony_ci
6753a5a1b3Sopenharmony_ci/** \file
6853a5a1b3Sopenharmony_ci * Constants and routines for channel mapping handling
6953a5a1b3Sopenharmony_ci *
7053a5a1b3Sopenharmony_ci * See also \subpage channelmap
7153a5a1b3Sopenharmony_ci */
7253a5a1b3Sopenharmony_ci
7353a5a1b3Sopenharmony_ciPA_C_DECL_BEGIN
7453a5a1b3Sopenharmony_ci
7553a5a1b3Sopenharmony_ci/** A list of channel labels */
7653a5a1b3Sopenharmony_citypedef enum pa_channel_position {
7753a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_INVALID = -1,
7853a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_MONO = 0,
7953a5a1b3Sopenharmony_ci
8053a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_FRONT_LEFT,               /**< Apple, Dolby call this 'Left' */
8153a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_FRONT_RIGHT,              /**< Apple, Dolby call this 'Right' */
8253a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_FRONT_CENTER,             /**< Apple, Dolby call this 'Center' */
8353a5a1b3Sopenharmony_ci
8453a5a1b3Sopenharmony_ci/** \cond fulldocs */
8553a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_LEFT = PA_CHANNEL_POSITION_FRONT_LEFT,
8653a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_RIGHT = PA_CHANNEL_POSITION_FRONT_RIGHT,
8753a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_CENTER = PA_CHANNEL_POSITION_FRONT_CENTER,
8853a5a1b3Sopenharmony_ci/** \endcond */
8953a5a1b3Sopenharmony_ci
9053a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_REAR_CENTER,              /**< Microsoft calls this 'Back Center', Apple calls this 'Center Surround', Dolby calls this 'Surround Rear Center' */
9153a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_REAR_LEFT,                /**< Microsoft calls this 'Back Left', Apple calls this 'Left Surround' (!), Dolby calls this 'Surround Rear Left'  */
9253a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_REAR_RIGHT,               /**< Microsoft calls this 'Back Right', Apple calls this 'Right Surround' (!), Dolby calls this 'Surround Rear Right'  */
9353a5a1b3Sopenharmony_ci
9453a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_LFE,                      /**< Microsoft calls this 'Low Frequency', Apple calls this 'LFEScreen' */
9553a5a1b3Sopenharmony_ci/** \cond fulldocs */
9653a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_SUBWOOFER = PA_CHANNEL_POSITION_LFE,
9753a5a1b3Sopenharmony_ci/** \endcond */
9853a5a1b3Sopenharmony_ci
9953a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER,     /**< Apple, Dolby call this 'Left Center' */
10053a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER,    /**< Apple, Dolby call this 'Right Center */
10153a5a1b3Sopenharmony_ci
10253a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_SIDE_LEFT,                /**< Apple calls this 'Left Surround Direct', Dolby calls this 'Surround Left' (!) */
10353a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_SIDE_RIGHT,               /**< Apple calls this 'Right Surround Direct', Dolby calls this 'Surround Right' (!) */
10453a5a1b3Sopenharmony_ci
10553a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX0,
10653a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX1,
10753a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX2,
10853a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX3,
10953a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX4,
11053a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX5,
11153a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX6,
11253a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX7,
11353a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX8,
11453a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX9,
11553a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX10,
11653a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX11,
11753a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX12,
11853a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX13,
11953a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX14,
12053a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX15,
12153a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX16,
12253a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX17,
12353a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX18,
12453a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX19,
12553a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX20,
12653a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX21,
12753a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX22,
12853a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX23,
12953a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX24,
13053a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX25,
13153a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX26,
13253a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX27,
13353a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX28,
13453a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX29,
13553a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX30,
13653a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_AUX31,
13753a5a1b3Sopenharmony_ci
13853a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_TOP_CENTER,               /**< Apple calls this 'Top Center Surround' */
13953a5a1b3Sopenharmony_ci
14053a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_TOP_FRONT_LEFT,           /**< Apple calls this 'Vertical Height Left' */
14153a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_TOP_FRONT_RIGHT,          /**< Apple calls this 'Vertical Height Right' */
14253a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_TOP_FRONT_CENTER,         /**< Apple calls this 'Vertical Height Center' */
14353a5a1b3Sopenharmony_ci
14453a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_TOP_REAR_LEFT,            /**< Microsoft and Apple call this 'Top Back Left' */
14553a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_TOP_REAR_RIGHT,           /**< Microsoft and Apple call this 'Top Back Right' */
14653a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_TOP_REAR_CENTER,          /**< Microsoft and Apple call this 'Top Back Center' */
14753a5a1b3Sopenharmony_ci
14853a5a1b3Sopenharmony_ci    PA_CHANNEL_POSITION_MAX
14953a5a1b3Sopenharmony_ci} pa_channel_position_t;
15053a5a1b3Sopenharmony_ci
15153a5a1b3Sopenharmony_ci/** \cond fulldocs */
15253a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_INVALID PA_CHANNEL_POSITION_INVALID
15353a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_MONO PA_CHANNEL_POSITION_MONO
15453a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_LEFT PA_CHANNEL_POSITION_LEFT
15553a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_RIGHT PA_CHANNEL_POSITION_RIGHT
15653a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_CENTER PA_CHANNEL_POSITION_CENTER
15753a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_FRONT_LEFT PA_CHANNEL_POSITION_FRONT_LEFT
15853a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_FRONT_RIGHT PA_CHANNEL_POSITION_FRONT_RIGHT
15953a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_FRONT_CENTER PA_CHANNEL_POSITION_FRONT_CENTER
16053a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_REAR_CENTER PA_CHANNEL_POSITION_REAR_CENTER
16153a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_REAR_LEFT PA_CHANNEL_POSITION_REAR_LEFT
16253a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_REAR_RIGHT PA_CHANNEL_POSITION_REAR_RIGHT
16353a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_LFE PA_CHANNEL_POSITION_LFE
16453a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_SUBWOOFER PA_CHANNEL_POSITION_SUBWOOFER
16553a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER PA_CHANNEL_POSITION_FRONT_LEFT_OF_CENTER
16653a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER PA_CHANNEL_POSITION_FRONT_RIGHT_OF_CENTER
16753a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_SIDE_LEFT PA_CHANNEL_POSITION_SIDE_LEFT
16853a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_SIDE_RIGHT PA_CHANNEL_POSITION_SIDE_RIGHT
16953a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX0 PA_CHANNEL_POSITION_AUX0
17053a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX1 PA_CHANNEL_POSITION_AUX1
17153a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX2 PA_CHANNEL_POSITION_AUX2
17253a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX3 PA_CHANNEL_POSITION_AUX3
17353a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX4 PA_CHANNEL_POSITION_AUX4
17453a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX5 PA_CHANNEL_POSITION_AUX5
17553a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX6 PA_CHANNEL_POSITION_AUX6
17653a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX7 PA_CHANNEL_POSITION_AUX7
17753a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX8 PA_CHANNEL_POSITION_AUX8
17853a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX9 PA_CHANNEL_POSITION_AUX9
17953a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX10 PA_CHANNEL_POSITION_AUX10
18053a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX11 PA_CHANNEL_POSITION_AUX11
18153a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX12 PA_CHANNEL_POSITION_AUX12
18253a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX13 PA_CHANNEL_POSITION_AUX13
18353a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX14 PA_CHANNEL_POSITION_AUX14
18453a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX15 PA_CHANNEL_POSITION_AUX15
18553a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX16 PA_CHANNEL_POSITION_AUX16
18653a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX17 PA_CHANNEL_POSITION_AUX17
18753a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX18 PA_CHANNEL_POSITION_AUX18
18853a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX19 PA_CHANNEL_POSITION_AUX19
18953a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX20 PA_CHANNEL_POSITION_AUX20
19053a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX21 PA_CHANNEL_POSITION_AUX21
19153a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX22 PA_CHANNEL_POSITION_AUX22
19253a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX23 PA_CHANNEL_POSITION_AUX23
19353a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX24 PA_CHANNEL_POSITION_AUX24
19453a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX25 PA_CHANNEL_POSITION_AUX25
19553a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX26 PA_CHANNEL_POSITION_AUX26
19653a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX27 PA_CHANNEL_POSITION_AUX27
19753a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX28 PA_CHANNEL_POSITION_AUX28
19853a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX29 PA_CHANNEL_POSITION_AUX29
19953a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX30 PA_CHANNEL_POSITION_AUX30
20053a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_AUX31 PA_CHANNEL_POSITION_AUX31
20153a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_TOP_CENTER PA_CHANNEL_POSITION_TOP_CENTER
20253a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_TOP_FRONT_LEFT PA_CHANNEL_POSITION_TOP_FRONT_LEFT
20353a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_TOP_FRONT_RIGHT PA_CHANNEL_POSITION_TOP_FRONT_RIGHT
20453a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_TOP_FRONT_CENTER PA_CHANNEL_POSITION_TOP_FRONT_CENTER
20553a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_TOP_REAR_LEFT PA_CHANNEL_POSITION_TOP_REAR_LEFT
20653a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_TOP_REAR_RIGHT PA_CHANNEL_POSITION_TOP_REAR_RIGHT
20753a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_TOP_REAR_CENTER PA_CHANNEL_POSITION_TOP_REAR_CENTER
20853a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_MAX PA_CHANNEL_POSITION_MAX
20953a5a1b3Sopenharmony_ci/** \endcond */
21053a5a1b3Sopenharmony_ci
21153a5a1b3Sopenharmony_ci/** A mask of channel positions. \since 0.9.16 */
21253a5a1b3Sopenharmony_citypedef uint64_t pa_channel_position_mask_t;
21353a5a1b3Sopenharmony_ci
21453a5a1b3Sopenharmony_ci/** Makes a bit mask from a channel position. \since 0.9.16 */
21553a5a1b3Sopenharmony_ci#define PA_CHANNEL_POSITION_MASK(f) ((pa_channel_position_mask_t) (1ULL << (f)))
21653a5a1b3Sopenharmony_ci
21753a5a1b3Sopenharmony_ci/** A list of channel mapping definitions for pa_channel_map_init_auto() */
21853a5a1b3Sopenharmony_citypedef enum pa_channel_map_def {
21953a5a1b3Sopenharmony_ci    PA_CHANNEL_MAP_AIFF,
22053a5a1b3Sopenharmony_ci    /**< The mapping from RFC3551, which is based on AIFF-C */
22153a5a1b3Sopenharmony_ci
22253a5a1b3Sopenharmony_ci/** \cond fulldocs */
22353a5a1b3Sopenharmony_ci    PA_CHANNEL_MAP_ALSA,
22453a5a1b3Sopenharmony_ci    /**< The default mapping used by ALSA. This mapping is probably
22553a5a1b3Sopenharmony_ci     * not too useful since ALSA's default channel mapping depends on
22653a5a1b3Sopenharmony_ci     * the device string used. */
22753a5a1b3Sopenharmony_ci/** \endcond */
22853a5a1b3Sopenharmony_ci
22953a5a1b3Sopenharmony_ci    PA_CHANNEL_MAP_AUX,
23053a5a1b3Sopenharmony_ci    /**< Only aux channels */
23153a5a1b3Sopenharmony_ci
23253a5a1b3Sopenharmony_ci    PA_CHANNEL_MAP_WAVEEX,
23353a5a1b3Sopenharmony_ci    /**< Microsoft's WAVEFORMATEXTENSIBLE mapping. This mapping works
23453a5a1b3Sopenharmony_ci     * as if all LSBs of dwChannelMask are set.  */
23553a5a1b3Sopenharmony_ci
23653a5a1b3Sopenharmony_ci/** \cond fulldocs */
23753a5a1b3Sopenharmony_ci    PA_CHANNEL_MAP_OSS,
23853a5a1b3Sopenharmony_ci    /**< The default channel mapping used by OSS as defined in the OSS
23953a5a1b3Sopenharmony_ci     * 4.0 API specs. This mapping is probably not too useful since
24053a5a1b3Sopenharmony_ci     * the OSS API has changed in this respect and no longer knows a
24153a5a1b3Sopenharmony_ci     * default channel mapping based on the number of channels. */
24253a5a1b3Sopenharmony_ci/** \endcond */
24353a5a1b3Sopenharmony_ci
24453a5a1b3Sopenharmony_ci    /**< Upper limit of valid channel mapping definitions */
24553a5a1b3Sopenharmony_ci    PA_CHANNEL_MAP_DEF_MAX,
24653a5a1b3Sopenharmony_ci
24753a5a1b3Sopenharmony_ci    PA_CHANNEL_MAP_DEFAULT = PA_CHANNEL_MAP_AIFF
24853a5a1b3Sopenharmony_ci    /**< The default channel map */
24953a5a1b3Sopenharmony_ci} pa_channel_map_def_t;
25053a5a1b3Sopenharmony_ci
25153a5a1b3Sopenharmony_ci/** \cond fulldocs */
25253a5a1b3Sopenharmony_ci#define PA_CHANNEL_MAP_AIFF PA_CHANNEL_MAP_AIFF
25353a5a1b3Sopenharmony_ci#define PA_CHANNEL_MAP_ALSA PA_CHANNEL_MAP_ALSA
25453a5a1b3Sopenharmony_ci#define PA_CHANNEL_MAP_AUX PA_CHANNEL_MAP_AUX
25553a5a1b3Sopenharmony_ci#define PA_CHANNEL_MAP_WAVEEX PA_CHANNEL_MAP_WAVEEX
25653a5a1b3Sopenharmony_ci#define PA_CHANNEL_MAP_OSS PA_CHANNEL_MAP_OSS
25753a5a1b3Sopenharmony_ci#define PA_CHANNEL_MAP_DEF_MAX PA_CHANNEL_MAP_DEF_MAX
25853a5a1b3Sopenharmony_ci#define PA_CHANNEL_MAP_DEFAULT PA_CHANNEL_MAP_DEFAULT
25953a5a1b3Sopenharmony_ci/** \endcond */
26053a5a1b3Sopenharmony_ci
26153a5a1b3Sopenharmony_ci/** A channel map which can be used to attach labels to specific
26253a5a1b3Sopenharmony_ci * channels of a stream. These values are relevant for conversion and
26353a5a1b3Sopenharmony_ci * mixing of streams */
26453a5a1b3Sopenharmony_citypedef struct pa_channel_map {
26553a5a1b3Sopenharmony_ci    uint8_t channels;
26653a5a1b3Sopenharmony_ci    /**< Number of channels mapped */
26753a5a1b3Sopenharmony_ci
26853a5a1b3Sopenharmony_ci    pa_channel_position_t map[PA_CHANNELS_MAX];
26953a5a1b3Sopenharmony_ci    /**< Channel labels */
27053a5a1b3Sopenharmony_ci} pa_channel_map;
27153a5a1b3Sopenharmony_ci
27253a5a1b3Sopenharmony_ci/** Initialize the specified channel map and return a pointer to
27353a5a1b3Sopenharmony_ci * it. The channel map will have a defined state but
27453a5a1b3Sopenharmony_ci * pa_channel_map_valid() will fail for it. */
27553a5a1b3Sopenharmony_cipa_channel_map* pa_channel_map_init(pa_channel_map *m);
27653a5a1b3Sopenharmony_ci
27753a5a1b3Sopenharmony_ci/** Initialize the specified channel map for monaural audio and return a pointer to it */
27853a5a1b3Sopenharmony_cipa_channel_map* pa_channel_map_init_mono(pa_channel_map *m);
27953a5a1b3Sopenharmony_ci
28053a5a1b3Sopenharmony_ci/** Initialize the specified channel map for stereophonic audio and return a pointer to it */
28153a5a1b3Sopenharmony_cipa_channel_map* pa_channel_map_init_stereo(pa_channel_map *m);
28253a5a1b3Sopenharmony_ci
28353a5a1b3Sopenharmony_ci/** Initialize the specified channel map for the specified number of
28453a5a1b3Sopenharmony_ci * channels using default labels and return a pointer to it. This call
28553a5a1b3Sopenharmony_ci * will fail (return NULL) if there is no default channel map known for this
28653a5a1b3Sopenharmony_ci * specific number of channels and mapping. */
28753a5a1b3Sopenharmony_cipa_channel_map* pa_channel_map_init_auto(pa_channel_map *m, unsigned channels, pa_channel_map_def_t def);
28853a5a1b3Sopenharmony_ci
28953a5a1b3Sopenharmony_ci/** Similar to pa_channel_map_init_auto() but instead of failing if no
29053a5a1b3Sopenharmony_ci * default mapping is known with the specified parameters it will
29153a5a1b3Sopenharmony_ci * synthesize a mapping based on a known mapping with fewer channels
29253a5a1b3Sopenharmony_ci * and fill up the rest with AUX0...AUX31 channels  \since 0.9.11 */
29353a5a1b3Sopenharmony_cipa_channel_map* pa_channel_map_init_extend(pa_channel_map *m, unsigned channels, pa_channel_map_def_t def);
29453a5a1b3Sopenharmony_ci
29553a5a1b3Sopenharmony_ci/** Return a text label for the specified channel position */
29653a5a1b3Sopenharmony_ciconst char* pa_channel_position_to_string(pa_channel_position_t pos) PA_GCC_PURE;
29753a5a1b3Sopenharmony_ci
29853a5a1b3Sopenharmony_ci/** The inverse of pa_channel_position_to_string(). \since 0.9.16 */
29953a5a1b3Sopenharmony_cipa_channel_position_t pa_channel_position_from_string(const char *s) PA_GCC_PURE;
30053a5a1b3Sopenharmony_ci
30153a5a1b3Sopenharmony_ci/** Return a human readable text label for the specified channel position. \since 0.9.7 */
30253a5a1b3Sopenharmony_ciconst char* pa_channel_position_to_pretty_string(pa_channel_position_t pos);
30353a5a1b3Sopenharmony_ci
30453a5a1b3Sopenharmony_ci/** The maximum length of strings returned by
30553a5a1b3Sopenharmony_ci * pa_channel_map_snprint(). Please note that this value can change
30653a5a1b3Sopenharmony_ci * with any release without warning and without being considered API
30753a5a1b3Sopenharmony_ci * or ABI breakage. You should not use this definition anywhere where
30853a5a1b3Sopenharmony_ci * it might become part of an ABI. */
30953a5a1b3Sopenharmony_ci#define PA_CHANNEL_MAP_SNPRINT_MAX 336
31053a5a1b3Sopenharmony_ci
31153a5a1b3Sopenharmony_ci/** Make a human readable string from the specified channel map. Returns \a s. */
31253a5a1b3Sopenharmony_cichar* pa_channel_map_snprint(char *s, size_t l, const pa_channel_map *map);
31353a5a1b3Sopenharmony_ci
31453a5a1b3Sopenharmony_ci/** Parse a channel position list or well-known mapping name into a
31553a5a1b3Sopenharmony_ci * channel map structure. This turns the output of
31653a5a1b3Sopenharmony_ci * pa_channel_map_snprint() and pa_channel_map_to_name() back into a
31753a5a1b3Sopenharmony_ci * pa_channel_map */
31853a5a1b3Sopenharmony_cipa_channel_map *pa_channel_map_parse(pa_channel_map *map, const char *s);
31953a5a1b3Sopenharmony_ci
32053a5a1b3Sopenharmony_ci/** Compare two channel maps. Return 1 if both match. */
32153a5a1b3Sopenharmony_ciint pa_channel_map_equal(const pa_channel_map *a, const pa_channel_map *b) PA_GCC_PURE;
32253a5a1b3Sopenharmony_ci
32353a5a1b3Sopenharmony_ci/** Return non-zero if the specified channel map is considered valid */
32453a5a1b3Sopenharmony_ciint pa_channel_map_valid(const pa_channel_map *map) PA_GCC_PURE;
32553a5a1b3Sopenharmony_ci
32653a5a1b3Sopenharmony_ci/** Return non-zero if the specified channel map is compatible with
32753a5a1b3Sopenharmony_ci * the specified sample spec. \since 0.9.12 */
32853a5a1b3Sopenharmony_ciint pa_channel_map_compatible(const pa_channel_map *map, const pa_sample_spec *ss) PA_GCC_PURE;
32953a5a1b3Sopenharmony_ci
33053a5a1b3Sopenharmony_ci/** Returns non-zero if every channel defined in b is also defined in a. \since 0.9.15 */
33153a5a1b3Sopenharmony_ciint pa_channel_map_superset(const pa_channel_map *a, const pa_channel_map *b) PA_GCC_PURE;
33253a5a1b3Sopenharmony_ci
33353a5a1b3Sopenharmony_ci/** Returns non-zero if it makes sense to apply a volume 'balance'
33453a5a1b3Sopenharmony_ci * with this mapping, i.e.\ if there are left/right channels
33553a5a1b3Sopenharmony_ci * available. \since 0.9.15 */
33653a5a1b3Sopenharmony_ciint pa_channel_map_can_balance(const pa_channel_map *map) PA_GCC_PURE;
33753a5a1b3Sopenharmony_ci
33853a5a1b3Sopenharmony_ci/** Returns non-zero if it makes sense to apply a volume 'fade'
33953a5a1b3Sopenharmony_ci * (i.e.\ 'balance' between front and rear) with this mapping, i.e.\ if
34053a5a1b3Sopenharmony_ci * there are front/rear channels available. \since 0.9.15 */
34153a5a1b3Sopenharmony_ciint pa_channel_map_can_fade(const pa_channel_map *map) PA_GCC_PURE;
34253a5a1b3Sopenharmony_ci
34353a5a1b3Sopenharmony_ci/** Returns non-zero if it makes sense to apply a volume 'lfe balance'
34453a5a1b3Sopenharmony_ci * (i.e.\ 'balance' between LFE and non-LFE channels) with this mapping,
34553a5a1b3Sopenharmony_ci *  i.e.\ if there are LFE and non-LFE channels available. \since 8.0 */
34653a5a1b3Sopenharmony_ciint pa_channel_map_can_lfe_balance(const pa_channel_map *map) PA_GCC_PURE;
34753a5a1b3Sopenharmony_ci
34853a5a1b3Sopenharmony_ci/** Tries to find a well-known channel mapping name for this channel
34953a5a1b3Sopenharmony_ci * mapping, i.e.\ "stereo", "surround-71" and so on. If the channel
35053a5a1b3Sopenharmony_ci * mapping is unknown NULL will be returned. This name can be parsed
35153a5a1b3Sopenharmony_ci * with pa_channel_map_parse() \since 0.9.15 */
35253a5a1b3Sopenharmony_ciconst char* pa_channel_map_to_name(const pa_channel_map *map) PA_GCC_PURE;
35353a5a1b3Sopenharmony_ci
35453a5a1b3Sopenharmony_ci/** Tries to find a human readable text label for this channel
35553a5a1b3Sopenharmony_cimapping, i.e.\ "Stereo", "Surround 7.1" and so on. If the channel
35653a5a1b3Sopenharmony_cimapping is unknown NULL will be returned. \since 0.9.15 */
35753a5a1b3Sopenharmony_ciconst char* pa_channel_map_to_pretty_name(const pa_channel_map *map) PA_GCC_PURE;
35853a5a1b3Sopenharmony_ci
35953a5a1b3Sopenharmony_ci/** Returns non-zero if the specified channel position is available at
36053a5a1b3Sopenharmony_ci * least once in the channel map. \since 0.9.16 */
36153a5a1b3Sopenharmony_ciint pa_channel_map_has_position(const pa_channel_map *map, pa_channel_position_t p) PA_GCC_PURE;
36253a5a1b3Sopenharmony_ci
36353a5a1b3Sopenharmony_ci/** Generates a bit mask from a channel map. \since 0.9.16 */
36453a5a1b3Sopenharmony_cipa_channel_position_mask_t pa_channel_map_mask(const pa_channel_map *map) PA_GCC_PURE;
36553a5a1b3Sopenharmony_ci
36653a5a1b3Sopenharmony_ciPA_C_DECL_END
36753a5a1b3Sopenharmony_ci
36853a5a1b3Sopenharmony_ci#endif
369