First version of ALSA client/server

This commit is contained in:
Abramo Bagnara 2000-08-31 11:21:05 +00:00
parent e94033141d
commit 4637f62ff5
12 changed files with 1931 additions and 34 deletions

View file

@ -6,7 +6,7 @@ sysinclude_HEADERS = asoundlib.h
header_files=header.h version.h error.h control.h mixer.h pcm.h rawmidi.h \
timer.h hwdep.h seq.h seqmid.h conv.h instr.h conf.h footer.h
noinst_HEADERS=$(header_files) search.h
noinst_HEADERS=$(header_files) search.h list.h aserver.h
asoundlib.h: $(header_files)
cat $^ > $@

77
include/aserver.h Normal file
View file

@ -0,0 +1,77 @@
/*
* ALSA client/server header file
* Copyright (c) 2000 by Abramo Bagnara <abramo@alsa-project.org>
*
* This library is free software; you can redistribute it and/or modify
* it under the terms of the GNU Library General Public License as
* published by the Free Software Foundation; either version 2 of
* the License, or (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Library General Public License for more details.
*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
*
*/
#define SND_PCM_IOCTL_MMAP_DATA _IO ('A', 0xf0)
#define SND_PCM_IOCTL_MMAP_CONTROL _IO ('A', 0xf1)
#define SND_PCM_IOCTL_MMAP_STATUS _IO ('A', 0xf2)
#define SND_PCM_IOCTL_MUNMAP_DATA _IO ('A', 0xf3)
#define SND_PCM_IOCTL_MUNMAP_CONTROL _IO ('A', 0xf4)
#define SND_PCM_IOCTL_MUNMAP_STATUS _IO ('A', 0xf5)
#define SND_PCM_IOCTL_CLOSE _IO ('A', 0xf6)
typedef struct {
int result;
int cmd;
union {
snd_pcm_info_t info;
snd_pcm_params_t params;
snd_pcm_params_info_t params_info;
snd_pcm_setup_t setup;
snd_pcm_status_t status;
int pause;
snd_pcm_channel_info_t channel_info;
snd_pcm_channel_params_t channel_params;
snd_pcm_channel_setup_t channel_setup;
off_t frame_data;
int frame_io;
int link;
snd_xfer_t read;
snd_xfer_t write;
snd_xferv_t readv;
snd_xferv_t writev;
} u;
char data[0];
} snd_pcm_client_shm_t;
#define PCM_SHM_SIZE 65536
#define PCM_SHM_DATA_MAXLEN (PCM_SHM_SIZE - offsetof(snd_pcm_client_shm_t, data))
typedef struct {
unsigned char dev_type;
unsigned char transport_type;
unsigned char stream;
unsigned char mode;
unsigned char namelen;
char name[0];
} snd_client_open_request_t;
typedef struct {
long result;
long cookie;
} snd_client_open_answer_t;
struct cmsg_fd
{
int len; /* sizeof structure */
int level; /* SOL_SOCKET */
int type; /* SCM_RIGHTS */
int fd; /* fd to pass */
};

View file

@ -35,3 +35,13 @@
#define ATTRIBUTE_UNUSED __attribute__ ((__unused__))
#endif
#define SND_DEV_TYPE_PCM 0
#define SND_DEV_TYPE_CONTROL 1
#define SND_DEV_TYPE_RAWMIDI 2
#define SND_DEV_TYPE_TIMER 3
#define SND_DEV_TYPE_HWDEP 4
#define SND_DEV_TYPE_SEQ 5
#define SND_TRANSPORT_TYPE_SHM 0
#define SND_TRANSPORT_TYPE_TCP 1

View file

@ -98,28 +98,7 @@ static inline size_t bitset_count(bitset_t *bitset, size_t nbits)
typedef struct snd_pcm snd_pcm_t;
typedef struct snd_pcm_loopback snd_pcm_loopback_t;
typedef enum { SND_PCM_TYPE_HW, SND_PCM_TYPE_PLUG, SND_PCM_TYPE_MULTI } snd_pcm_type_t;
#if 0
typedef struct {
snd_pcm_t *handle;
snd_timestamp_t tstamp;
int result;
union {
char reserved[256];
} arg;
} snd_pcm_synchro_request_t;
typedef enum { SND_PCM_SYNCHRO_GO } snd_pcm_synchro_cmd_t;
#define snd_pcm_synchro_mode_t snd_pcm_sync_mode_t
#define SND_PCM_SYNCHRO_MODE_NORMAL SND_PCM_SYNC_MODE_NORMAL
#define SND_PCM_SYNCHRO_MODE_HARDWARE SND_PCM_SYNC_MODE_HARDWARE
#define SND_PCM_SYNCHRO_MODE_RELAXED SND_PCM_SYNC_MODE_RELAXED
int snd_pcm_synchro(snd_pcm_synchro_cmd_t cmd,
unsigned int reqs_count, snd_pcm_synchro_request_t *reqs,
snd_pcm_synchro_mode_t mode);
#endif
typedef enum { SND_PCM_TYPE_HW, SND_PCM_TYPE_PLUG, SND_PCM_TYPE_MULTI, SND_PCM_TYPE_CLIENT } snd_pcm_type_t;
int snd_pcm_open(snd_pcm_t **handle, char *name,
@ -384,6 +363,8 @@ int snd_pcm_multi_create(snd_pcm_t **handlep, size_t slaves_count,
unsigned int *binds_slave, unsigned int *binds_slave_channel,
int close_slaves);
int snd_pcm_client_create(snd_pcm_t **handlep, char *host, int port, int transport, char *name, int stream, int mode);
#ifdef __cplusplus
}
#endif