mirror of
https://gitlab.freedesktop.org/pipewire/pipewire.git
synced 2025-10-29 05:40:27 -04:00
spa: add SPA_AUDIO_MAX_POSITION
Add a new SPA_AUDIO_MAX_POSITION constant with the maximum number of channel positions that can be kept in the various audio_info structures. Repurpose the SPA_AUDIO_MAX_CHANNELS as a suggestion for applications for the max allowed number of channels in the system. Make it possible to make this a compile time constant.
This commit is contained in:
parent
dbc5c81e4a
commit
f19b075306
4 changed files with 14 additions and 7 deletions
|
|
@ -45,7 +45,7 @@ struct spa_audio_info_dsd {
|
|||
int32_t interleave; /*< interleave bytes */
|
||||
uint32_t rate; /*< sample rate (in bytes per second) */
|
||||
uint32_t channels; /*< channels */
|
||||
uint32_t position[SPA_AUDIO_MAX_CHANNELS]; /*< channel position from enum spa_audio_channel */
|
||||
uint32_t position[SPA_AUDIO_MAX_POSITION]; /*< channel position from enum spa_audio_channel */
|
||||
};
|
||||
|
||||
#define SPA_AUDIO_INFO_DSD_INIT(...) ((struct spa_audio_info_dsd) { __VA_ARGS__ })
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@ extern "C" {
|
|||
|
||||
struct spa_audio_layout_info {
|
||||
uint32_t n_channels;
|
||||
uint32_t position[SPA_AUDIO_MAX_CHANNELS];
|
||||
uint32_t position[SPA_AUDIO_MAX_POSITION];
|
||||
};
|
||||
|
||||
#define SPA_AUDIO_LAYOUT_Mono 1, { SPA_AUDIO_CHANNEL_MONO, }
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ SPA_API_AUDIO_RAW_JSON int
|
|||
spa_audio_parse_position(const char *str, size_t len,
|
||||
uint32_t *position, uint32_t *n_channels)
|
||||
{
|
||||
return spa_audio_parse_position_n(str, len, position, SPA_AUDIO_MAX_CHANNELS, n_channels);
|
||||
return spa_audio_parse_position_n(str, len, position, SPA_AUDIO_MAX_POSITION, n_channels);
|
||||
}
|
||||
|
||||
SPA_API_AUDIO_RAW_JSON int
|
||||
|
|
|
|||
|
|
@ -18,8 +18,15 @@ extern "C" {
|
|||
* \{
|
||||
*/
|
||||
|
||||
/* this is the max number of channels for position info */
|
||||
/* This is the max number of position info, changing this will change the
|
||||
* ABI */
|
||||
#define SPA_AUDIO_MAX_POSITION 64u
|
||||
|
||||
/* The suggested number of max channels, can be a compile time constant and
|
||||
* does not affect ABI or API */
|
||||
#ifndef SPA_AUDIO_MAX_CHANNELS
|
||||
#define SPA_AUDIO_MAX_CHANNELS 64u
|
||||
#endif
|
||||
|
||||
enum spa_audio_format {
|
||||
SPA_AUDIO_FORMAT_UNKNOWN,
|
||||
|
|
@ -278,9 +285,9 @@ struct spa_audio_info_raw {
|
|||
uint32_t flags; /*< extra flags */
|
||||
uint32_t rate; /*< sample rate */
|
||||
uint32_t channels; /*< number of channels. This can be larger than
|
||||
* SPA_AUDIO_MAX_CHANNELS, the position is taken
|
||||
* (index % SPA_AUDIO_MAX_CHANNELS) */
|
||||
uint32_t position[SPA_AUDIO_MAX_CHANNELS]; /*< channel position from enum spa_audio_channel */
|
||||
* SPA_AUDIO_MAX_POSITION, the position is taken
|
||||
* (index % SPA_AUDIO_MAX_POSITION) */
|
||||
uint32_t position[SPA_AUDIO_MAX_POSITION]; /*< channel position from enum spa_audio_channel */
|
||||
};
|
||||
|
||||
#define SPA_AUDIO_INFO_RAW_INIT(...) ((struct spa_audio_info_raw) { __VA_ARGS__ })
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue