aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/alsa/alsa-softmixer.h
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/alsa/alsa-softmixer.h')
-rw-r--r--plugins/alsa/alsa-softmixer.h96
1 files changed, 76 insertions, 20 deletions
diff --git a/plugins/alsa/alsa-softmixer.h b/plugins/alsa/alsa-softmixer.h
index 17e7cf2..db499c3 100644
--- a/plugins/alsa/alsa-softmixer.h
+++ b/plugins/alsa/alsa-softmixer.h
@@ -14,7 +14,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*
-*/
+ */
#define _GNU_SOURCE // needed for vasprintf
@@ -25,6 +25,7 @@
#include <systemd/sd-event.h>
#include <json-c/json_object.h>
#include <stdio.h>
+#include <stdlib.h>
#include "ctl-plugin.h"
#include "wrap-json.h"
@@ -33,59 +34,114 @@
#define MAINLOOP_WATCHDOG 30000
#define MAX_AUDIO_STREAMS 8
+#define ALSA_DEFAULT_PCM_RATE 48000
+#define ALSA_CARDID_MAX_LEN 32
+
#define ALSA_PLUG_PROTO(plugin) \
int _snd_pcm_ ## plugin ## _open(snd_pcm_t **pcmp, const char *name, snd_config_t *root, snd_config_t *conf, snd_pcm_stream_t stream, int mode)
+
+
// alsa-utils-bypath.c
typedef struct {
+ const char*uid;
+ int port;
+} AlsaPcmChannels;
+
+typedef struct {
+ unsigned int rate;
+ unsigned int channels;
+ snd_pcm_format_t format;
+ snd_pcm_access_t access;
+ size_t sampleSize;
+} AlsaPcmHwInfoT;
+
+typedef struct {
+ const char *uid;
const char *devpath;
- const char *devid;
+ const char *cardid;
+ int cardidx;
int device;
int subdev;
int numid;
- int cardid;
+ int ccount;
snd_pcm_t *handle;
+ AlsaPcmChannels *channels;
+ AlsaPcmHwInfoT params;
} AlsaPcmInfoT;
typedef struct {
- unsigned int rate;
- unsigned int channels;
- snd_pcm_format_t format;
- snd_pcm_access_t access;
- size_t sampleSize;
-} AlsaPcmHwInfoT;
+ const char *uid;
+ snd_pcm_stream_t type;
+ AlsaPcmChannels *channels;
+ AlsaPcmInfoT *pcm;
+} AlsaSndZoneT;
+
+typedef struct {
+ const char *uid;
+ const char *devpath;
+ const char *cardid;
+ int cardidx;
+ int playback;
+ int capture;
+ int scount;
+ AlsaPcmInfoT *subdevs;
+} AlsaSndLoopT;
+
+
-PUBLIC snd_ctl_card_info_t* AlsaByPathInfo (CtlSourceT *source, const char *control);
+typedef struct {
+ const char *uid;
+ const char *zone;
+ int volume;
+ int mute;
+ AlsaPcmInfoT *pcm;
+ AlsaPcmHwInfoT params;
+} AlsaSndStreamT;
+
+typedef struct {
+ AlsaSndLoopT *loopCtl;
+ AlsaPcmInfoT *sndcardCtl;
+ AlsaPcmInfoT *multiPcm;
+ AlsaPcmInfoT **zonePcms;
+} SoftMixerHandleT;
+
+extern SoftMixerHandleT *Softmixer;
+
+PUBLIC snd_ctl_card_info_t* AlsaByPathInfo(CtlSourceT *source, const char *control);
PUBLIC AlsaPcmInfoT* AlsaByPathOpenPcm(CtlSourceT *source, AlsaPcmInfoT *dev, snd_pcm_stream_t direction);
-PUBLIC snd_ctl_t *AlsaByPathOpenCtl (CtlSourceT *source, AlsaPcmInfoT *dev);
-PUBLIC int AlsaByPathDevid (CtlSourceT *source, AlsaPcmInfoT *dev);
+PUBLIC snd_ctl_t *AlsaByPathOpenCtl(CtlSourceT *source, AlsaPcmInfoT *dev);
+PUBLIC int AlsaByPathDevid(CtlSourceT *source, AlsaPcmInfoT *dev);
// alsa-utils-dump.c
PUBLIC void AlsaDumpFormats(CtlSourceT *source, snd_pcm_t *pcmHandle);
PUBLIC char *AlsaDumpPcmUid(snd_pcm_t *pcmHandle, char *buffer, size_t len);
PUBLIC void AlsaDumpCtlSubdev(CtlSourceT *source, snd_ctl_t *handle);
-PUBLIC void AlsaDumpPcmInfo(CtlSourceT *source, snd_pcm_t *pcm, const char* info);
+PUBLIC void AlsaDumpElemConfig(CtlSourceT *source, const char* info, const char* elem);
+PUBLIC void AlsaDumpPcmInfo(CtlSourceT *source, const char* info, snd_pcm_t *pcm);
PUBLIC void AlsaDumpPcmParams(CtlSourceT *source, snd_pcm_hw_params_t *pcmHwParams);
-PUBLIC void AlsaDumpCtlConfig(CtlSourceT *source, snd_config_t *config, int indent);
+PUBLIC void AlsaDumpCtlConfig(CtlSourceT *source, const char* info, snd_config_t *config, int indent);
#define ALSA_PCM_UID(pcmHandle, buffer) AlsaDumpPcmUid(pcmHandle, buffer, sizeof(buffer))
PUBLIC char *AlsaDumpCtlUid(snd_ctl_t *ctlHandle, char *buffer, size_t len);
#define ALSA_CTL_UID(ctlHandle, buffer) AlsaDumpCtlUid(ctlHandle, buffer, sizeof(buffer))
// alsa-core-ctl.c
-PUBLIC snd_ctl_card_info_t *AlsaCtlGetInfo (CtlSourceT *source, const char *devid);
-PUBLIC snd_ctl_t *AlsaCtlOpenCtl (CtlSourceT *source, const char *devid);
+PUBLIC snd_ctl_card_info_t *AlsaCtlGetInfo(CtlSourceT *source, const char *cardid);
+PUBLIC snd_ctl_t *AlsaCtlOpenCtl(CtlSourceT *source, const char *cardid);
PUBLIC int AlsaCtlSubscribe(CtlSourceT *source, snd_ctl_t *ctlDev);
PUBLIC int AlsaCtlRegister(CtlSourceT *source, AlsaPcmInfoT *pcm, int numid);
PUBLIC int AlsaCtlGetNumidValueI(CtlSourceT *source, snd_ctl_t* ctlDev, int numid, long* value);
-
-
+// alsa-core-pcm.c
PUBLIC int AlsaPcmConf(CtlSourceT *source, AlsaPcmInfoT *pcm, AlsaPcmHwInfoT *opts);
PUBLIC int AlsaPcmCopy(CtlSourceT *source, AlsaPcmInfoT *pcmIn, AlsaPcmInfoT *pcmOut, AlsaPcmHwInfoT *opts);
-// _snd_pcm_PLUGIN_open_ see macro ALSA_PLUG_PROTO(plugin)
+// alsa-plug-*.c _snd_pcm_PLUGIN_open_ see macro ALSA_PLUG_PROTO(plugin)
PUBLIC AlsaPcmInfoT* AlsaCreateDmix(CtlSourceT *source, const char* pcmName, AlsaPcmInfoT *pcmSlave);
-PUBLIC AlsaPcmInfoT* AlsaCreateVol(CtlSourceT *source, const char *pcmName, AlsaPcmInfoT* ctlTarget, AlsaPcmInfoT* pcmSlave);
+PUBLIC AlsaPcmInfoT* AlsaCreateMulti(CtlSourceT *source, const char *pcmName);
+PUBLIC AlsaPcmInfoT* AlsaCreateStream(CtlSourceT *source, AlsaSndStreamT *stream, AlsaPcmInfoT *pcmControl);
+PUBLIC AlsaPcmInfoT* AlsaCreateRoute(CtlSourceT *source, AlsaSndZoneT *zone);
+
#endif \ No newline at end of file