From c032639678c494710f685612acffeae9b0f603f3 Mon Sep 17 00:00:00 2001 From: Mark Farrugia Date: Thu, 20 Sep 2018 17:23:42 +1000 Subject: Create avirt_stream structure in place of old config structures Remove unnecessary extra memory allocation with the old config structures. We can store the snd_pcm pointer, which contains lots of info already. Signed-off-by: Mark Farrugia --- core.h | 22 ++++++++++++---------- 1 file changed, 12 insertions(+), 10 deletions(-) (limited to 'core.h') diff --git a/core.h b/core.h index 98d1bbd..4a0157a 100644 --- a/core.h +++ b/core.h @@ -11,6 +11,7 @@ #define __AVIRT_CORE_H__ #include +#include #define MAX_NAME_LEN 32 @@ -37,19 +38,20 @@ struct avirt_audiopath { }; /* - * ALSA Substream device configuration + * Audio stream configuration */ -struct avirt_alsa_devconfig { - const char devicename[MAX_NAME_LEN]; - int channels; +struct avirt_stream { + struct snd_pcm *pcm; /* Stream PCM device */ + unsigned int channels; /* Stream channel count */ + struct config_item item; /* configfs item reference */ }; /** - * Collection of ALSA devices + * Collection of audio streams */ -struct avirt_alsa_group { - struct avirt_alsa_devconfig *config; - int devices; +struct avirt_stream_group { + struct avirt_stream *streams; /* AVIRT stream array */ + unsigned int devices; /* Number of stream devices */ }; /** @@ -58,8 +60,8 @@ struct avirt_alsa_group { struct avirt_coreinfo { unsigned int version[3]; - struct avirt_alsa_group playback; - struct avirt_alsa_group capture; + struct avirt_stream_group playback; + struct avirt_stream_group capture; avirt_buff_complete pcm_buff_complete; }; -- cgit 1.2.3-korg