Fixed mmap wrt shm. Renamed pcm_client, control_client to shm. More error messages. Implemented asoundrc as documented.

This commit is contained in:
Abramo Bagnara 2000-10-14 10:31:34 +00:00
parent dcc88ffaa7
commit e5e1ca14d4
30 changed files with 1642 additions and 2555 deletions

View file

@ -19,17 +19,17 @@
*/
#include "../src/pcm/pcm_local.h"
#define SND_PCM_IOCTL_STATE _IO ('A', 0xf0)
#define SND_PCM_IOCTL_MMAP_DATA _IO ('A', 0xf1)
#define SND_PCM_IOCTL_MMAP_CONTROL _IO ('A', 0xf2)
#define SND_PCM_IOCTL_MMAP_STATUS _IO ('A', 0xf3)
#define SND_PCM_IOCTL_MUNMAP_DATA _IO ('A', 0xf4)
#define SND_PCM_IOCTL_MUNMAP_CONTROL _IO ('A', 0xf5)
#define SND_PCM_IOCTL_MUNMAP_STATUS _IO ('A', 0xf6)
#define SND_PCM_IOCTL_MMAP _IO ('A', 0xf1)
#define SND_PCM_IOCTL_MUNMAP _IO ('A', 0xf4)
#define SND_PCM_IOCTL_MMAP_FORWARD _IO ('A', 0xf7)
#define SND_PCM_IOCTL_AVAIL_UPDATE _IO ('A', 0xf8)
#define SND_PCM_IOCTL_ASYNC _IO ('A', 0xf9)
#define SND_PCM_IOCTL_CLOSE _IO ('A', 0xfa)
#define SND_PCM_IOCTL_MMAP_INFO _IO ('A', 0xfb)
#define SND_PCM_IOCTL_POLL_DESCRIPTOR _IO ('A', 0xfc)
typedef struct {
long result;
@ -39,6 +39,7 @@ typedef struct {
int sig;
pid_t pid;
} async;
snd_pcm_mmap_info_t mmap_info;
snd_pcm_info_t info;
snd_pcm_params_t params;
snd_pcm_params_info_t params_info;
@ -54,13 +55,13 @@ typedef struct {
size_t mmap_forward;
} u;
char data[0];
} snd_pcm_client_shm_t;
} snd_pcm_shm_ctrl_t;
#define PCM_SHM_SIZE 65536
#define PCM_SHM_DATA_MAXLEN (PCM_SHM_SIZE - offsetof(snd_pcm_client_shm_t, data))
#define PCM_SHM_SIZE sizeof(snd_pcm_shm_ctrl_t)
#define SND_CTL_IOCTL_READ _IOR('U', 0xf0, snd_ctl_event_t)
#define SND_CTL_IOCTL_CLOSE _IO ('U', 0xf1)
#define SND_CTL_IOCTL_POLL_DESCRIPTOR _IO ('U', 0xf2)
typedef struct {
int result;
@ -78,10 +79,10 @@ typedef struct {
snd_ctl_event_t read;
} u;
char data[0];
} snd_ctl_client_shm_t;
} snd_ctl_shm_ctrl_t;
#define CTL_SHM_SIZE 65536
#define CTL_SHM_DATA_MAXLEN (CTL_SHM_SIZE - offsetof(snd_ctl_client_shm_t, data))
#define CTL_SHM_DATA_MAXLEN (CTL_SHM_SIZE - offsetof(snd_ctl_shm_ctrl_t, data))
typedef struct {
unsigned char dev_type;

View file

@ -7,7 +7,10 @@
typedef struct snd_ctl snd_ctl_t;
typedef enum { SND_CTL_TYPE_HW, SND_CTL_TYPE_CLIENT } snd_ctl_type_t;
typedef enum { SND_CTL_TYPE_HW,
SND_CTL_TYPE_SHM,
SND_CTL_TYPE_INET
} snd_ctl_type_t;
typedef struct snd_ctl_callbacks {
void *private_data; /* may be used by an application */
@ -37,8 +40,8 @@ int snd_defaults_pcm_device(void);
int snd_defaults_rawmidi_card(void);
int snd_defaults_rawmidi_device(void);
int snd_ctl_hw_open(snd_ctl_t **handle, int card);
int snd_ctl_client_open(snd_ctl_t **handlep, char *host, int port, int transport, char *name);
int snd_ctl_hw_open(snd_ctl_t **handle, char *name, int card);
int snd_ctl_shm_open(snd_ctl_t **handlep, char *name, char *socket, char *sname);
snd_ctl_type_t snd_ctl_type(snd_ctl_t *handle);
int snd_ctl_open(snd_ctl_t **handle, char *name);
int snd_ctl_close(snd_ctl_t *handle);

View file

@ -104,7 +104,8 @@ typedef enum {
SND_PCM_TYPE_MULTI,
SND_PCM_TYPE_FILE,
SND_PCM_TYPE_NULL,
SND_PCM_TYPE_CLIENT,
SND_PCM_TYPE_SHM,
SND_PCM_TYPE_INET,
SND_PCM_TYPE_LINEAR,
SND_PCM_TYPE_ALAW,
SND_PCM_TYPE_MULAW,
@ -118,16 +119,16 @@ typedef enum {
SND_PCM_TYPE_LBSERVER,
} snd_pcm_type_t;
extern void (*snd_pcm_error)(const char *file, int line, const char *function, const char *fmt, ...);
extern void snd_pcm_error(const char *file, int line, const char *function, const char *fmt, ...) __attribute__ ((weak, format (printf, 4, 5)));
int snd_pcm_open(snd_pcm_t **handle, char *name,
int snd_pcm_open(snd_pcm_t **pcm, char *name,
int stream, int mode);
/* Obsolete functions */
int snd_pcm_hw_open_subdevice(snd_pcm_t **handle, int card, int device, int subdevice, int stream, int mode);
int snd_pcm_hw_open_device(snd_pcm_t **handle, int card, int device, int stream, int mode);
int snd_pcm_plug_open_subdevice(snd_pcm_t **handle, int card, int device, int subdevice, int stream, int mode);
int snd_pcm_plug_open_device(snd_pcm_t **handle, int card, int device, int stream, int mode);
int snd_pcm_hw_open_subdevice(snd_pcm_t **pcm, int card, int device, int subdevice, int stream, int mode);
int snd_pcm_hw_open_device(snd_pcm_t **pcm, int card, int device, int stream, int mode);
int snd_pcm_plug_open_subdevice(snd_pcm_t **pcm, int card, int device, int subdevice, int stream, int mode);
int snd_pcm_plug_open_device(snd_pcm_t **pcm, int card, int device, int stream, int mode);
#define snd_pcm_write snd_pcm_writei
#define snd_pcm_read snd_pcm_readi
ssize_t snd_pcm_writev(snd_pcm_t *pcm, const struct iovec *vector, int count);
@ -171,7 +172,7 @@ ssize_t snd_pcm_avail_update(snd_pcm_t *pcm);
/* mmap */
int snd_pcm_mmap(snd_pcm_t *pcm, void **buffer);
int snd_pcm_mmap(snd_pcm_t *pcm);
int snd_pcm_munmap(snd_pcm_t *pcm);
snd_pcm_channel_area_t *snd_pcm_mmap_areas(snd_pcm_t *pcm);
int snd_pcm_mmap_get_areas(snd_pcm_t *pcm, snd_pcm_channel_area_t *stopped_areas, snd_pcm_channel_area_t *running_areas);