mirror of
https://gitlab.freedesktop.org/pulseaudio/pulseaudio.git
synced 2025-11-04 13:29:59 -05:00
channelmap: introduce pa_channel_map_mask() and pa_channel_position_mask_t
This commit is contained in:
parent
261a4830fb
commit
01fa34ba8a
3 changed files with 22 additions and 0 deletions
|
|
@ -20,6 +20,7 @@ pa_channel_map_init_auto;
|
|||
pa_channel_map_init_extend;
|
||||
pa_channel_map_init_mono;
|
||||
pa_channel_map_init_stereo;
|
||||
pa_channel_map_mask;
|
||||
pa_channel_map_parse;
|
||||
pa_channel_map_snprint;
|
||||
pa_channel_map_superset;
|
||||
|
|
|
|||
|
|
@ -852,3 +852,15 @@ int pa_channel_map_has_position(const pa_channel_map *map, pa_channel_position_t
|
|||
|
||||
return 0;
|
||||
}
|
||||
|
||||
pa_channel_position_mask_t pa_channel_map_mask(const pa_channel_map *map) {
|
||||
unsigned c;
|
||||
pa_channel_position_mask_t r = 0;
|
||||
|
||||
pa_return_val_if_fail(pa_channel_map_valid(map), 0);
|
||||
|
||||
for (c = 0; c < map->channels; c++)
|
||||
r |= PA_CHANNEL_POSITION_MASK(map->map[c]);
|
||||
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -205,6 +205,12 @@ typedef enum pa_channel_position {
|
|||
#define PA_CHANNEL_POSITION_MAX PA_CHANNEL_POSITION_MAX
|
||||
/** \endcond */
|
||||
|
||||
/** A mask of channel positions. \since 0.9.16 */
|
||||
typedef uint64_t pa_channel_position_mask_t;
|
||||
|
||||
/** Makes a bit mask from a channel position. \since 0.9.16 */
|
||||
#define PA_CHANNEL_POSITION_MASK(f) ((pa_channel_position_mask_t) (1 << (f)))
|
||||
|
||||
/** A list of channel mapping definitions for pa_channel_map_init_auto() */
|
||||
typedef enum pa_channel_map_def {
|
||||
PA_CHANNEL_MAP_AIFF,
|
||||
|
|
@ -333,6 +339,9 @@ const char* pa_channel_map_to_pretty_name(const pa_channel_map *map) PA_GCC_PURE
|
|||
* least once in the channel map. \since 0.9.16 */
|
||||
int pa_channel_map_has_position(const pa_channel_map *map, pa_channel_position_t p) PA_GCC_PURE;
|
||||
|
||||
/** Generates a bit mask from a channel map. \since 0.9.16 */
|
||||
pa_channel_position_mask_t pa_channel_map_mask(const pa_channel_map *map) PA_GCC_PURE;
|
||||
|
||||
PA_C_DECL_END
|
||||
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue