diff options
author | 2019-04-01 14:12:27 +1100 | |
---|---|---|
committer | 2019-04-01 14:13:16 +1100 | |
commit | f415e56c855c97a1bb0179734f649a623b209f65 (patch) | |
tree | af9df26a1879252ae3fc3853d539e90f01072417 /include/avirt | |
parent | 09f65363ce3981cebd3c355dd0dcac479118b7bb (diff) |
Add support for routes
Signed-off-by: Mark Farrugia <mark.farrugia@fiberdyne.com.au>
Diffstat (limited to 'include/avirt')
-rw-r--r-- | include/avirt/avirt.h | 64 |
1 files changed, 63 insertions, 1 deletions
diff --git a/include/avirt/avirt.h b/include/avirt/avirt.h index f1c4060..1ebed32 100644 --- a/include/avirt/avirt.h +++ b/include/avirt/avirt.h @@ -23,7 +23,46 @@ #ifndef _AVIRT_H_ #define _AVIRT_H_ +#define MAX_STREAMS 16 +#define MAX_NAME_LEN 80 + #include <alsa/asoundlib.h> +#include <stdbool.h> + +/** + * AVIRT Audio Path info + */ +typedef struct snd_avirt_audiopath snd_avirt_audiopath; +struct snd_avirt_audiopath { + const char *uid; /* Unique identifier */ + const char *name; /* Pretty name */ + unsigned int version[3]; /* Version - Major.Minor.Ext */ + + // MUST be at the end + struct snd_avirt_audiopath *route_from_ap; + struct snd_avirt_audiopath *route_to_ap; +}; + +/* + * Audio stream configuration + */ +struct snd_avirt_stream { + const char name[MAX_NAME_LEN]; /* Stream name */ + const char map[MAX_NAME_LEN]; /* Stream Audio Path mapping */ + unsigned int channels; /* Stream channel count */ + unsigned int direction; /* Stream direction */ +}; + +/** + * Audio routing + */ +struct snd_avirt_route { + const char name[MAX_NAME_LEN]; /* Route name */ + unsigned int channels; /* Route channel count */ + unsigned int direction; /* Stream direction */ + struct snd_avirt_audiopath *from_ap; + struct snd_avirt_audiopath *to_ap; +}; /** * snd_avirt_stream_new - Create a stream in AVIRT @@ -32,6 +71,7 @@ * @direction: The stream direction * (SND_PCM_STREAM_PLAYBACK or SND_PCM_STREAM_CAPTURE) * @map: The audio path to map this stream to + * @internal: Make the PCM internal. * @return: 0 on success, negative ERRNO otherwise * * Each stream creates a PCM device for the AVIRT sound card. @@ -39,7 +79,29 @@ * is called. */ int snd_avirt_stream_new(const char *name, unsigned int channels, int direction, - const char *map); + const char *map, bool internal); + +/** + * snd_avirt_route_new - Create a route between Audio Paths in AVIRT + * @name: The name of the route. + * @channels: Number of channels for the route + * @direction: The route stream direction + * (SND_PCM_STREAM_PLAYBACK or SND_PCM_STREAM_CAPTURE) + * @from_ap: The Audio Path UID to route audio from + * @to_ap: The Audio Path UID to route audio to + * @return: 0 on success, negative ERRNO otherwise + * + * Allows Audio Paths to be piped together to allow for modular processing + * and/or networking. The "to" Audio Path must be able to accept a stream + * input whose channel count equals to "from" Audio Path's output channel + * count. + */ +int snd_avirt_route_new(const char *name, int channels, int direction, + const char *from_ap, const char *to_ap); + +int snd_avirt_routes(struct snd_avirt_route **routes, int *count); +int snd_avirt_streams(struct snd_avirt_stream **streams, int *count); +int snd_avirt_audiopaths(struct snd_avirt_audiopath **audiopaths, int *count); /** * snd_avirt_card_seal - Finalize AVIRT stream creation and register sound card |