#define SYSERROR(string) ERROR(string ": %s", strerror(errno))
-int make_local_socket(const char *filename)
+static int make_local_socket(const char *filename)
{
size_t l = strlen(filename);
size_t size = offsetof(struct sockaddr_un, sun_path) + l;
return sock;
}
-int make_inet_socket(int port)
+static int make_inet_socket(int port)
{
struct sockaddr_in addr;
int sock;
return sock;
}
-int send_fd(int socket, void *data, size_t len, int fd)
+static int send_fd(int sock, void *data, size_t len, int fd)
{
int ret;
size_t cmsg_len = CMSG_LEN(sizeof(int));
msghdr.msg_controllen = cmsg_len;
msghdr.msg_flags = 0;
- ret = sendmsg(socket, &msghdr, 0 );
+ ret = sendmsg(sock, &msghdr, 0 );
if (ret < 0) {
SYSERROR("sendmsg failed");
return -errno;
};
waiter_t *waiters;
-void add_waiter(int fd, unsigned short events, waiter_handler_t handler,
+static void add_waiter(int fd, unsigned short events, waiter_handler_t handler,
void *data)
{
waiter_t *w = &waiters[fd];
pollfds_count++;
}
-void del_waiter(int fd)
+static void del_waiter(int fd)
{
waiter_t *w = &waiters[fd];
unsigned int k;
} inet_pending_t;
LIST_HEAD(inet_pendings);
-int pcm_handler(waiter_t *waiter, unsigned short events)
+#if 0
+static int pcm_handler(waiter_t *waiter, unsigned short events)
{
client_t *client = waiter->private_data;
char buf[1];
client->polling = 0;
return 0;
}
+#endif
-int pcm_shm_open(client_t *client, int *cookie)
+static int pcm_shm_open(client_t *client, int *cookie)
{
int shmid;
snd_pcm_t *pcm;
}
-int pcm_shm_close(client_t *client)
+static int pcm_shm_close(client_t *client)
{
int err;
snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
return 0;
}
-int shm_ack(client_t *client)
+static int shm_ack(client_t *client)
{
struct pollfd pfd;
int err;
return 0;
}
-int shm_ack_fd(client_t *client, int fd)
+static int shm_ack_fd(client_t *client, int fd)
{
struct pollfd pfd;
int err;
return 0;
}
-int pcm_shm_cmd(client_t *client)
+static int pcm_shm_cmd(client_t *client)
{
volatile snd_pcm_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
char buf[1];
close: pcm_shm_close,
};
-int ctl_handler(waiter_t *waiter, unsigned short events)
+static int ctl_handler(waiter_t *waiter, unsigned short events)
{
client_t *client = waiter->private_data;
char buf[1];
return 0;
}
-int ctl_shm_open(client_t *client, int *cookie)
+static int ctl_shm_open(client_t *client, int *cookie)
{
int shmid;
snd_ctl_t *ctl;
}
-int ctl_shm_close(client_t *client)
+static int ctl_shm_close(client_t *client)
{
int err;
snd_ctl_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
return 0;
}
-int ctl_shm_cmd(client_t *client)
+static int ctl_shm_cmd(client_t *client)
{
snd_ctl_shm_ctrl_t *ctrl = client->transport.shm.ctrl;
char buf[1];
close: ctl_shm_close,
};
-int snd_client_open(client_t *client)
+static int snd_client_open(client_t *client)
{
int err;
snd_client_open_request_t req;
return 0;
}
-int client_poll_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
+static int client_poll_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
{
client_t *client = waiter->private_data;
if (client->open)
return 0;
}
-int client_ctrl_handler(waiter_t *waiter, unsigned short events)
+static int client_ctrl_handler(waiter_t *waiter, unsigned short events)
{
client_t *client = waiter->private_data;
if (events & POLLHUP) {
return snd_client_open(client);
}
-int inet_pending_handler(waiter_t *waiter, unsigned short events)
+static int inet_pending_handler(waiter_t *waiter, unsigned short events)
{
inet_pending_t *pending = waiter->private_data;
inet_pending_t *pdata;
return 0;
}
-int local_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
+static int local_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
{
int sock;
sock = accept(waiter->fd, 0, 0);
return 0;
}
-int inet_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
+static int inet_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
{
int sock;
sock = accept(waiter->fd, 0, 0);
return 0;
}
-int server(const char *sockname, int port)
+static int server(const char *sockname, int port)
{
int err;
unsigned int k;
SYSERROR("sysconf failed");
return result;
}
- pollfds = calloc(open_max, sizeof(*pollfds));
- waiters = calloc(open_max, sizeof(*waiters));
+ pollfds = calloc((size_t) open_max, sizeof(*pollfds));
+ waiters = calloc((size_t) open_max, sizeof(*waiters));
if (sockname) {
int sock = make_local_socket(sockname);
}
-void usage()
+static void usage(void)
{
fprintf(stderr, "\
Usage: %s [OPTIONS] server
", command);
}
-extern int is_local(struct hostent *hent);
-
int main(int argc, char **argv)
{
static struct option long_options[] = {
int c;
snd_config_t *conf;
snd_config_iterator_t i, next;
- const char *socket = NULL;
+ const char *sockname = NULL;
const char *host = NULL;
long port = -1;
int err;
continue;
}
if (strcmp(id, "socket") == 0) {
- err = snd_config_get_string(n, &socket);
+ err = snd_config_get_string(n, &sockname);
if (err < 0) {
ERROR("Invalid type for %s", id);
return 1;
ERROR("%s is not the local host", host);
return 1;
}
- if (!socket && port < 0) {
+ if (!sockname && port < 0) {
ERROR("either socket or port need to be defined");
return 1;
}
- server(socket, port);
+ server(sockname, port);
return 0;
}
*
*/
+#include <netdb.h>
#include "../src/pcm/pcm_local.h"
#include "../src/control/control_local.h"
+int receive_fd(int sock, void *data, size_t len, int *fd);
+int is_local(struct hostent *hent);
+
typedef enum _snd_dev_type {
SND_DEV_TYPE_PCM,
SND_DEV_TYPE_CONTROL,
extern "C" {
#endif
-snd_config_type_t snd_config_get_type(snd_config_t *config);
-const char *snd_config_get_id(snd_config_t *config);
-
int snd_config_top(snd_config_t **config);
int snd_config_load(snd_config_t *config, snd_input_t *in);
const char *snd_config_get_id(snd_config_t *config);
extern snd_config_t *snd_config;
-int snd_config_update();
+int snd_config_update(void);
#ifdef __cplusplus
}
int snd_defaults_rawmidi_card(void);
int snd_defaults_rawmidi_device(void);
-snd_ctl_type_t snd_ctl_type(snd_ctl_t *ctl);
int snd_ctl_open(snd_ctl_t **ctl, const char *name, int mode);
int snd_ctl_close(snd_ctl_t *ctl);
int snd_ctl_nonblock(snd_ctl_t *ctl, int nonblock);
*/
typedef int (*snd_hctl_compare_t)(const snd_hctl_elem_t *e1,
const snd_hctl_elem_t *e2);
+int snd_hctl_compare_fast(const snd_hctl_elem_t *c1,
+ const snd_hctl_elem_t *c2);
/**
* \brief HCTL callback function
* \param hctl HCTL handle
extern "C" {
#endif
-size_t snd_ctl_elem_id_sizeof();
+size_t snd_ctl_elem_id_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ctl_elem_id_t using standard alloca
* \param ptr returned pointer
void snd_ctl_elem_id_set_index(snd_ctl_elem_id_t *obj, unsigned int val);
-size_t snd_ctl_card_info_sizeof();
+size_t snd_ctl_card_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ctl_card_info_t using standard alloca
* \param ptr returned pointer
const char *snd_ctl_card_info_get_mixername(const snd_ctl_card_info_t *obj);
-size_t snd_ctl_event_sizeof();
+size_t snd_ctl_event_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ctl_event_t using standard alloca
* \param ptr returned pointer
snd_ctl_event_type_t snd_ctl_event_get_type(const snd_ctl_event_t *obj);
-size_t snd_ctl_elem_list_sizeof();
+size_t snd_ctl_elem_list_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ctl_elem_list_t using standard alloca
* \param ptr returned pointer
unsigned int snd_ctl_elem_list_get_index(const snd_ctl_elem_list_t *obj, unsigned int idx);
-size_t snd_ctl_elem_info_sizeof();
+size_t snd_ctl_elem_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ctl_elem_info_t using standard alloca
* \param ptr returned pointer
void snd_ctl_elem_info_set_index(snd_ctl_elem_info_t *obj, unsigned int val);
-size_t snd_ctl_elem_value_sizeof();
+size_t snd_ctl_elem_value_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_ctl_elem_value_t using standard alloca
* \param ptr returned pointer
int snd_hwdep_poll_descriptors(snd_hwdep_t *hwdep, struct pollfd *pfds, unsigned int space);
int snd_hwdep_block_mode(snd_hwdep_t *hwdep, int enable);
int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t * info);
-int snd_hwdep_ioctl(snd_hwdep_t *hwdep, int request, void * arg);
+int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg);
ssize_t snd_hwdep_write(snd_hwdep_t *hwdep, const void *buffer, size_t size);
ssize_t snd_hwdep_read(snd_hwdep_t *hwdep, void *buffer, size_t size);
extern "C" {
#endif
-size_t snd_hwdep_info_sizeof();
+size_t snd_hwdep_info_sizeof(void);
#define snd_hwdep_info_alloca(ptr) do { assert(ptr); *ptr = (snd_hwdep_info_t *) alloca(snd_hwdep_info_sizeof()); memset(*ptr, 0, snd_hwdep_info_sizeof()); } while (0)
int snd_hwdep_info_malloc(snd_hwdep_info_t **ptr);
void snd_hwdep_info_free(snd_hwdep_info_t *obj);
#endif
int snd_input_stdio_open(snd_input_t **inputp, const char *file, const char *mode);
-int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int close);
+int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close);
int snd_input_buffer_open(snd_input_t **inputp, const char *buffer, int size);
int snd_input_close(snd_input_t *input);
int snd_input_scanf(snd_input_t *input, const char *format, ...) __attribute__ ((format (scanf, 2, 3)));
char *snd_input_gets(snd_input_t *input, char *str, size_t size);
int snd_input_getc(snd_input_t *input);
+int snd_input_ungetc(snd_input_t *input, int c);
#ifdef __cplusplus
}
int snd_mixer_poll_descriptors_count(snd_mixer_t *mixer);
int snd_mixer_poll_descriptors(snd_mixer_t *mixer, struct pollfd *pfds, unsigned int space);
int snd_mixer_load(snd_mixer_t *mixer);
+void snd_mixer_free(snd_mixer_t *mixer);
int snd_mixer_wait(snd_mixer_t *mixer, int timeout);
int snd_mixer_set_compare(snd_mixer_t *mixer, snd_mixer_compare_t msort);
extern "C" {
#endif
-size_t snd_mixer_selem_id_sizeof();
+size_t snd_mixer_selem_id_sizeof(void);
#define snd_mixer_selem_id_alloca(ptr) do { assert(ptr); *ptr = (snd_mixer_selem_id_t *) alloca(snd_mixer_selem_id_sizeof()); memset(*ptr, 0, snd_mixer_selem_id_sizeof()); } while (0)
int snd_mixer_selem_id_malloc(snd_mixer_selem_id_t **ptr);
void snd_mixer_selem_id_free(snd_mixer_selem_id_t *obj);
extern "C" {
#endif
-int snd_output_stdio_open(snd_output_t **outputp, const char *file, const char *open);
-int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int close);
+int snd_output_stdio_open(snd_output_t **outputp, const char *file, const char *mode);
+int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close);
int snd_output_buffer_open(snd_output_t **outputp);
size_t snd_output_buffer_string(snd_output_t *output, char **buf);
int snd_output_close(snd_output_t *output);
int snd_pcm_open(snd_pcm_t **pcm, const char *name,
snd_pcm_stream_t stream, int mode);
-snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);
int snd_pcm_close(snd_pcm_t *pcm);
int snd_pcm_poll_descriptors_count(snd_pcm_t *pcm);
int snd_pcm_poll_descriptors(snd_pcm_t *pcm, struct pollfd *pfds, unsigned int space);
snd_pcm_sframes_t snd_pcm_avail_update(snd_pcm_t *pcm);
const char *snd_pcm_name(snd_pcm_t *pcm);
snd_pcm_type_t snd_pcm_type(snd_pcm_t *pcm);
+snd_pcm_stream_t snd_pcm_stream(snd_pcm_t *pcm);
/* HW params */
int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params);
snd_pcm_sframes_t snd_pcm_mmap_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size);
const char *snd_pcm_stream_name(snd_pcm_stream_t stream);
-const char *snd_pcm_access_name(snd_pcm_access_t access);
+const char *snd_pcm_access_name(snd_pcm_access_t _access);
const char *snd_pcm_format_name(snd_pcm_format_t format);
-const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat);
const char *snd_pcm_format_description(snd_pcm_format_t format);
+const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat);
+const char *snd_pcm_subformat_description(snd_pcm_subformat_t subformat);
snd_pcm_format_t snd_pcm_format_value(const char* name);
const char *snd_pcm_start_mode_name(snd_pcm_start_t mode);
const char *snd_pcm_xrun_mode_name(snd_pcm_xrun_t mode);
-size_t snd_pcm_access_mask_sizeof();
+size_t snd_pcm_access_mask_sizeof(void);
/** \hideinitializer
* \brief allocate an empty #snd_pcm_access_mask_t using standard alloca
void snd_pcm_access_mask_set(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
void snd_pcm_access_mask_reset(snd_pcm_access_mask_t *mask, snd_pcm_access_t val);
-size_t snd_pcm_format_mask_sizeof();
+size_t snd_pcm_format_mask_sizeof(void);
/** \hideinitializer
* \brief allocate an empty #snd_pcm_format_mask_t using standard alloca
* \param ptr returned pointer
void snd_pcm_format_mask_set(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
void snd_pcm_format_mask_reset(snd_pcm_format_mask_t *mask, snd_pcm_format_t val);
-size_t snd_pcm_subformat_mask_sizeof();
+size_t snd_pcm_subformat_mask_sizeof(void);
/** \hideinitializer
* \brief allocate an empty #snd_pcm_subformat_mask_t using standard alloca
* \param ptr returned pointer
void snd_pcm_subformat_mask_set(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
void snd_pcm_subformat_mask_reset(snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val);
-size_t snd_pcm_hw_params_sizeof();
+size_t snd_pcm_hw_params_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_pcm_hw_params_t using standard alloca
* \param ptr returned pointer
unsigned int snd_pcm_hw_params_set_tick_time_first(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
unsigned int snd_pcm_hw_params_set_tick_time_last(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, int *dir);
-size_t snd_pcm_sw_params_sizeof();
+size_t snd_pcm_sw_params_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_pcm_sw_params_t using standard alloca
* \param ptr returned pointer
int snd_pcm_sw_params_set_silence_size(snd_pcm_t *pcm, snd_pcm_sw_params_t *params, snd_pcm_uframes_t val);
snd_pcm_uframes_t snd_pcm_sw_params_get_silence_size(const snd_pcm_sw_params_t *params);
-size_t snd_pcm_status_sizeof();
+size_t snd_pcm_status_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_pcm_status_t using standard alloca
* \param ptr returned pointer
snd_pcm_uframes_t snd_pcm_status_get_avail_max(const snd_pcm_status_t *obj);
-size_t snd_pcm_info_sizeof();
+size_t snd_pcm_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_pcm_info_t using standard alloca
* \param ptr returned pointer
int snd_rawmidi_poll_descriptors_count(snd_rawmidi_t *rmidi);
int snd_rawmidi_poll_descriptors(snd_rawmidi_t *rmidi, struct pollfd *pfds, unsigned int space);
int snd_rawmidi_nonblock(snd_rawmidi_t *rmidi, int nonblock);
-size_t snd_rawmidi_info_sizeof();
+size_t snd_rawmidi_info_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_rawmidi_info_t using standard alloca
* \param ptr returned pointer
void snd_rawmidi_info_set_subdevice(snd_rawmidi_info_t *obj, unsigned int val);
void snd_rawmidi_info_set_stream(snd_rawmidi_info_t *obj, snd_rawmidi_stream_t val);
int snd_rawmidi_info(snd_rawmidi_t *rmidi, snd_rawmidi_info_t * info);
-size_t snd_rawmidi_params_sizeof();
+size_t snd_rawmidi_params_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_rawmidi_params_t using standard alloca
* \param ptr returned pointer
int snd_rawmidi_params_get_no_active_sensing(const snd_rawmidi_params_t *params);
int snd_rawmidi_params(snd_rawmidi_t *rmidi, snd_rawmidi_params_t * params);
int snd_rawmidi_params_current(snd_rawmidi_t *rmidi, snd_rawmidi_params_t *params);
-size_t snd_rawmidi_status_sizeof();
+size_t snd_rawmidi_status_sizeof(void);
/** \hideinitializer
* \brief allocate an invalid #snd_rawmidi_status_t using standard alloca
* \param ptr returned pointer
void snd_rawmidi_status_get_tstamp(const snd_rawmidi_status_t *obj, snd_timestamp_t *ptr);
size_t snd_rawmidi_status_get_avail(const snd_rawmidi_status_t *obj);
size_t snd_rawmidi_status_get_avail_max(const snd_rawmidi_status_t *obj);
+size_t snd_rawmidi_status_get_xruns(const snd_rawmidi_status_t *obj);
int snd_rawmidi_status(snd_rawmidi_t *rmidi, snd_rawmidi_status_t * status);
int snd_rawmidi_drain(snd_rawmidi_t *rmidi);
int snd_rawmidi_drop(snd_rawmidi_t *rmidi);
ssize_t snd_rawmidi_read(snd_rawmidi_t *rmidi, void *buffer, size_t size);
const char *snd_rawmidi_name(snd_rawmidi_t *rmidi);
snd_rawmidi_type_t snd_rawmidi_type(snd_rawmidi_t *rmidi);
+snd_rawmidi_stream_t snd_rawmidi_stream(snd_rawmidi_t *rawmidi);
#ifdef __cplusplus
}
int snd_seq_set_sync_slave(snd_seq_t *seq, int queue, snd_seq_addr_t *src, snd_seq_queue_sync_t *info);
int snd_seq_reset_sync_slave(snd_seq_t *seq, int queue, snd_seq_addr_t *src);
+#endif
+
const char *snd_seq_name(snd_seq_t *seq);
snd_seq_type_t snd_seq_type(snd_seq_t *seq);
-#endif
-
/* event routines */
snd_seq_event_t *snd_seq_create_event(void);
int snd_seq_free_event(snd_seq_event_t *ev);
ssize_t snd_seq_event_length(snd_seq_event_t *ev);
int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
-int snd_seq_event_output(snd_seq_t *handle, snd_seq_event_t *ev);
int snd_seq_event_output_buffer(snd_seq_t *handle, snd_seq_event_t *ev);
int snd_seq_event_output_direct(snd_seq_t *handle, snd_seq_event_t *ev);
int snd_seq_event_input(snd_seq_t *handle, snd_seq_event_t **ev);
extern "C" {
#endif
-int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev);
-int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize);
+int snd_midi_event_new(size_t bufsize, snd_midi_event_t **rdev);
+int snd_midi_event_resize_buffer(snd_midi_event_t *dev, size_t bufsize);
void snd_midi_event_free(snd_midi_event_t *dev);
void snd_midi_event_init(snd_midi_event_t *dev);
void snd_midi_event_reset_encode(snd_midi_event_t *dev);
snd_seq_tick_time_t tick);
/* scheduled on real-time-queue */
void snd_seq_ev_schedule_real(snd_seq_event_t *ev, int q, int relative,
- snd_seq_real_time_t *time);
+ snd_seq_real_time_t *_time);
/* set event priority (optional) */
void snd_seq_ev_set_priority(snd_seq_event_t *ev, int high_prior);
} else {
if (strlen(n->id) != (size_t) len)
continue;
- if (memcmp(n->id, id, len) == 0) {
+ if (memcmp(n->id, id, (size_t) len) == 0) {
*result = n;
return 0;
}
return 0;
}
-void string_print(char *str, int id, snd_output_t *out)
+static void string_print(char *str, int id, snd_output_t *out)
{
unsigned char *p = str;
if (!id) {
fd = input.current;
if (err < 0) {
if (input.error < 0) {
- char *str;
+ const char *str;
switch (input.error) {
case UNTERMINATED_STRING:
str = "Unterminated string";
int err;
snd_config_t *ctl_conf, *conf, *type_conf;
snd_config_iterator_t i, next;
- const char *lib = NULL, *open = NULL;
- int (*open_func)(snd_ctl_t **ctlp, const char *name, snd_config_t *conf, int mode);
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_ctl_t **, const char *, snd_config_t *, int);
void *h;
const char *name1;
assert(ctlp && name);
continue;
}
if (strcmp(id, "open") == 0) {
- err = snd_config_get_string(n, &open);
+ err = snd_config_get_string(n, &open_name);
if (err < 0)
return -EINVAL;
continue;
}
}
if (!open) {
- open = buf;
+ open_name = buf;
snprintf(buf, sizeof(buf), "_snd_ctl_%s_open", str);
}
if (!lib)
SNDERR("Cannot open shared library %s", lib);
return -ENOENT;
}
- open_func = dlsym(h, open);
+ open_func = dlsym(h, open_name);
if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open, lib);
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
dlclose(h);
return -ENXIO;
}
int _snd_ctl_poll_descriptor(snd_ctl_t *ctl);
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card, int mode);
-int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket, const char *sname, int mode);
+int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname, const char *sname, int mode);
volatile snd_ctl_shm_ctrl_t *ctrl;
} snd_ctl_shm_t;
-extern int receive_fd(int socket, void *data, size_t len, int *fd);
-
static int snd_ctl_shm_action(snd_ctl_t *ctl)
{
snd_ctl_shm_t *shm = ctl->private_data;
}
#endif
-int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket, const char *sname, int mode)
+int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *sockname, const char *sname, int mode)
{
snd_ctl_t *ctl;
snd_ctl_shm_t *shm = NULL;
if (snamelen > 255)
return -EINVAL;
- result = make_local_socket(socket);
+ result = make_local_socket(sockname);
if (result < 0) {
- SNDERR("server for socket %s is not running", socket);
+ SNDERR("server for socket %s is not running", sockname);
goto _err;
}
sock = result;
goto _err;
}
shm = calloc(1, sizeof(snd_ctl_shm_t));
- if (!ctl) {
+ if (!shm) {
free(ctl);
result = -ENOMEM;
goto _err;
return result;
}
-extern int is_local(struct hostent *hent);
-
int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int mode)
{
snd_config_iterator_t i, next;
const char *sname = NULL;
snd_config_t *sconfig;
const char *host = NULL;
- const char *socket = NULL;
+ const char *sockname = NULL;
long port = -1;
int err;
int local;
continue;
}
if (strcmp(id, "socket") == 0) {
- err = snd_config_get_string(n, &socket);
+ err = snd_config_get_string(n, &sockname);
if (err < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
SNDERR("host is not defined");
return -EINVAL;
}
- if (!socket) {
+ if (!sockname) {
SNDERR("socket is not defined");
return -EINVAL;
}
SNDERR("%s is not the local host", host);
return -EINVAL;
}
- return snd_ctl_shm_open(handlep, name, socket, sname, mode);
+ return snd_ctl_shm_open(handlep, name, sockname, sname, mode);
}
return 0;
}
-static int snd_hctl_compare_mixer_priority_lookup(char **name, char * const *names, int coef)
+static int snd_hctl_compare_mixer_priority_lookup(const char **name, const char * const *names, int coef)
{
int res;
static int get_compare_weight(const char *name)
{
- static char *names[] = {
+ static const char *names[] = {
"Master",
"Hardware Master",
"Headphone",
"IEC958",
NULL
};
- static char *names1[] = {
+ static const char *names1[] = {
"Switch",
"Volume",
"Playback",
"-",
NULL
};
- static char *names2[] = {
+ static const char *names2[] = {
"Switch",
"Volume",
"Bypass",
};
int res, res1;
- if ((res = snd_hctl_compare_mixer_priority_lookup((char **)&name, names, 1000000)) == NOT_FOUND)
+ if ((res = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names, 1000000)) == NOT_FOUND)
return NOT_FOUND;
- if ((res1 = snd_hctl_compare_mixer_priority_lookup((char **)&name, names1, 1000)) == NOT_FOUND)
+ if ((res1 = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names1, 1000)) == NOT_FOUND)
return res;
res += res1;
- if ((res1 = snd_hctl_compare_mixer_priority_lookup((char **)&name, names2, 1)) == NOT_FOUND)
+ if ((res1 = snd_hctl_compare_mixer_priority_lookup((const char **)&name, names2, 1)) == NOT_FOUND)
return res;
return res + res1;
}
{
unsigned int k;
int compar(const void *a, const void *b) {
- return hctl->compare(*(const snd_hctl_elem_t **) a,
- *(const snd_hctl_elem_t **) b);
+ return hctl->compare(*(const snd_hctl_elem_t * const *) a,
+ *(const snd_hctl_elem_t * const *) b);
}
assert(hctl);
assert(hctl->compare);
assert(res >= 0 && dir == 0);
if (res < 0 || dir != 0)
return -ENOENT;
- snd_hctl_elem_remove(hctl, res);
+ snd_hctl_elem_remove(hctl, (unsigned int) res);
return 0;
}
if (event->data.elem.mask & SNDRV_CTL_EVENT_MASK_ADD) {
return 0;
}
-int snd_hwdep_ioctl(snd_hwdep_t *hwdep, int request, void * arg)
+int snd_hwdep_ioctl(snd_hwdep_t *hwdep, unsigned int request, void * arg)
{
assert(hwdep);
if (ioctl(hwdep->fd, request, arg) < 0)
static int snd_input_stdio_scanf(snd_input_t *input, const char *format, va_list args)
{
snd_input_stdio_t *stdio = input->private_data;
- extern int vfscanf(FILE *fp, const char *format, va_list args);
+ extern int vfscanf(FILE *, const char *, va_list);
return vfscanf(stdio->fp, format, args);
}
static char *snd_input_stdio_gets(snd_input_t *input, char *str, size_t size)
{
snd_input_stdio_t *stdio = input->private_data;
- return fgets(str, size, stdio->fp);
+ return fgets(str, (int) size, stdio->fp);
}
static int snd_input_stdio_getc(snd_input_t *input)
* \param close Close flag (1 if FILE is fclose'd when input handle is closed)
* \return 0 on success otherwise a negative error code
*/
-int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int close)
+int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int _close)
{
snd_input_t *input;
snd_input_stdio_t *stdio;
return -ENOMEM;
}
stdio->fp = fp;
- stdio->close = close;
+ stdio->close = _close;
input->type = SND_INPUT_STDIO;
input->ops = &snd_input_stdio_ops;
input->private_data = stdio;
static int snd_input_buffer_scanf(snd_input_t *input, const char *format, va_list args)
{
snd_input_buffer_t *buffer = input->private_data;
- extern int vsscanf(const char *buf, const char *format, va_list args);
+ extern int vsscanf(const char *, const char *, va_list);
/* FIXME: how can I obtain consumed chars count? */
assert(0);
return vsscanf(buffer->ptr, format, args);
* \param size Buffer size
* \return 0 on success otherwise a negative error code
*/
-int snd_input_buffer_open(snd_input_t **inputp, const char *buf, int size)
+int snd_input_buffer_open(snd_input_t **inputp, const char *buf, ssize_t size)
{
snd_input_t *input;
snd_input_buffer_t *buffer;
}
if (size < 0)
size = strlen(buf);
- buffer->buf = malloc(size+1);
+ buffer->buf = malloc((size_t)size + 1);
if (!buffer->buf) {
free(input);
free(buffer);
return -ENOMEM;
}
- memcpy(buffer->buf, buf, size);
+ memcpy(buffer->buf, buf, (size_t) size);
buffer->buf[size] = 0;
buffer->ptr = buffer->buf;
buffer->size = size;
struct header ffff;
snd_iwffff_handle_t *iwf;
iwffff_rom_header_t header;
- int fd, index;
+ int fd, idx;
if (handle == NULL)
return -EINVAL;
*handle = NULL;
- index = 0;
+ idx = 0;
if (bank > 4 || file > 255)
return -1;
fd = iwffff_get_rom_header(card, bank, &header);
break;
ffff.length = snd_LE_to_host_32(ffff.length);
next_ffff = lseek(fd, 0, SEEK_CUR) + ffff.length;
- if (file == index) {
+ if (file == idx) {
#ifdef IW_ROM_DEBUG
SNDERR("file header at 0x%x size 0x%x\n", rom_pos - sizeof(ffff), ffff.length);
#endif
*handle = iwf;
return 0;
}
- index++;
+ idx++;
lseek(fd, SEEK_CUR, next_ffff);
}
close(fd);
return -ENOENT;
}
-int snd_mixer_throw_event(snd_mixer_t *mixer, unsigned int mask,
+static int snd_mixer_throw_event(snd_mixer_t *mixer, unsigned int mask,
snd_mixer_elem_t *elem)
{
mixer->events++;
{
unsigned int k;
int compar(const void *a, const void *b) {
- return mixer->compare(*(const snd_mixer_elem_t **) a,
- *(const snd_mixer_elem_t **) b);
+ return mixer->compare(*(const snd_mixer_elem_t * const *) a,
+ *(const snd_mixer_elem_t * const *) b);
}
assert(mixer);
assert(mixer->compare);
pfds = malloc(count * sizeof(*pfds));
if (!pfds)
return -ENOMEM;
- err = snd_mixer_poll_descriptors(mixer, pfds, count);
+ err = snd_mixer_poll_descriptors(mixer, pfds,
+ (unsigned int) count);
assert(err == count);
}
- err = poll(pfds, count, timeout);
+ err = poll(pfds, (unsigned int) count, timeout);
if (err < 0)
return -errno;
return 0;
int bag_add(bag_t *bag, void *ptr);
int bag_del(bag_t *bag, void *ptr);
int bag_empty(bag_t *bag);
+void bag_del_all(bag_t *bag);
typedef struct list_head *bag_iterator_t;
return lname;
}
-static int get_compare_weight(const char *name, int index)
+static int get_compare_weight(const char *name, unsigned int idx)
{
- static char *names[] = {
+ static const char *names[] = {
"Master",
"Master Mono",
"Master Digital",
for (res = 0; names[res] != NULL; res++)
if (!strcmp(name, names[res]))
return MIXER_COMPARE_WEIGHT_SIMPLE_BASE +
- (res * 1000) + index;
+ (res * 1000) + idx;
return MIXER_COMPARE_WEIGHT_NOT_FOUND;
}
return 0;
}
-int simple_add1(snd_mixer_class_t *class, const char *name,
- snd_hctl_elem_t *helem, selem_ctl_type_t type,
- int value)
+static int simple_add1(snd_mixer_class_t *class, const char *name,
+ snd_hctl_elem_t *helem, selem_ctl_type_t type,
+ unsigned int value)
{
snd_mixer_elem_t *melem;
snd_mixer_selem_id_t id;
return err;
}
-int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem)
+static int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem)
{
const char *name = snd_hctl_elem_get_name(helem);
size_t len;
}
}
-int simple_event_remove(snd_hctl_elem_t *helem,
- snd_mixer_elem_t *melem)
+static int simple_event_remove(snd_hctl_elem_t *helem,
+ snd_mixer_elem_t *melem)
{
selem_t *simple = melem->private_data;
int err;
return snd_mixer_elem_info(melem);
}
-int simple_event_info(snd_mixer_elem_t *melem)
+static int simple_event_info(snd_mixer_elem_t *melem)
{
int err = simple_update(melem);
assert(err >= 0);
return snd_mixer_elem_info(melem);
}
-int simple_event(snd_mixer_class_t *class, unsigned int mask,
- snd_hctl_elem_t *helem, snd_mixer_elem_t *melem)
+static int simple_event(snd_mixer_class_t *class, unsigned int mask,
+ snd_hctl_elem_t *helem, snd_mixer_elem_t *melem)
{
int err;
if (mask == SND_CTL_EVENT_MASK_REMOVE)
return 0;
}
-int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value)
+static int _snd_mixer_selem_set_volume(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, long value)
{
selem_t *s = elem->private_data;
assert((unsigned int) channel < s->str[dir].channels);
return 0;
}
-int _snd_mixer_selem_set_volume_all(snd_mixer_elem_t *elem, int dir, long value)
+static int _snd_mixer_selem_set_volume_all(snd_mixer_elem_t *elem, int dir, long value)
{
int changed = 0;
snd_mixer_selem_channel_id_t channel;
return 0;
}
-int _snd_mixer_selem_set_switch(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int value)
+static int _snd_mixer_selem_set_switch(snd_mixer_elem_t *elem, int dir, snd_mixer_selem_channel_id_t channel, int value)
{
selem_t *s = elem->private_data;
assert((unsigned int) channel < s->str[dir].channels);
return 0;
}
-int _snd_mixer_selem_set_switch_all(snd_mixer_elem_t *elem, int dir, int value)
+static int _snd_mixer_selem_set_switch_all(snd_mixer_elem_t *elem, int dir, int value)
{
selem_t *s = elem->private_data;
if (value) {
const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel)
{
- static char *array[snd_enum_to_int(SND_MIXER_SCHN_LAST) + 1] = {
+ static const char *array[snd_enum_to_int(SND_MIXER_SCHN_LAST) + 1] = {
[SND_MIXER_SCHN_FRONT_LEFT] = "Front Left",
[SND_MIXER_SCHN_FRONT_RIGHT] = "Front Right",
[SND_MIXER_SCHN_FRONT_CENTER] = "Front Center",
[SND_MIXER_SCHN_REAR_RIGHT] = "Rear Right",
[SND_MIXER_SCHN_WOOFER] = "Woofer"
};
- char *p;
+ const char *p;
assert(channel <= SND_MIXER_SCHN_LAST);
p = array[snd_enum_to_int(channel)];
if (!p)
* \param close Close flag (1 if FILE is fclose'd when output handle is closed)
* \return 0 on success otherwise a negative error code
*/
-int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int close)
+int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int _close)
{
snd_output_t *output;
snd_output_stdio_t *stdio;
return -ENOMEM;
}
stdio->fp = fp;
- stdio->close = close;
+ stdio->close = _close;
output->type = SND_OUTPUT_STDIO;
output->ops = &snd_output_stdio_ops;
output->private_data = stdio;
static int snd_output_buffer_need(snd_output_t *output, size_t size)
{
snd_output_buffer_t *buffer = output->private_data;
- size_t free = buffer->alloc - buffer->size;
+ size_t _free = buffer->alloc - buffer->size;
size_t alloc;
- if (free >= size)
- return free;
+ if (_free >= size)
+ return _free;
if (buffer->alloc == 0)
alloc = 256;
else
#include <limits.h>
#include "pcm_local.h"
-static inline void div64_32(u_int64_t *n, u_int32_t div, u_int32_t *rem)
+static inline void div64_32(u_int64_t *n, u_int32_t d, u_int32_t *rem)
{
- *rem = *n % div;
- *n /= div;
+ *rem = *n % d;
+ *n /= d;
}
static inline unsigned int div32(unsigned int a, unsigned int b,
i->openmax ? ')' : ']');
}
-void boundary_abs(int a, int adir, int *b, int *bdir)
+#if 0
+static void boundary_abs(int a, int adir, int *b, int *bdir)
{
if (a < 0 || (a == 0 && adir < 0)) {
*b = -a;
*bdir = adir;
}
}
+#endif
void boundary_sub(int a, int adir, int b, int bdir, int *c, int *cdir)
{
*
*/
-#ifdef SND_INTERVAL_C
-#define INTERVAL_INLINE inline
-#else
-#define INTERVAL_INLINE extern inline
-#endif
+#define INTERVAL_INLINE static inline
INTERVAL_INLINE void snd_interval_any(snd_interval_t *i)
{
#include <sys/types.h>
-#ifdef SND_MASK_C
-#define MASK_INLINE inline
-#else
-#define MASK_INLINE extern inline
-#endif
+#define MASK_INLINE static inline
#ifndef MASK_MASK
#define MASK_MAX 31
* \param access PCM access type
* \return ascii name of PCM access type
*/
-const char *snd_pcm_access_name(snd_pcm_access_t access)
+const char *snd_pcm_access_name(snd_pcm_access_t acc)
{
- assert(access <= SND_PCM_ACCESS_LAST);
- return snd_pcm_access_names[snd_enum_to_int(access)];
+ assert(acc <= SND_PCM_ACCESS_LAST);
+ return snd_pcm_access_names[snd_enum_to_int(acc)];
}
/**
int err;
snd_config_t *pcm_conf, *conf, *type_conf = NULL;
snd_config_iterator_t i, next;
- const char *lib = NULL, *open = NULL;
- int (*open_func)(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
- snd_pcm_stream_t stream, int mode);
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_pcm_t **, const char *, snd_config_t *,
+ snd_pcm_stream_t, int);
void *h;
const char *name1;
assert(pcmp && name);
continue;
}
if (strcmp(id, "open") == 0) {
- err = snd_config_get_string(n, &open);
+ err = snd_config_get_string(n, &open_name);
if (err < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
return -EINVAL;
}
}
- if (!open) {
- open = buf;
+ if (!open_name) {
+ open_name = buf;
snprintf(buf, sizeof(buf), "_snd_pcm_%s_open", str);
}
if (!lib)
SNDERR("Cannot open shared library %s", lib);
return -ENOENT;
}
- open_func = dlsym(h, open);
+ open_func = dlsym(h, open_name);
if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open, lib);
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
dlclose(h);
return -ENXIO;
}
}
case 16: {
while (samples-- > 0) {
- *(u_int16_t*)dst = *(u_int16_t*)src;
+ *(u_int16_t*)dst = *(const u_int16_t*)src;
src += src_step;
dst += dst_step;
}
}
case 32: {
while (samples-- > 0) {
- *(u_int32_t*)dst = *(u_int32_t*)src;
+ *(u_int32_t*)dst = *(const u_int32_t*)src;
src += src_step;
dst += dst_step;
}
}
case 64: {
while (samples-- > 0) {
- *(u_int64_t*)dst = *(u_int64_t*)src;
+ *(u_int64_t*)dst = *(const u_int64_t*)src;
src += src_step;
dst += dst_step;
}
*/
int snd_pcm_access_mask_test(const snd_pcm_access_mask_t *mask, snd_pcm_access_t val)
{
- return snd_mask_test((snd_mask_t *) mask, (unsigned long) val);
+ return snd_mask_test((const snd_mask_t *) mask, (unsigned long) val);
}
/**
*/
int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t val)
{
- return snd_mask_test((snd_mask_t *) mask, (unsigned long) val);
+ return snd_mask_test((const snd_mask_t *) mask, (unsigned long) val);
}
/**
*/
int snd_pcm_subformat_mask_test(const snd_pcm_subformat_mask_t *mask, snd_pcm_subformat_t val)
{
- return snd_mask_test((snd_mask_t *) mask, (unsigned long) val);
+ return snd_mask_test((const snd_mask_t *) mask, (unsigned long) val);
}
/**
*/
int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val)
{
- return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_FORMAT, snd_enum_to_int(val), 0);
+ return snd_pcm_hw_param_set(pcm, params, SND_TEST, SND_PCM_HW_PARAM_FORMAT, val, 0);
}
/**
*/
int snd_pcm_hw_params_set_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, snd_pcm_format_t val)
{
- return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, snd_enum_to_int(val), 0);
+ return snd_pcm_hw_param_set(pcm, params, SND_TRY, SND_PCM_HW_PARAM_FORMAT, val, 0);
}
/**
#endif
}
_end:
- return xfer > 0 ? xfer : err;
+ return xfer > 0 ? (snd_pcm_sframes_t) xfer : err;
}
snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_t *areas,
}
}
_end:
- return xfer > 0 ? xfer : err;
+ return xfer > 0 ? (snd_pcm_sframes_t) xfer : err;
}
snd_pcm_uframes_t _snd_pcm_mmap_hw_ptr(snd_pcm_t *pcm)
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int getputidx,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getputidx,
snd_pcm_adpcm_state_t *states);
typedef struct {
/* This field need to be the first */
snd_pcm_plugin_t plug;
- int getput_idx;
+ unsigned int getput_idx;
adpcm_f func;
snd_pcm_format_t sformat;
snd_pcm_adpcm_state_t *states;
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int putidx,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx,
snd_pcm_adpcm_state_t *states)
{
#define PUT16_LABELS
const snd_pcm_channel_area_t *src_area = &src_areas[channel];
const snd_pcm_channel_area_t *dst_area = &dst_areas[channel];
srcbit = src_area->first + src_area->step * src_offset;
- src = src_area->addr + srcbit / 8;
+ src = (const char *) src_area->addr + srcbit / 8;
srcbit %= 8;
src_step = src_area->step / 8;
srcbit_step = src_area->step % 8;
frames1 = frames;
while (frames1-- > 0) {
int16_t sample;
- int v;
+ unsigned char v;
if (srcbit)
v = *src & 0x0f;
else
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int getidx,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx,
snd_pcm_adpcm_state_t *states)
{
#define GET16_LABELS
src = snd_pcm_channel_area_addr(src_area, src_offset);
src_step = snd_pcm_channel_area_step(src_area);
dstbit = dst_area->first + dst_area->step * dst_offset;
- dst = dst_area->addr + dstbit / 8;
+ dst = (char *) dst_area->addr + dstbit / 8;
dstbit %= 8;
dst_step = dst_area->step / 8;
dstbit_step = dst_area->step % 8;
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int getputidx);
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getputidx);
typedef struct {
/* This field need to be the first */
snd_pcm_plugin_t plug;
- int getput_idx;
+ unsigned int getput_idx;
alaw_f func;
snd_pcm_format_t sformat;
} snd_pcm_alaw_t;
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int putidx)
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx)
{
#define PUT16_LABELS
#include "plugin_ops.h"
void *put = put16_labels[putidx];
unsigned int channel;
for (channel = 0; channel < channels; ++channel) {
- const char *src;
+ const unsigned char *src;
char *dst;
int src_step, dst_step;
snd_pcm_uframes_t frames1;
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int getidx)
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx)
{
#define GET16_LABELS
#include "plugin_ops.h"
typedef struct {
snd_pcm_t *slave;
int close_slave;
- const char *fname;
+ char *fname;
int fd;
int format;
snd_pcm_uframes_t appl_ptr;
return -ENOMEM;
}
- file->fname = fname;
+ file->fname = strdup(fname);
file->fd = fd;
file->format = format;
file->slave = slave;
SNDERR("file is not defined");
return -EINVAL;
}
- if (fname) {
- fname = strdup(fname);
- if (!fname)
- return -ENOMEM;
- }
/* This is needed cause snd_config_update may destroy config */
sname = strdup(sname);
if (!sname)
return xferi.result;
}
-snd_pcm_sframes_t snd_pcm_hw_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
+static snd_pcm_sframes_t snd_pcm_hw_readn(snd_pcm_t *pcm, void **bufs, snd_pcm_uframes_t size)
{
snd_pcm_sframes_t result;
snd_pcm_hw_t *hw = pcm->private_data;
{
snd_pcm_hw_t *hw = pcm->private_data;
void *ptr;
- ptr = mmap(NULL, page_align(sizeof(struct sndrv_pcm_mmap_status)), PROT_READ, MAP_FILE|MAP_SHARED,
+ ptr = mmap(NULL, page_align(sizeof(struct sndrv_pcm_mmap_status)),
+ PROT_READ, MAP_FILE|MAP_SHARED,
hw->fd, SNDRV_PCM_MMAP_OFFSET_STATUS);
if (ptr == MAP_FAILED || ptr == NULL) {
SYSERR("status mmap failed");
{
snd_pcm_hw_t *hw = pcm->private_data;
void *ptr;
- ptr = mmap(NULL, page_align(sizeof(struct sndrv_pcm_mmap_control)), PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED,
+ ptr = mmap(NULL, page_align(sizeof(struct sndrv_pcm_mmap_control)),
+ PROT_READ|PROT_WRITE, MAP_FILE|MAP_SHARED,
hw->fd, SNDRV_PCM_MMAP_OFFSET_CONTROL);
if (ptr == MAP_FAILED || ptr == NULL) {
SYSERR("control mmap failed");
{
snd_pcm_hw_t *hw = pcm->private_data;
if (!(pcm->info & SND_PCM_INFO_MMAP)) {
- snd_pcm_uframes_t size = snd_pcm_frames_to_bytes(pcm, pcm->buffer_size);
+ snd_pcm_uframes_t size = snd_pcm_frames_to_bytes(pcm, (snd_pcm_sframes_t) pcm->buffer_size);
int id = shmget(IPC_PRIVATE, size, 0666);
if (id < 0) {
SYSERR("shmget failed");
static void snd_pcm_hw_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_hw_t *hw = pcm->private_data;
- char *name = "Unknown";
+ char *name;
int err = snd_card_get_name(hw->card, &name);
assert(err >= 0);
snd_output_printf(out, "Hardware PCM card %d '%s' device %d subdevice %d\n",
mmap_forward: snd_pcm_hw_mmap_forward,
};
-int snd_pcm_hw_open_subdevice(snd_pcm_t **pcmp, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode)
+static int snd_pcm_hw_open_subdevice(snd_pcm_t **pcmp, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode)
{
char filename[32];
- char *filefmt;
+ const char *filefmt;
int ver;
int ret = 0, fd = -1;
int attempt = 0;
return ret;
}
-int snd_pcm_hw_open_device(snd_pcm_t **pcmp, int card, int device, snd_pcm_stream_t stream, int mode)
-{
- return snd_pcm_hw_open_subdevice(pcmp, card, device, -1, stream, mode);
-}
-
int snd_pcm_hw_open(snd_pcm_t **pcmp, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode)
{
int err = snd_pcm_hw_open_subdevice(pcmp, card, device, subdevice, stream, mode);
typedef struct {
/* This field need to be the first */
snd_pcm_plugin_t plug;
- int conv_idx;
+ unsigned int conv_idx;
snd_pcm_format_t sformat;
} snd_pcm_linear_t;
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int convidx)
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int convidx)
{
#define CONV_LABELS
#include "plugin_ops.h"
unsigned int tt_cused, unsigned int tt_sused,
snd_pcm_t *slave, int close_slave);
int snd_pcm_plug_open_hw(snd_pcm_t **pcm, const char *name, int card, int device, int subdevice, snd_pcm_stream_t stream, int mode);
-int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *socket, const char *sname, snd_pcm_stream_t stream, int mode);
+int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *sockname, const char *sname, snd_pcm_stream_t stream, int mode);
int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int fd, const char *fmt, snd_pcm_t *slave, int close_slave);
int snd_pcm_null_open(snd_pcm_t **pcmp, const char *name, snd_pcm_stream_t stream, int mode);
{
unsigned int bitofs = area->first + area->step * offset;
assert(bitofs % 8 == 0);
- return area->addr + bitofs / 8;
+ return (char *) area->addr + bitofs / 8;
}
static inline unsigned int snd_pcm_channel_area_step(const snd_pcm_channel_area_t *area)
int snd_pcm_slave_conf(snd_config_t *conf, const char **namep,
unsigned int count, ...);
-#define SND_PCM_HW_PARBIT_ACCESS (1 << SND_PCM_HW_PARAM_ACCESS)
-#define SND_PCM_HW_PARBIT_FORMAT (1 << SND_PCM_HW_PARAM_FORMAT)
-#define SND_PCM_HW_PARBIT_SUBFORMAT (1 << SND_PCM_HW_PARAM_SUBFORMAT)
-#define SND_PCM_HW_PARBIT_CHANNELS (1 << SND_PCM_HW_PARAM_CHANNELS)
-#define SND_PCM_HW_PARBIT_RATE (1 << SND_PCM_HW_PARAM_RATE)
-#define SND_PCM_HW_PARBIT_PERIOD_TIME (1 << SND_PCM_HW_PARAM_PERIOD_TIME)
-#define SND_PCM_HW_PARBIT_PERIOD_SIZE (1 << SND_PCM_HW_PARAM_PERIOD_SIZE)
-#define SND_PCM_HW_PARBIT_PERIODS (1 << SND_PCM_HW_PARAM_PERIODS)
-#define SND_PCM_HW_PARBIT_BUFFER_TIME (1 << SND_PCM_HW_PARAM_BUFFER_TIME)
-#define SND_PCM_HW_PARBIT_BUFFER_SIZE (1 << SND_PCM_HW_PARAM_BUFFER_SIZE)
-#define SND_PCM_HW_PARBIT_SAMPLE_BITS (1 << SND_PCM_HW_PARAM_SAMPLE_BITS)
-#define SND_PCM_HW_PARBIT_FRAME_BITS (1 << SND_PCM_HW_PARAM_FRAME_BITS)
-#define SND_PCM_HW_PARBIT_PERIOD_BYTES (1 << SND_PCM_HW_PARAM_PERIOD_BYTES)
-#define SND_PCM_HW_PARBIT_BUFFER_BYTES (1 << SND_PCM_HW_PARAM_BUFFER_BYTES)
-#define SND_PCM_HW_PARBIT_TICK_TIME (1 << SND_PCM_HW_PARAM_TICK_TIME)
-
-
-#define SND_PCM_ACCBIT_MMAP ((1 << (unsigned long) SND_PCM_ACCESS_MMAP_INTERLEAVED) | \
- (1 << (unsigned long) SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | \
- (1 << (unsigned long) SND_PCM_ACCESS_MMAP_COMPLEX))
-
-#define SND_PCM_ACCBIT_SHM ((1 << (unsigned long) SND_PCM_ACCESS_MMAP_INTERLEAVED) | \
- (1 << (unsigned long) SND_PCM_ACCESS_RW_INTERLEAVED) | \
- (1 << (unsigned long) SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | \
- (1 << (unsigned long) SND_PCM_ACCESS_RW_NONINTERLEAVED))
+#define SND_PCM_HW_PARBIT_ACCESS (1U << SND_PCM_HW_PARAM_ACCESS)
+#define SND_PCM_HW_PARBIT_FORMAT (1U << SND_PCM_HW_PARAM_FORMAT)
+#define SND_PCM_HW_PARBIT_SUBFORMAT (1U << SND_PCM_HW_PARAM_SUBFORMAT)
+#define SND_PCM_HW_PARBIT_CHANNELS (1U << SND_PCM_HW_PARAM_CHANNELS)
+#define SND_PCM_HW_PARBIT_RATE (1U << SND_PCM_HW_PARAM_RATE)
+#define SND_PCM_HW_PARBIT_PERIOD_TIME (1U << SND_PCM_HW_PARAM_PERIOD_TIME)
+#define SND_PCM_HW_PARBIT_PERIOD_SIZE (1U << SND_PCM_HW_PARAM_PERIOD_SIZE)
+#define SND_PCM_HW_PARBIT_PERIODS (1U << SND_PCM_HW_PARAM_PERIODS)
+#define SND_PCM_HW_PARBIT_BUFFER_TIME (1U << SND_PCM_HW_PARAM_BUFFER_TIME)
+#define SND_PCM_HW_PARBIT_BUFFER_SIZE (1U << SND_PCM_HW_PARAM_BUFFER_SIZE)
+#define SND_PCM_HW_PARBIT_SAMPLE_BITS (1U << SND_PCM_HW_PARAM_SAMPLE_BITS)
+#define SND_PCM_HW_PARBIT_FRAME_BITS (1U << SND_PCM_HW_PARAM_FRAME_BITS)
+#define SND_PCM_HW_PARBIT_PERIOD_BYTES (1U << SND_PCM_HW_PARAM_PERIOD_BYTES)
+#define SND_PCM_HW_PARBIT_BUFFER_BYTES (1U << SND_PCM_HW_PARAM_BUFFER_BYTES)
+#define SND_PCM_HW_PARBIT_TICK_TIME (1U << SND_PCM_HW_PARAM_TICK_TIME)
+
+
+#define SND_PCM_ACCBIT_MMAP ((1U << SND_PCM_ACCESS_MMAP_INTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_MMAP_COMPLEX))
+
+#define SND_PCM_ACCBIT_SHM ((1U << SND_PCM_ACCESS_MMAP_INTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_RW_INTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | \
+ (1U << SND_PCM_ACCESS_RW_NONINTERLEAVED))
#define SND_PCM_FMTBIT_LINEAR \
- ((1 << (unsigned long) SND_PCM_FORMAT_S8) | \
- (1 << (unsigned long) SND_PCM_FORMAT_U8) | \
- (1 << (unsigned long) SND_PCM_FORMAT_S16_LE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_S16_BE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_U16_LE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_U16_BE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_S24_LE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_S24_BE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_U24_LE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_U24_BE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_S32_LE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_S32_BE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_U32_LE) | \
- (1 << (unsigned long) SND_PCM_FORMAT_U32_BE))
+ ((1U << SND_PCM_FORMAT_S8) | \
+ (1U << SND_PCM_FORMAT_U8) | \
+ (1U << SND_PCM_FORMAT_S16_LE) | \
+ (1U << SND_PCM_FORMAT_S16_BE) | \
+ (1U << SND_PCM_FORMAT_U16_LE) | \
+ (1U << SND_PCM_FORMAT_U16_BE) | \
+ (1U << SND_PCM_FORMAT_S24_LE) | \
+ (1U << SND_PCM_FORMAT_S24_BE) | \
+ (1U << SND_PCM_FORMAT_U24_LE) | \
+ (1U << SND_PCM_FORMAT_U24_BE) | \
+ (1U << SND_PCM_FORMAT_S32_LE) | \
+ (1U << SND_PCM_FORMAT_S32_BE) | \
+ (1U << SND_PCM_FORMAT_U32_LE) | \
+ (1U << SND_PCM_FORMAT_U32_BE))
struct _snd_pcm_scope {
int enabled;
- const char *name;
+ char *name;
snd_pcm_scope_ops_t *ops;
void *private_data;
struct list_head list;
struct timespec delay;
} snd_pcm_meter_t;
-void snd_pcm_meter_add_frames(snd_pcm_t *pcm,
- const snd_pcm_channel_area_t *areas,
- snd_pcm_uframes_t ptr,
- snd_pcm_uframes_t frames)
+static void snd_pcm_meter_add_frames(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t ptr,
+ snd_pcm_uframes_t frames)
{
snd_pcm_meter_t *meter = pcm->private_data;
while (frames > 0) {
frames += pcm->boundary;
if (frames > 0) {
assert((snd_pcm_uframes_t) frames <= pcm->buffer_size);
- snd_pcm_meter_add_frames(pcm, areas, old_rptr, frames);
+ snd_pcm_meter_add_frames(pcm, areas, old_rptr,
+ (snd_pcm_uframes_t) frames);
}
if (locked)
pthread_mutex_unlock(&meter->update_mutex);
frames += pcm->boundary;
if (frames > 0) {
assert((snd_pcm_uframes_t) frames <= pcm->buffer_size);
- snd_pcm_meter_add_frames(pcm, areas, old_rptr, frames);
+ snd_pcm_meter_add_frames(pcm, areas, old_rptr,
+ (snd_pcm_uframes_t) frames);
}
pthread_mutex_unlock(&meter->update_mutex);
return reset;
}
-int snd_pcm_scope_remove(snd_pcm_scope_t *scope)
+static int snd_pcm_scope_remove(snd_pcm_scope_t *scope)
{
if (scope->name)
free((void *)scope->name);
return 0;
}
-int snd_pcm_scope_enable(snd_pcm_scope_t *scope)
+static int snd_pcm_scope_enable(snd_pcm_scope_t *scope)
{
int err;
assert(!scope->enabled);
return err;
}
-int snd_pcm_scope_disable(snd_pcm_scope_t *scope)
+static int snd_pcm_scope_disable(snd_pcm_scope_t *scope)
{
assert(scope->enabled);
scope->ops->disable(scope);
if (result <= 0)
return result;
if (pcm->stream == SND_PCM_STREAM_PLAYBACK) {
- snd_pcm_meter_add_frames(pcm, snd_pcm_mmap_areas(pcm), old_rptr, result);
+ snd_pcm_meter_add_frames(pcm, snd_pcm_mmap_areas(pcm), old_rptr,
+ (snd_pcm_uframes_t) result);
meter->rptr = *pcm->appl_ptr;
}
return result;
return 0;
}
-int snd_pcm_meter_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+static int snd_pcm_meter_hw_refine_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
snd_pcm_meter_t *meter = pcm->private_data;
return snd_pcm_hw_refine(meter->slave, params);
}
-int snd_pcm_meter_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+static int snd_pcm_meter_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
snd_pcm_meter_t *meter = pcm->private_data;
return _snd_pcm_hw_params(meter->slave, params);
}
-int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
- snd_config_t *conf)
+static int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
+ snd_config_t *conf)
{
char buf[256];
snd_config_iterator_t i, next;
- const char *lib = NULL, *open = NULL, *str = NULL;
+ const char *lib = NULL, *open_name = NULL, *str = NULL;
snd_config_t *c, *type_conf;
- int (*open_func)(snd_pcm_t *pcm, const char *name,
- snd_config_t *conf);
+ int (*open_func)(snd_pcm_t *, const char *,
+ snd_config_t *);
void *h;
int err;
err = snd_config_search(conf, "type", &c);
continue;
}
if (strcmp(id, "open") == 0) {
- err = snd_config_get_string(n, &open);
+ err = snd_config_get_string(n, &open_name);
if (err < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
return -EINVAL;
}
}
- if (!open) {
- open = buf;
+ if (!open_name) {
+ open_name = buf;
snprintf(buf, sizeof(buf), "_snd_pcm_scope_%s_open", str);
}
if (!lib)
SNDERR("Cannot open shared library %s", lib);
return -ENOENT;
}
- open_func = dlsym(h, open);
+ open_func = dlsym(h, open_name);
if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open, lib);
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
dlclose(h);
return -ENXIO;
}
free((void *) sname);
if (err < 0)
return err;
- err = snd_pcm_meter_open(pcmp, name, frequency < 0 ? FREQUENCY : frequency, spcm, 1);
+ err = snd_pcm_meter_open(pcmp, name, frequency > 0 ? (unsigned int) frequency : FREQUENCY, spcm, 1);
if (err < 0)
snd_pcm_close(spcm);
if (!scopes)
*/
void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val)
{
- scope->name = val;
+ scope->name = strdup(val);
}
/**
snd_pcm_t *spcm = meter->slave;
snd_pcm_channel_area_t *a;
unsigned int c;
- int index;
+ int idx;
if (spcm->format == SND_PCM_FORMAT_S16 &&
spcm->access == SND_PCM_ACCESS_MMAP_NONINTERLEAVED) {
s16->buf = (int16_t *) meter->buf;
case SND_PCM_FORMAT_A_LAW:
case SND_PCM_FORMAT_MU_LAW:
case SND_PCM_FORMAT_IMA_ADPCM:
- index = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, SND_PCM_FORMAT_S16);
+ idx = snd_pcm_linear_put_index(SND_PCM_FORMAT_S16, SND_PCM_FORMAT_S16);
break;
case SND_PCM_FORMAT_S8:
case SND_PCM_FORMAT_S16_LE:
case SND_PCM_FORMAT_U24_BE:
case SND_PCM_FORMAT_U32_LE:
case SND_PCM_FORMAT_U32_BE:
- index = snd_pcm_linear_convert_index(spcm->format, SND_PCM_FORMAT_S16);
+ idx = snd_pcm_linear_convert_index(spcm->format, SND_PCM_FORMAT_S16);
break;
default:
return -EINVAL;
}
- s16->index = index;
+ s16->index = idx;
if (spcm->format == SND_PCM_FORMAT_IMA_ADPCM) {
s16->adpcm_states = calloc(spcm->channels, sizeof(*s16->adpcm_states));
if (!s16->adpcm_states)
return 0;
default:
assert(0);
- return -EINVAL;
+ return 0;
}
return 0;
}
*pcm->hw_ptr = hw_ptr;
}
-snd_pcm_uframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
- const snd_pcm_channel_area_t *areas,
- snd_pcm_uframes_t offset,
- snd_pcm_uframes_t size)
+static snd_pcm_uframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
{
const snd_pcm_channel_area_t *pcm_areas;
snd_pcm_uframes_t pcm_offset;
return xfer;
}
-snd_pcm_uframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm,
- const snd_pcm_channel_area_t *areas,
- snd_pcm_uframes_t offset,
- snd_pcm_uframes_t size)
+static snd_pcm_uframes_t snd_pcm_mmap_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
{
const snd_pcm_channel_area_t *pcm_areas;
snd_pcm_uframes_t pcm_offset;
snd_pcm_uframes_t src_offset,
const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int getputidx);
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getputidx);
typedef struct {
/* This field need to be the first */
snd_pcm_plugin_t plug;
- int getput_idx;
+ unsigned int getput_idx;
mulaw_f func;
snd_pcm_format_t sformat;
} snd_pcm_mulaw_t;
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int putidx)
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx)
{
#define PUT16_LABELS
#include "plugin_ops.h"
void *put = put16_labels[putidx];
unsigned int channel;
for (channel = 0; channel < channels; ++channel) {
- const char *src;
+ const unsigned char *src;
char *dst;
int src_step, dst_step;
snd_pcm_uframes_t frames1;
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int getidx)
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx)
{
#define GET16_LABELS
#include "plugin_ops.h"
memset(info, 0, sizeof(*info));
info->stream = snd_enum_to_int(pcm->stream);
info->card = -1;
- strcpy(info->id, "multi");
- strcpy(info->name, "multi");
- strcpy(info->subname, "multi");
+ strncpy(info->id, pcm->name, sizeof(info->id));
+ strncpy(info->name, pcm->name, sizeof(info->name));
+ strncpy(info->subname, pcm->name, sizeof(info->subname));
info->subdevices_count = 1;
return 0;
}
multi->channels_count, 0);
if (err < 0)
return err;
- params->info = ~0;
+ params->info = ~0U;
return 0;
}
-static int snd_pcm_multi_hw_refine_sprepare(snd_pcm_t *pcm, int slave_idx,
+static int snd_pcm_multi_hw_refine_sprepare(snd_pcm_t *pcm, unsigned int slave_idx,
snd_pcm_hw_params_t *sparams)
{
snd_pcm_multi_t *multi = pcm->private_data;
}
static int snd_pcm_multi_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
- int slave_idx ATTRIBUTE_UNUSED,
+ unsigned int slave_idx ATTRIBUTE_UNUSED,
snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
}
static int snd_pcm_multi_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
- int slave_idx ATTRIBUTE_UNUSED,
+ unsigned int slave_idx ATTRIBUTE_UNUSED,
snd_pcm_hw_params_t *params,
snd_pcm_hw_params_t *sparams)
{
}
static int snd_pcm_multi_hw_refine_slave(snd_pcm_t *pcm,
- int slave_idx,
+ unsigned int slave_idx,
snd_pcm_hw_params_t *sparams)
{
snd_pcm_multi_t *multi = pcm->private_data;
}
static int snd_pcm_multi_hw_params_slave(snd_pcm_t *pcm,
- int slave_idx,
+ unsigned int slave_idx,
snd_pcm_hw_params_t *sparams)
{
snd_pcm_multi_t *multi = pcm->private_data;
return 0;
}
-int snd_pcm_multi_poll_descriptor(snd_pcm_t *pcm)
-{
- snd_pcm_multi_t *multi = pcm->private_data;
- snd_pcm_t *slave = multi->slaves[0].pcm;
- return _snd_pcm_poll_descriptor(slave);
-}
-
static void snd_pcm_multi_dump(snd_pcm_t *pcm, snd_output_t *out)
{
snd_pcm_multi_t *multi = pcm->private_data;
char **slaves_name = NULL;
snd_pcm_t **slaves_pcm = NULL;
unsigned int *slaves_channels = NULL;
- unsigned int *channels_sidx = NULL;
+ int *channels_sidx = NULL;
unsigned int *channels_schannel = NULL;
unsigned int slaves_count = 0;
unsigned int channels_count = 0;
idx = 0;
snd_config_for_each(i, inext, slaves) {
snd_config_t *m = snd_config_iterator_entry(i);
- const char *name;
+ const char *n;
int channels;
slaves_id[idx] = snd_config_get_id(m);
- err = snd_pcm_slave_conf(m, &name, 1,
+ err = snd_pcm_slave_conf(m, &n, 1,
SND_PCM_HW_PARAM_CHANNELS, 1, &channels);
if (err < 0)
goto _free;
- slaves_name[idx] = strdup(name);
+ slaves_name[idx] = strdup(n);
slaves_channels[idx] = channels;
++idx;
}
}
snd_config_for_each(j, jnext, m) {
snd_config_t *n = snd_config_iterator_entry(j);
- const char *id = snd_config_get_id(n);
+ id = snd_config_get_id(n);
if (strcmp(id, "comment") == 0)
continue;
if (strcmp(id, "slave") == 0) {
memset(info, 0, sizeof(*info));
info->stream = snd_enum_to_int(pcm->stream);
info->card = -1;
- strcpy(info->id, "null");
- strcpy(info->name, "null");
- strcpy(info->subname, "null");
+ strncpy(info->id, pcm->name, sizeof(info->id));
+ strncpy(info->name, pcm->name, sizeof(info->name));
+ strncpy(info->subname, pcm->name, sizeof(info->subname));
info->subdevices_count = 1;
return 0;
}
#include "pcm_local.h"
-static inline int hw_is_mask(int var)
+static inline int hw_is_mask(snd_pcm_hw_param_t var)
{
return var >= SND_PCM_HW_PARAM_FIRST_MASK &&
var <= SND_PCM_HW_PARAM_LAST_MASK;
}
-static inline int hw_is_interval(int var)
+static inline int hw_is_interval(snd_pcm_hw_param_t var)
{
return var >= SND_PCM_HW_PARAM_FIRST_INTERVAL &&
var <= SND_PCM_HW_PARAM_LAST_INTERVAL;
}
static inline snd_mask_t *hw_param_mask(snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var)
+ snd_pcm_hw_param_t var)
{
assert(hw_is_mask(var));
return (snd_mask_t*)¶ms->masks[var - SND_PCM_HW_PARAM_FIRST_MASK];
}
static inline snd_interval_t *hw_param_interval(snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var)
+ snd_pcm_hw_param_t var)
{
assert(hw_is_interval(var));
return ¶ms->intervals[var - SND_PCM_HW_PARAM_FIRST_INTERVAL];
}
static inline const snd_mask_t *hw_param_mask_c(const snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var)
+ snd_pcm_hw_param_t var)
{
return (const snd_mask_t *)hw_param_mask((snd_pcm_hw_params_t*) params, var);
}
static inline const snd_interval_t *hw_param_interval_c(const snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var)
+ snd_pcm_hw_param_t var)
{
return (const snd_interval_t *)hw_param_interval((snd_pcm_hw_params_t*) params, var);
}
-void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var)
+static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var)
{
if (hw_is_mask(var)) {
snd_mask_any(hw_param_mask(params, var));
return snd_interval_min(i);
}
assert(0);
- return -EINVAL;
+ return 0;
}
/* Return the maximum value for field PAR. */
unsigned int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var, int *dir)
+ snd_pcm_hw_param_t var, int *dir)
{
if (hw_is_mask(var)) {
if (dir)
return snd_interval_max(i);
}
assert(0);
- return -EINVAL;
+ return 0;
}
/* Return the mask for field PAR.
}
}
-int _snd_pcm_hw_param_set_integer(snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var)
+static int _snd_pcm_hw_param_set_integer(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
{
int changed;
assert(hw_is_interval(var));
return err;
}
-int _snd_pcm_hw_param_set_first(snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var)
+static int _snd_pcm_hw_param_set_first(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
{
int changed;
if (hw_is_mask(var))
return snd_pcm_hw_param_get(params, var, dir);
}
-int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var)
+static int _snd_pcm_hw_param_set_last(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
{
int changed;
if (hw_is_mask(var))
snd_pcm_hw_param_t var, unsigned int val, int dir)
{
int changed;
- int open = 0;
+ int openmin = 0;
if (dir) {
if (dir > 0) {
- open = 1;
+ openmin = 1;
} else if (dir < 0) {
if (val > 0) {
- open = 1;
+ openmin = 1;
val--;
}
}
}
if (hw_is_mask(var))
- changed = snd_mask_refine_min(hw_param_mask(params, var), val + !!open);
+ changed = snd_mask_refine_min(hw_param_mask(params, var), val + !!openmin);
else if (hw_is_interval(var))
- changed = snd_interval_refine_min(hw_param_interval(params, var), val, open);
+ changed = snd_interval_refine_min(hw_param_interval(params, var), val, openmin);
else {
assert(0);
return -EINVAL;
snd_pcm_hw_param_t var, unsigned int val, int dir)
{
int changed;
- int open = 0;
+ int openmax = 0;
if (dir) {
if (dir < 0) {
- open = 1;
+ openmax = 1;
} else if (dir > 0) {
- open = 1;
+ openmax = 1;
val++;
}
}
if (hw_is_mask(var)) {
- if (val == 0 && open) {
+ if (val == 0 && openmax) {
snd_mask_none(hw_param_mask(params, var));
changed = -EINVAL;
} else
- changed = snd_mask_refine_max(hw_param_mask(params, var), val - !!open);
+ changed = snd_mask_refine_max(hw_param_mask(params, var), val - !!openmax);
} else if (hw_is_interval(var))
- changed = snd_interval_refine_max(hw_param_interval(params, var), val, open);
+ changed = snd_interval_refine_max(hw_param_interval(params, var), val, openmax);
else {
assert(0);
return -EINVAL;
return v;
}
+#if 0
/* Inside configuration space defined by PARAMS set PAR to the available value
nearest to BEST after VAL (on equal difference values less than BEST are
returned first).
assert(v >= 0);
return v;
}
+#endif
-void snd_pcm_hw_param_set_near_minmax(snd_pcm_t *pcm,
- snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var,
- unsigned int min, int *mindir,
- unsigned int max, int *maxdir)
+static void snd_pcm_hw_param_set_near_minmax(snd_pcm_t *pcm,
+ snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var,
+ unsigned int min, int *mindir,
+ unsigned int max, int *maxdir)
{
snd_pcm_hw_params_t tmp;
int err;
/* ---- end of refinement functions ---- */
-int snd_pcm_hw_param_empty(const snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var)
+#if 0
+static int snd_pcm_hw_param_empty(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
{
if (hw_is_mask(var))
return snd_mask_empty(hw_param_mask_c(params, var));
assert(0);
return -EINVAL;
}
+#endif
int snd_pcm_hw_param_always_eq(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
max buffer size
min tick time
*/
-void snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
+static void snd_pcm_hw_params_choose(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
{
snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_ACCESS, 0);
snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_FORMAT, 0);
snd_pcm_hw_param_set_first(pcm, params, SND_PCM_HW_PARAM_TICK_TIME, 0);
}
-unsigned int snd_pcm_hw_param_count(const snd_pcm_hw_params_t *params,
- snd_pcm_hw_param_t var)
+#if 0
+static unsigned int snd_pcm_hw_param_count(const snd_pcm_hw_params_t *params,
+ snd_pcm_hw_param_t var)
{
if (hw_is_mask(var)) {
const snd_mask_t *mask = hw_param_mask_c(params, var);
assert(0);
return 0;
}
+#endif
int _snd_pcm_hw_param_refine(snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var,
return changed;
}
-void _snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
- const snd_pcm_hw_params_t *src)
+#if 0
+static void _snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t var,
+ const snd_pcm_hw_params_t *src)
{
if (hw_is_mask(var)) {
snd_mask_t *d = hw_param_mask(params, var);
snd_mask_copy(d, s);
params->cmask |= 1 << var;
params->rmask |= 1 << var;
+ return;
}
if (hw_is_interval(var)) {
snd_interval_t *d = hw_param_interval(params, var);
snd_interval_copy(d, s);
params->cmask |= 1 << var;
params->rmask |= 1 << var;
+ return;
}
assert(0);
}
+#endif
void snd_pcm_hw_param_dump(const snd_pcm_hw_params_t *params,
snd_pcm_hw_param_t var, snd_output_t *out)
void *private_data;
};
-int snd_pcm_hw_rule_mul(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+static int snd_pcm_hw_rule_mul(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_rule_t *rule)
{
snd_interval_t t;
snd_interval_mul(hw_param_interval_c(params, rule->deps[0]),
return snd_interval_refine(hw_param_interval(params, rule->var), &t);
}
-int snd_pcm_hw_rule_div(snd_pcm_hw_params_t *params,
+static int snd_pcm_hw_rule_div(snd_pcm_hw_params_t *params,
snd_pcm_hw_rule_t *rule)
{
snd_interval_t t;
return snd_interval_refine(hw_param_interval(params, rule->var), &t);
}
-int snd_pcm_hw_rule_muldivk(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+static int snd_pcm_hw_rule_muldivk(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_rule_t *rule)
{
snd_interval_t t;
snd_interval_muldivk(hw_param_interval_c(params, rule->deps[0]),
return snd_interval_refine(hw_param_interval(params, rule->var), &t);
}
-int snd_pcm_hw_rule_mulkdiv(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+static int snd_pcm_hw_rule_mulkdiv(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_rule_t *rule)
{
snd_interval_t t;
snd_interval_mulkdiv(hw_param_interval_c(params, rule->deps[0]),
return snd_interval_refine(hw_param_interval(params, rule->var), &t);
}
-int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+static int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_rule_t *rule)
{
int changed = 0;
snd_pcm_format_t k;
bits = snd_pcm_format_physical_width(k);
if (bits < 0)
continue;
- if (!snd_interval_test(i, bits)) {
+ if (!snd_interval_test(i, (unsigned int) bits)) {
snd_pcm_format_mask_reset(mask, k);
if (snd_mask_empty(mask))
return -EINVAL;
}
-int snd_pcm_hw_rule_sample_bits(snd_pcm_hw_params_t *params,
- snd_pcm_hw_rule_t *rule)
+static int snd_pcm_hw_rule_sample_bits(snd_pcm_hw_params_t *params,
+ snd_pcm_hw_rule_t *rule)
{
unsigned int min, max;
snd_pcm_format_t k;
return err;
}
-int snd_pcm_sw_params_default(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
+static int snd_pcm_sw_params_default(snd_pcm_t *pcm, snd_pcm_sw_params_t *params)
{
assert(pcm && params);
assert(pcm->setup);
s = 0;
}
}
- err = snd_pcm_route_open(new, NULL, slv->format, slv->channels, ttable, tt_ssize, tt_cused, tt_sused, plug->slave, plug->slave != plug->req_slave);
+ err = snd_pcm_route_open(new, NULL, slv->format, (int) slv->channels, ttable, tt_ssize, tt_cused, tt_sused, plug->slave, plug->slave != plug->req_slave);
if (err < 0)
return err;
slv->channels = clt->channels;
snd_pcm_plug_t *plug = pcm->private_data;
int err;
snd_pcm_format_t cfmt;
- int (*f)(snd_pcm_t **pcm, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
+ int (*f)(snd_pcm_t **_pcm, const char *name, snd_pcm_format_t sformat, snd_pcm_t *slave, int close_slave);
if (snd_pcm_format_linear(slv->format)) {
/* Conversion is done in another plugin */
if (clt->format == slv->format ||
snd_pcm_plug_params_t *slave)
{
snd_pcm_plug_t *plug = pcm->private_data;
- int (*funcs[])(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_plug_params_t *s, snd_pcm_plug_params_t *d) = {
+ int (*funcs[])(snd_pcm_t *_pcm, snd_pcm_t **new, snd_pcm_plug_params_t *s, snd_pcm_plug_params_t *d) = {
snd_pcm_plug_change_format,
snd_pcm_plug_change_channels,
snd_pcm_plug_change_rate,
return 0;
}
-int snd_pcm_plugin_reset(snd_pcm_t *pcm)
+static int snd_pcm_plugin_reset(snd_pcm_t *pcm)
{
snd_pcm_plugin_t *plugin = pcm->private_data;
int err;
snd_pcm_sframes_t err;
/* FIXME: rate plugin */
if (plugin->slave_frames)
- frames = plugin->slave_frames(pcm, frames);
+ frames = plugin->slave_frames(pcm, (snd_pcm_sframes_t) frames);
snd_atomic_write_begin(&plugin->watom);
err = snd_pcm_rewind(plugin->slave, frames);
if (err < 0) {
}
if (plugin->client_frames)
err = plugin->client_frames(pcm, err);
- snd_pcm_mmap_hw_backward(pcm, err);
+ snd_pcm_mmap_hw_backward(pcm, (snd_pcm_uframes_t) err);
n += err;
} else
snd_atomic_write_begin(&plugin->watom);
_end:
- snd_pcm_mmap_appl_backward(pcm, n);
+ snd_pcm_mmap_appl_backward(pcm, (snd_pcm_uframes_t) n);
snd_atomic_write_end(&plugin->watom);
return n;
}
-snd_pcm_uframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
- const snd_pcm_channel_area_t *areas,
- snd_pcm_uframes_t offset,
- snd_pcm_uframes_t size)
+static snd_pcm_uframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
{
snd_pcm_plugin_t *plugin = pcm->private_data;
snd_pcm_t *slave = plugin->slave;
return xfer;
}
-snd_pcm_uframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
- const snd_pcm_channel_area_t *areas,
- snd_pcm_uframes_t offset,
- snd_pcm_uframes_t size)
+static snd_pcm_uframes_t snd_pcm_plugin_read_areas(snd_pcm_t *pcm,
+ const snd_pcm_channel_area_t *areas,
+ snd_pcm_uframes_t offset,
+ snd_pcm_uframes_t size)
{
snd_pcm_plugin_t *plugin = pcm->private_data;
snd_pcm_t *slave = plugin->slave;
snd_pcm_t *slave = plugin->slave;
const snd_pcm_channel_area_t *areas, *slave_areas;
snd_pcm_uframes_t xfer, offset, size;
- snd_pcm_uframes_t slave_offset, slave_size;
+ snd_pcm_uframes_t slave_offset;
+ snd_pcm_sframes_t slave_size;
slave_size = snd_pcm_avail_update(slave);
if (slave_size <= 0)
return slave_size;
if (pcm->stream == SND_PCM_STREAM_PLAYBACK ||
pcm->access == SND_PCM_ACCESS_RW_INTERLEAVED ||
pcm->access == SND_PCM_ACCESS_RW_NONINTERLEAVED)
- return plugin->client_frames ?
- plugin->client_frames(pcm, slave_size) : slave_size;
+ return (plugin->client_frames ?
+ plugin->client_frames(pcm, slave_size) :
+ slave_size);
xfer = snd_pcm_mmap_capture_avail(pcm);
size = pcm->buffer_size - xfer;
areas = snd_pcm_mmap_areas(pcm);
int snd_pcm_plugin_mmap(snd_pcm_t *pcm)
{
snd_pcm_plugin_t *plug = pcm->private_data;
- size_t size = snd_pcm_frames_to_bytes(pcm, pcm->buffer_size);
+ size_t size = snd_pcm_frames_to_bytes(pcm, (snd_pcm_sframes_t) pcm->buffer_size);
int id = shmget(IPC_PRIVATE, size, 0666);
if (id < 0) {
SYSERR("shmget failed");
return 0;
}
-int snd_pcm_plugin_poll_descriptor(snd_pcm_t *pcm)
-{
- snd_pcm_plugin_t *plugin = pcm->private_data;
- return _snd_pcm_poll_descriptor(plugin->slave);
-}
-
int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
{
snd_pcm_plugin_t *plugin = pcm->private_data;
goto _again;
}
if (plugin->client_frames)
- status->avail_max = plugin->client_frames(pcm, status->avail_max);
+ status->avail_max = plugin->client_frames(pcm, (snd_pcm_sframes_t) status->avail_max);
return 0;
}
unsigned int *tt_cused, unsigned int *tt_sused,
int schannels);
int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
- snd_pcm_format_t sformat, unsigned int schannels,
+ snd_pcm_format_t sformat, int schannels,
snd_pcm_route_ttable_entry_t *ttable,
unsigned int tt_ssize,
unsigned int tt_cused, unsigned int tt_sused,
snd_pcm_t *slave, int close_slave);
-int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, int srate, snd_pcm_t *slave, int close_slave);
+int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, unsigned int srate, snd_pcm_t *slave, int close_slave);
void snd_pcm_linear_convert(const snd_pcm_channel_area_t *dst_areas, snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas, snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int convidx);
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int convidx);
void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int putidx);
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx);
void snd_pcm_alaw_encode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int getidx);
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx);
void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int putidx);
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx);
void snd_pcm_mulaw_encode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int getidx);
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx);
typedef struct _snd_pcm_adpcm_state {
int pred_val; /* Calculated predicted value */
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int putidx,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int putidx,
snd_pcm_adpcm_state_t *states);
void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
snd_pcm_uframes_t dst_offset,
const snd_pcm_channel_area_t *src_areas,
snd_pcm_uframes_t src_offset,
- unsigned int channels, snd_pcm_uframes_t frames, int getidx,
+ unsigned int channels, snd_pcm_uframes_t frames,
+ unsigned int getidx,
snd_pcm_adpcm_state_t *states);
snd_pcm_uframes_t src_offset,
snd_pcm_uframes_t src_frames,
unsigned int channels,
- int getidx, int putidx,
+ unsigned int getidx, unsigned int putidx,
unsigned int arg,
snd_pcm_rate_state_t *states);
typedef struct {
/* This field need to be the first */
snd_pcm_plugin_t plug;
- int get_idx;
- int put_idx;
+ unsigned int get_idx;
+ unsigned int put_idx;
unsigned int pitch;
rate_f func;
snd_pcm_format_t sformat;
- int srate;
+ unsigned int srate;
snd_pcm_rate_state_t *states;
} snd_pcm_rate_t;
-snd_pcm_uframes_t snd_pcm_rate_expand(const snd_pcm_channel_area_t *dst_areas,
- snd_pcm_uframes_t dst_offset, snd_pcm_uframes_t *dst_framesp,
- const snd_pcm_channel_area_t *src_areas,
- snd_pcm_uframes_t src_offset, snd_pcm_uframes_t src_frames,
- unsigned int channels,
- int getidx, int putidx,
- unsigned int get_threshold,
- snd_pcm_rate_state_t *states)
+static snd_pcm_uframes_t snd_pcm_rate_expand(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, snd_pcm_uframes_t *dst_framesp,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, snd_pcm_uframes_t src_frames,
+ unsigned int channels,
+ unsigned int getidx, unsigned int putidx,
+ unsigned int get_threshold,
+ snd_pcm_rate_state_t *states)
{
#define GET16_LABELS
#define PUT16_LABELS
return src_frames1;
}
-snd_pcm_uframes_t snd_pcm_rate_shrink(const snd_pcm_channel_area_t *dst_areas,
- snd_pcm_uframes_t dst_offset, snd_pcm_uframes_t *dst_framesp,
- const snd_pcm_channel_area_t *src_areas,
- snd_pcm_uframes_t src_offset, snd_pcm_uframes_t src_frames,
- unsigned int channels,
- int getidx, int putidx,
- unsigned int get_increment,
- snd_pcm_rate_state_t *states)
+static snd_pcm_uframes_t snd_pcm_rate_shrink(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset, snd_pcm_uframes_t *dst_framesp,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset, snd_pcm_uframes_t src_frames,
+ unsigned int channels,
+ unsigned int getidx, unsigned int putidx,
+ unsigned int get_increment,
+ snd_pcm_rate_state_t *states)
{
#define GET16_LABELS
#define PUT16_LABELS
return size;
}
-snd_pcm_sframes_t snd_pcm_rate_client_frames(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
+static snd_pcm_sframes_t snd_pcm_rate_client_frames(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
{
snd_pcm_rate_t *rate = pcm->private_data;
/* Round toward zero */
return muldiv_down(frames, rate->pitch, DIV);
}
-snd_pcm_sframes_t snd_pcm_rate_slave_frames(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
+static snd_pcm_sframes_t snd_pcm_rate_slave_frames(snd_pcm_t *pcm, snd_pcm_sframes_t frames)
{
snd_pcm_rate_t *rate = pcm->private_data;
/* Round toward zero */
munmap: snd_pcm_plugin_munmap,
};
-int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, int srate, snd_pcm_t *slave, int close_slave)
+int snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name, snd_pcm_format_t sformat, unsigned int srate, snd_pcm_t *slave, int close_slave)
{
snd_pcm_t *pcm;
snd_pcm_rate_t *rate;
free((void *) sname);
if (err < 0)
return err;
- err = snd_pcm_rate_open(pcmp, name, sformat, srate, spcm, 1);
+ err = snd_pcm_rate_open(pcmp, name,
+ sformat, (unsigned int) srate, spcm, 1);
if (err < 0)
snd_pcm_close(spcm);
return err;
typedef struct {
enum {UINT32=0, UINT64=1, FLOAT=2} sum_idx;
- int get_idx;
- int put_idx;
- int conv_idx;
- int src_size;
+ unsigned int get_idx;
+ unsigned int put_idx;
+ unsigned int conv_idx;
+ unsigned int src_size;
snd_pcm_format_t dst_sfmt;
unsigned int ndsts;
snd_pcm_route_ttable_dst_t *dsts;
} snd_pcm_route_t;
-void snd_pcm_route_convert1_zero(const snd_pcm_channel_area_t *dst_area,
- snd_pcm_uframes_t dst_offset,
- const snd_pcm_channel_area_t *src_areas ATTRIBUTE_UNUSED,
- snd_pcm_uframes_t src_offset ATTRIBUTE_UNUSED,
- snd_pcm_uframes_t frames,
- const snd_pcm_route_ttable_dst_t* ttable ATTRIBUTE_UNUSED,
- const snd_pcm_route_params_t *params)
+static void snd_pcm_route_convert1_zero(const snd_pcm_channel_area_t *dst_area,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t src_offset ATTRIBUTE_UNUSED,
+ snd_pcm_uframes_t frames,
+ const snd_pcm_route_ttable_dst_t* ttable ATTRIBUTE_UNUSED,
+ const snd_pcm_route_params_t *params)
{
snd_pcm_area_silence(dst_area, dst_offset, frames, params->dst_sfmt);
}
-void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *dst_area,
- snd_pcm_uframes_t dst_offset,
- const snd_pcm_channel_area_t *src_areas,
- snd_pcm_uframes_t src_offset,
- snd_pcm_uframes_t frames,
- const snd_pcm_route_ttable_dst_t* ttable,
- const snd_pcm_route_params_t *params)
+static void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *dst_area,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ snd_pcm_uframes_t frames,
+ const snd_pcm_route_ttable_dst_t* ttable,
+ const snd_pcm_route_params_t *params)
{
#define CONV_LABELS
#include "plugin_ops.h"
}
}
-void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
- snd_pcm_uframes_t dst_offset,
- const snd_pcm_channel_area_t *src_areas,
- snd_pcm_uframes_t src_offset,
- snd_pcm_uframes_t frames,
- const snd_pcm_route_ttable_dst_t* ttable,
- const snd_pcm_route_params_t *params)
+static void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ snd_pcm_uframes_t frames,
+ const snd_pcm_route_ttable_dst_t* ttable,
+ const snd_pcm_route_params_t *params)
{
#define GETU_LABELS
#define PUT32_LABELS
}
}
-void snd_pcm_route_convert(const snd_pcm_channel_area_t *dst_areas,
- snd_pcm_uframes_t dst_offset,
- const snd_pcm_channel_area_t *src_areas,
- snd_pcm_uframes_t src_offset,
- snd_pcm_uframes_t dst_channels,
- snd_pcm_uframes_t frames,
- snd_pcm_route_params_t *params)
+static void snd_pcm_route_convert(const snd_pcm_channel_area_t *dst_areas,
+ snd_pcm_uframes_t dst_offset,
+ const snd_pcm_channel_area_t *src_areas,
+ snd_pcm_uframes_t src_offset,
+ snd_pcm_uframes_t dst_channels,
+ snd_pcm_uframes_t frames,
+ snd_pcm_route_params_t *params)
{
unsigned int dst_channel;
snd_pcm_route_ttable_dst_t *dstp;
}
if (route->schannels >= 0) {
_snd_pcm_hw_param_set(sparams, SND_PCM_HW_PARAM_CHANNELS,
- route->schannels, 0);
+ (unsigned int) route->schannels, 0);
}
return 0;
}
munmap: snd_pcm_plugin_munmap,
};
-int route_load_ttable(snd_pcm_route_params_t *params, snd_pcm_stream_t stream,
- unsigned int tt_ssize,
- snd_pcm_route_ttable_entry_t *ttable,
- unsigned int tt_cused, unsigned int tt_sused)
+static int route_load_ttable(snd_pcm_route_params_t *params, snd_pcm_stream_t stream,
+ unsigned int tt_ssize,
+ snd_pcm_route_ttable_entry_t *ttable,
+ unsigned int tt_cused, unsigned int tt_sused)
{
unsigned int src_channel, dst_channel;
snd_pcm_route_ttable_dst_t *dptr;
else
dptr->func = snd_pcm_route_convert1_many;
if (nsrcs > 0) {
- dptr->srcs = calloc(nsrcs, sizeof(*srcs));
+ dptr->srcs = calloc((unsigned int) nsrcs, sizeof(*srcs));
if (!dptr->srcs)
return -ENOMEM;
memcpy(dptr->srcs, srcs, sizeof(*srcs) * nsrcs);
int snd_pcm_route_open(snd_pcm_t **pcmp, const char *name,
- snd_pcm_format_t sformat, unsigned int schannels,
+ snd_pcm_format_t sformat, int schannels,
snd_pcm_route_ttable_entry_t *ttable,
unsigned int tt_ssize,
unsigned int tt_cused, unsigned int tt_sused,
if (snd_config_get_type(in) != SND_CONFIG_TYPE_COMPOUND)
return -EINVAL;
snd_config_for_each(j, jnext, in) {
- snd_config_t *jn = snd_config_iterator_entry(j);
+ snd_config_t *jnode = snd_config_iterator_entry(j);
double value;
long schannel;
int err;
- const char *id = snd_config_get_id(jn);
+ const char *id = snd_config_get_id(jnode);
errno = 0;
schannel = strtol(id, &p, 10);
if (errno || *p ||
SNDERR("Invalid slave channel: %s", id);
return -EINVAL;
}
- err = snd_config_get_real(jn, &value);
+ err = snd_config_get_real(jnode, &value);
if (err < 0) {
long v;
- err = snd_config_get_integer(jn, &v);
+ err = snd_config_get_integer(jnode, &v);
if (err < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
return missing;
}
-void *snd_pcm_share_thread(void *data)
+static void *snd_pcm_share_thread(void *data)
{
snd_pcm_share_slave_t *slave = data;
snd_pcm_t *spcm = slave->pcm;
}
snd_pcm_mmap_appl_forward(pcm, size);
if (share->state == SND_PCM_STATE_RUNNING) {
- snd_pcm_sframes_t frames = _snd_pcm_share_slave_forward(slave);
+ frames = _snd_pcm_share_slave_forward(slave);
if (frames > 0) {
snd_pcm_sframes_t err;
err = snd_pcm_mmap_forward(slave->pcm, frames);
Pthread_mutex_unlock(&snd_pcm_share_slaves_mutex);
list_for_each(i, &slave->clients) {
snd_pcm_share_t *sh = list_entry(i, snd_pcm_share_t, list);
- unsigned int k;
for (k = 0; k < sh->channels; ++k) {
if (slave_map[sh->slave_channels[k]]) {
SNDERR("Slave channel %d is already in use", sh->slave_channels[k]);
if (schannels <= 0)
schannels = schannel_max + 1;
err = snd_pcm_share_open(pcmp, name, sname, sformat, srate,
- schannels, speriod_time, sbuffer_time,
+ (unsigned int) schannels,
+ speriod_time, sbuffer_time,
channels, channels_map, stream, mode);
_free:
free(channels_map);
volatile snd_pcm_shm_ctrl_t *ctrl;
} snd_pcm_shm_t;
-int receive_fd(int socket, void *data, size_t len, int *fd)
+int receive_fd(int sock, void *data, size_t len, int *fd)
{
int ret;
size_t cmsg_len = CMSG_LEN(sizeof(int));
msghdr.msg_controllen = cmsg_len;
msghdr.msg_flags = 0;
- ret = recvmsg(socket, &msghdr, 0);
+ ret = recvmsg(sock, &msghdr, 0);
if (ret < 0) {
SYSERR("recvmsg failed");
return -errno;
}
#endif
-int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *socket, const char *sname, snd_pcm_stream_t stream, int mode)
+int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *sockname, const char *sname, snd_pcm_stream_t stream, int mode)
{
snd_pcm_t *pcm;
snd_pcm_shm_t *shm = NULL;
if (snamelen > 255)
return -EINVAL;
- result = make_local_socket(socket);
+ result = make_local_socket(sockname);
if (result < 0) {
- SNDERR("server for socket %s is not running", socket);
+ SNDERR("server for socket %s is not running", sockname);
goto _err;
}
sock = result;
}
conf.ifc_len = numreqs * sizeof(struct ifreq);
- conf.ifc_buf = malloc(conf.ifc_len);
+ conf.ifc_buf = malloc((unsigned int) conf.ifc_len);
while (1) {
err = ioctl(s, SIOCGIFCONF, &conf);
if (err < 0) {
break;
numreqs *= 2;
conf.ifc_len = numreqs * sizeof(struct ifreq);
- conf.ifc_buf = realloc(conf.ifc_buf, conf.ifc_len);
+ conf.ifc_buf = realloc(conf.ifc_buf, (unsigned int) conf.ifc_len);
}
numreqs = conf.ifc_len / sizeof(struct ifreq);
for (i = 0; i < numreqs; ++i) {
struct ifreq *req = &conf.ifc_req[i];
- struct sockaddr_in *sin = (struct sockaddr_in *)&req->ifr_addr;
- sin->sin_family = AF_INET;
+ struct sockaddr_in *s_in = (struct sockaddr_in *)&req->ifr_addr;
+ s_in->sin_family = AF_INET;
err = ioctl(s, SIOCGIFADDR, req);
if (err < 0)
continue;
- if (haddr->s_addr == sin->sin_addr.s_addr)
+ if (haddr->s_addr == s_in->sin_addr.s_addr)
break;
}
close(s);
const char *pcm_name = NULL;
snd_config_t *sconfig;
const char *host = NULL;
- const char *socket = NULL;
+ const char *sockname = NULL;
long port = -1;
int err;
int local;
continue;
}
if (strcmp(id, "socket") == 0) {
- err = snd_config_get_string(n, &socket);
+ err = snd_config_get_string(n, &sockname);
if (err < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
SNDERR("host is not defined");
return -EINVAL;
}
- if (!socket) {
+ if (!sockname) {
SNDERR("socket is not defined");
return -EINVAL;
}
SNDERR("%s is not the local host", host);
return -EINVAL;
}
- return snd_pcm_shm_open(pcmp, name, socket, pcm_name, stream, mode);
+ return snd_pcm_shm_open(pcmp, name, sockname, pcm_name, stream, mode);
}
#define as_s32(ptr) (*(int32_t*)(ptr))
#define as_s64(ptr) (*(int64_t*)(ptr))
+#define as_u8c(ptr) (*(const u_int8_t*)(ptr))
+#define as_u16c(ptr) (*(const u_int16_t*)(ptr))
+#define as_u32c(ptr) (*(const u_int32_t*)(ptr))
+#define as_u64c(ptr) (*(const u_int64_t*)(ptr))
+#define as_s8c(ptr) (*(const int8_t*)(ptr))
+#define as_s16c(ptr) (*(const int16_t*)(ptr))
+#define as_s32c(ptr) (*(const int32_t*)(ptr))
+#define as_s64c(ptr) (*(const int64_t*)(ptr))
+
#ifdef COPY_LABELS
static void *copy_labels[4] = {
&©_8,
#ifdef COPY_END
while(0) {
-copy_8: as_s8(dst) = as_s8(src); goto COPY_END;
-copy_16: as_s16(dst) = as_s16(src); goto COPY_END;
-copy_32: as_s32(dst) = as_s32(src); goto COPY_END;
-copy_64: as_s64(dst) = as_s64(src); goto COPY_END;
+copy_8: as_s8(dst) = as_s8c(src); goto COPY_END;
+copy_16: as_s16(dst) = as_s16c(src); goto COPY_END;
+copy_32: as_s32(dst) = as_s32c(src); goto COPY_END;
+copy_64: as_s64(dst) = as_s64c(src); goto COPY_END;
}
#endif
#ifdef CONV_END
while(0) {
-conv_xxx1_xxx1: as_u8(dst) = as_u8(src); goto CONV_END;
-conv_xxx1_xx10: as_u16(dst) = (u_int16_t)as_u8(src) << 8; goto CONV_END;
-conv_xxx1_xx01: as_u16(dst) = (u_int16_t)as_u8(src); goto CONV_END;
-conv_xxx1_x100: as_u32(dst) = (u_int32_t)as_u8(src) << 16; goto CONV_END;
-conv_xxx1_001x: as_u32(dst) = (u_int32_t)as_u8(src) << 8; goto CONV_END;
-conv_xxx1_1000: as_u32(dst) = (u_int32_t)as_u8(src) << 24; goto CONV_END;
-conv_xxx1_0001: as_u32(dst) = (u_int32_t)as_u8(src); goto CONV_END;
-conv_xxx1_xxx9: as_u8(dst) = as_u8(src) ^ 0x80; goto CONV_END;
-conv_xxx1_xx90: as_u16(dst) = (u_int16_t)(as_u8(src) ^ 0x80) << 8; goto CONV_END;
-conv_xxx1_xx09: as_u16(dst) = (u_int16_t)(as_u8(src) ^ 0x80); goto CONV_END;
-conv_xxx1_x900: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80) << 16; goto CONV_END;
-conv_xxx1_009x: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80) << 8; goto CONV_END;
-conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80) << 24; goto CONV_END;
-conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8(src) ^ 0x80); goto CONV_END;
-conv_xx12_xxx1: as_u8(dst) = as_u16(src) >> 8; goto CONV_END;
-conv_xx12_xx12: as_u16(dst) = as_u16(src); goto CONV_END;
-conv_xx12_xx21: as_u16(dst) = bswap_16(as_u16(src)); goto CONV_END;
-conv_xx12_x120: as_u32(dst) = (u_int32_t)as_u16(src) << 8; goto CONV_END;
-conv_xx12_021x: as_u32(dst) = (u_int32_t)bswap_16(as_u16(src)) << 8; goto CONV_END;
-conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16(src) << 16; goto CONV_END;
-conv_xx12_0021: as_u32(dst) = (u_int32_t)bswap_16(as_u16(src)); goto CONV_END;
-conv_xx12_xxx9: as_u8(dst) = (as_u16(src) >> 8) ^ 0x80; goto CONV_END;
-conv_xx12_xx92: as_u16(dst) = as_u16(src) ^ 0x8000; goto CONV_END;
-conv_xx12_xx29: as_u16(dst) = bswap_16(as_u16(src)) ^ 0x80; goto CONV_END;
-conv_xx12_x920: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x8000) << 8; goto CONV_END;
-conv_xx12_029x: as_u32(dst) = (u_int32_t)(bswap_16(as_u16(src)) ^ 0x80) << 8; goto CONV_END;
-conv_xx12_9200: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x8000) << 16; goto CONV_END;
-conv_xx12_0029: as_u32(dst) = (u_int32_t)(bswap_16(as_u16(src)) ^ 0x80); goto CONV_END;
-conv_xx12_xxx2: as_u8(dst) = as_u16(src) & 0xff; goto CONV_END;
-conv_xx12_x210: as_u32(dst) = (u_int32_t)bswap_16(as_u16(src)) << 8; goto CONV_END;
-conv_xx12_012x: as_u32(dst) = (u_int32_t)as_u16(src) << 8; goto CONV_END;
-conv_xx12_2100: as_u32(dst) = (u_int32_t)bswap_16(as_u16(src)) << 16; goto CONV_END;
-conv_xx12_0012: as_u32(dst) = (u_int32_t)as_u16(src); goto CONV_END;
-conv_xx12_xxxA: as_u8(dst) = (as_u16(src) ^ 0x80) & 0xff; goto CONV_END;
-conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16(src) ^ 0x80); goto CONV_END;
-conv_xx12_xx1A: as_u16(dst) = as_u16(src) ^ 0x80; goto CONV_END;
-conv_xx12_xA10: as_u32(dst) = (u_int32_t)bswap_16(as_u16(src) ^ 0x80) << 8; goto CONV_END;
-conv_xx12_01Ax: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x80) << 8; goto CONV_END;
-conv_xx12_A100: as_u32(dst) = (u_int32_t)bswap_16(as_u16(src) ^ 0x80) << 16; goto CONV_END;
-conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16(src) ^ 0x80); goto CONV_END;
-conv_x123_xxx1: as_u8(dst) = as_u32(src) >> 16; goto CONV_END;
-conv_x123_xx12: as_u16(dst) = as_u32(src) >> 8; goto CONV_END;
-conv_x123_xx21: as_u16(dst) = bswap_16(as_u32(src) >> 8); goto CONV_END;
-conv_x123_x123: as_u32(dst) = as_u32(src); goto CONV_END;
-conv_x123_321x: as_u32(dst) = bswap_32(as_u32(src)); goto CONV_END;
-conv_x123_1230: as_u32(dst) = as_u32(src) << 8; goto CONV_END;
-conv_x123_0321: as_u32(dst) = bswap_32(as_u32(src)) >> 8; goto CONV_END;
-conv_x123_xxx9: as_u8(dst) = (as_u32(src) >> 16) ^ 0x80; goto CONV_END;
-conv_x123_xx92: as_u16(dst) = (as_u32(src) >> 8) ^ 0x8000; goto CONV_END;
-conv_x123_xx29: as_u16(dst) = bswap_16(as_u32(src) >> 8) ^ 0x80; goto CONV_END;
-conv_x123_x923: as_u32(dst) = as_u32(src) ^ 0x800000; goto CONV_END;
-conv_x123_329x: as_u32(dst) = bswap_32(as_u32(src)) ^ 0x8000; goto CONV_END;
-conv_x123_9230: as_u32(dst) = (as_u32(src) ^ 0x800000) << 8; goto CONV_END;
-conv_x123_0329: as_u32(dst) = (bswap_32(as_u32(src)) >> 8) ^ 0x80; goto CONV_END;
-conv_123x_xxx3: as_u8(dst) = (as_u32(src) >> 8) & 0xff; goto CONV_END;
-conv_123x_xx32: as_u16(dst) = bswap_16(as_u32(src) >> 8); goto CONV_END;
-conv_123x_xx23: as_u16(dst) = (as_u32(src) >> 8) & 0xffff; goto CONV_END;
-conv_123x_x321: as_u32(dst) = bswap_32(as_u32(src)); goto CONV_END;
-conv_123x_123x: as_u32(dst) = as_u32(src); goto CONV_END;
-conv_123x_3210: as_u32(dst) = bswap_32(as_u32(src)) << 8; goto CONV_END;
-conv_123x_0123: as_u32(dst) = as_u32(src) >> 8; goto CONV_END;
-conv_123x_xxxB: as_u8(dst) = ((as_u32(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
-conv_123x_xxB2: as_u16(dst) = bswap_16((as_u32(src) >> 8) ^ 0x80); goto CONV_END;
-conv_123x_xx2B: as_u16(dst) = ((as_u32(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
-conv_123x_xB21: as_u32(dst) = bswap_32(as_u32(src)) ^ 0x800000; goto CONV_END;
-conv_123x_12Bx: as_u32(dst) = as_u32(src) ^ 0x8000; goto CONV_END;
-conv_123x_B210: as_u32(dst) = bswap_32(as_u32(src) ^ 0x8000) << 8; goto CONV_END;
-conv_123x_012B: as_u32(dst) = (as_u32(src) >> 8) ^ 0x80; goto CONV_END;
-conv_1234_xxx1: as_u8(dst) = as_u32(src) >> 24; goto CONV_END;
-conv_1234_xx12: as_u16(dst) = as_u32(src) >> 16; goto CONV_END;
-conv_1234_xx21: as_u16(dst) = bswap_16(as_u32(src) >> 16); goto CONV_END;
-conv_1234_x123: as_u32(dst) = as_u32(src) >> 8; goto CONV_END;
-conv_1234_321x: as_u32(dst) = bswap_32(as_u32(src)) << 8; goto CONV_END;
-conv_1234_1234: as_u32(dst) = as_u32(src); goto CONV_END;
-conv_1234_4321: as_u32(dst) = bswap_32(as_u32(src)); goto CONV_END;
-conv_1234_xxx9: as_u8(dst) = (as_u32(src) >> 24) ^ 0x80; goto CONV_END;
-conv_1234_xx92: as_u16(dst) = (as_u32(src) >> 16) ^ 0x8000; goto CONV_END;
-conv_1234_xx29: as_u16(dst) = bswap_16(as_u32(src) >> 16) ^ 0x80; goto CONV_END;
-conv_1234_x923: as_u32(dst) = (as_u32(src) >> 8) ^ 0x800000; goto CONV_END;
-conv_1234_329x: as_u32(dst) = (bswap_32(as_u32(src)) ^ 0x80) << 8; goto CONV_END;
-conv_1234_9234: as_u32(dst) = as_u32(src) ^ 0x80000000; goto CONV_END;
-conv_1234_4329: as_u32(dst) = bswap_32(as_u32(src)) ^ 0x80; goto CONV_END;
-conv_1234_xxx4: as_u8(dst) = as_u32(src) & 0xff; goto CONV_END;
-conv_1234_xx43: as_u16(dst) = bswap_16(as_u32(src)); goto CONV_END;
-conv_1234_xx34: as_u16(dst) = as_u32(src) & 0xffff; goto CONV_END;
-conv_1234_x432: as_u32(dst) = bswap_32(as_u32(src)) >> 8; goto CONV_END;
-conv_1234_234x: as_u32(dst) = as_u32(src) << 8; goto CONV_END;
-conv_1234_xxxC: as_u8(dst) = (as_u32(src) & 0xff) ^ 0x80; goto CONV_END;
-conv_1234_xxC3: as_u16(dst) = bswap_16(as_u32(src) ^ 0x80); goto CONV_END;
-conv_1234_xx3C: as_u16(dst) = (as_u32(src) & 0xffff) ^ 0x80; goto CONV_END;
-conv_1234_xC32: as_u32(dst) = (bswap_32(as_u32(src)) >> 8) ^ 0x800000; goto CONV_END;
-conv_1234_23Cx: as_u32(dst) = (as_u32(src) ^ 0x80) << 8; goto CONV_END;
-conv_1234_C321: as_u32(dst) = bswap_32(as_u32(src) ^ 0x80); goto CONV_END;
-conv_1234_123C: as_u32(dst) = as_u32(src) ^ 0x80; goto CONV_END;
+conv_xxx1_xxx1: as_u8(dst) = as_u8c(src); goto CONV_END;
+conv_xxx1_xx10: as_u16(dst) = (u_int16_t)as_u8c(src) << 8; goto CONV_END;
+conv_xxx1_xx01: as_u16(dst) = (u_int16_t)as_u8c(src); goto CONV_END;
+conv_xxx1_x100: as_u32(dst) = (u_int32_t)as_u8c(src) << 16; goto CONV_END;
+conv_xxx1_001x: as_u32(dst) = (u_int32_t)as_u8c(src) << 8; goto CONV_END;
+conv_xxx1_1000: as_u32(dst) = (u_int32_t)as_u8c(src) << 24; goto CONV_END;
+conv_xxx1_0001: as_u32(dst) = (u_int32_t)as_u8c(src); goto CONV_END;
+conv_xxx1_xxx9: as_u8(dst) = as_u8c(src) ^ 0x80; goto CONV_END;
+conv_xxx1_xx90: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END;
+conv_xxx1_xx09: as_u16(dst) = (u_int16_t)(as_u8c(src) ^ 0x80); goto CONV_END;
+conv_xxx1_x900: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 16; goto CONV_END;
+conv_xxx1_009x: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 8; goto CONV_END;
+conv_xxx1_9000: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto CONV_END;
+conv_xxx1_0009: as_u32(dst) = (u_int32_t)(as_u8c(src) ^ 0x80); goto CONV_END;
+conv_xx12_xxx1: as_u8(dst) = as_u16c(src) >> 8; goto CONV_END;
+conv_xx12_xx12: as_u16(dst) = as_u16c(src); goto CONV_END;
+conv_xx12_xx21: as_u16(dst) = bswap_16(as_u16c(src)); goto CONV_END;
+conv_xx12_x120: as_u32(dst) = (u_int32_t)as_u16c(src) << 8; goto CONV_END;
+conv_xx12_021x: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 8; goto CONV_END;
+conv_xx12_1200: as_u32(dst) = (u_int32_t)as_u16c(src) << 16; goto CONV_END;
+conv_xx12_0021: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)); goto CONV_END;
+conv_xx12_xxx9: as_u8(dst) = (as_u16c(src) >> 8) ^ 0x80; goto CONV_END;
+conv_xx12_xx92: as_u16(dst) = as_u16c(src) ^ 0x8000; goto CONV_END;
+conv_xx12_xx29: as_u16(dst) = bswap_16(as_u16c(src)) ^ 0x80; goto CONV_END;
+conv_xx12_x920: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x8000) << 8; goto CONV_END;
+conv_xx12_029x: as_u32(dst) = (u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80) << 8; goto CONV_END;
+conv_xx12_9200: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto CONV_END;
+conv_xx12_0029: as_u32(dst) = (u_int32_t)(bswap_16(as_u16c(src)) ^ 0x80); goto CONV_END;
+conv_xx12_xxx2: as_u8(dst) = as_u16c(src) & 0xff; goto CONV_END;
+conv_xx12_x210: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 8; goto CONV_END;
+conv_xx12_012x: as_u32(dst) = (u_int32_t)as_u16c(src) << 8; goto CONV_END;
+conv_xx12_2100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto CONV_END;
+conv_xx12_0012: as_u32(dst) = (u_int32_t)as_u16c(src); goto CONV_END;
+conv_xx12_xxxA: as_u8(dst) = (as_u16c(src) ^ 0x80) & 0xff; goto CONV_END;
+conv_xx12_xxA1: as_u16(dst) = bswap_16(as_u16c(src) ^ 0x80); goto CONV_END;
+conv_xx12_xx1A: as_u16(dst) = as_u16c(src) ^ 0x80; goto CONV_END;
+conv_xx12_xA10: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 8; goto CONV_END;
+conv_xx12_01Ax: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80) << 8; goto CONV_END;
+conv_xx12_A100: as_u32(dst) = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto CONV_END;
+conv_xx12_001A: as_u32(dst) = (u_int32_t)(as_u16c(src) ^ 0x80); goto CONV_END;
+conv_x123_xxx1: as_u8(dst) = as_u32c(src) >> 16; goto CONV_END;
+conv_x123_xx12: as_u16(dst) = as_u32c(src) >> 8; goto CONV_END;
+conv_x123_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
+conv_x123_x123: as_u32(dst) = as_u32c(src); goto CONV_END;
+conv_x123_321x: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
+conv_x123_1230: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
+conv_x123_0321: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
+conv_x123_xxx9: as_u8(dst) = (as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
+conv_x123_xx92: as_u16(dst) = (as_u32c(src) >> 8) ^ 0x8000; goto CONV_END;
+conv_x123_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
+conv_x123_x923: as_u32(dst) = as_u32c(src) ^ 0x800000; goto CONV_END;
+conv_x123_329x: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x8000; goto CONV_END;
+conv_x123_9230: as_u32(dst) = (as_u32c(src) ^ 0x800000) << 8; goto CONV_END;
+conv_x123_0329: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x80; goto CONV_END;
+conv_123x_xxx3: as_u8(dst) = (as_u32c(src) >> 8) & 0xff; goto CONV_END;
+conv_123x_xx32: as_u16(dst) = bswap_16(as_u32c(src) >> 8); goto CONV_END;
+conv_123x_xx23: as_u16(dst) = (as_u32c(src) >> 8) & 0xffff; goto CONV_END;
+conv_123x_x321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
+conv_123x_123x: as_u32(dst) = as_u32c(src); goto CONV_END;
+conv_123x_3210: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
+conv_123x_0123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
+conv_123x_xxxB: as_u8(dst) = ((as_u32c(src) >> 8) & 0xff) ^ 0x80; goto CONV_END;
+conv_123x_xxB2: as_u16(dst) = bswap_16((as_u32c(src) >> 8) ^ 0x80); goto CONV_END;
+conv_123x_xx2B: as_u16(dst) = ((as_u32c(src) >> 8) & 0xffff) ^ 0x80; goto CONV_END;
+conv_123x_xB21: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x800000; goto CONV_END;
+conv_123x_12Bx: as_u32(dst) = as_u32c(src) ^ 0x8000; goto CONV_END;
+conv_123x_B210: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x8000) << 8; goto CONV_END;
+conv_123x_012B: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x80; goto CONV_END;
+conv_1234_xxx1: as_u8(dst) = as_u32c(src) >> 24; goto CONV_END;
+conv_1234_xx12: as_u16(dst) = as_u32c(src) >> 16; goto CONV_END;
+conv_1234_xx21: as_u16(dst) = bswap_16(as_u32c(src) >> 16); goto CONV_END;
+conv_1234_x123: as_u32(dst) = as_u32c(src) >> 8; goto CONV_END;
+conv_1234_321x: as_u32(dst) = bswap_32(as_u32c(src)) << 8; goto CONV_END;
+conv_1234_1234: as_u32(dst) = as_u32c(src); goto CONV_END;
+conv_1234_4321: as_u32(dst) = bswap_32(as_u32c(src)); goto CONV_END;
+conv_1234_xxx9: as_u8(dst) = (as_u32c(src) >> 24) ^ 0x80; goto CONV_END;
+conv_1234_xx92: as_u16(dst) = (as_u32c(src) >> 16) ^ 0x8000; goto CONV_END;
+conv_1234_xx29: as_u16(dst) = bswap_16(as_u32c(src) >> 16) ^ 0x80; goto CONV_END;
+conv_1234_x923: as_u32(dst) = (as_u32c(src) >> 8) ^ 0x800000; goto CONV_END;
+conv_1234_329x: as_u32(dst) = (bswap_32(as_u32c(src)) ^ 0x80) << 8; goto CONV_END;
+conv_1234_9234: as_u32(dst) = as_u32c(src) ^ 0x80000000; goto CONV_END;
+conv_1234_4329: as_u32(dst) = bswap_32(as_u32c(src)) ^ 0x80; goto CONV_END;
+conv_1234_xxx4: as_u8(dst) = as_u32c(src) & 0xff; goto CONV_END;
+conv_1234_xx43: as_u16(dst) = bswap_16(as_u32c(src)); goto CONV_END;
+conv_1234_xx34: as_u16(dst) = as_u32c(src) & 0xffff; goto CONV_END;
+conv_1234_x432: as_u32(dst) = bswap_32(as_u32c(src)) >> 8; goto CONV_END;
+conv_1234_234x: as_u32(dst) = as_u32c(src) << 8; goto CONV_END;
+conv_1234_xxxC: as_u8(dst) = (as_u32c(src) & 0xff) ^ 0x80; goto CONV_END;
+conv_1234_xxC3: as_u16(dst) = bswap_16(as_u32c(src) ^ 0x80); goto CONV_END;
+conv_1234_xx3C: as_u16(dst) = (as_u32c(src) & 0xffff) ^ 0x80; goto CONV_END;
+conv_1234_xC32: as_u32(dst) = (bswap_32(as_u32c(src)) >> 8) ^ 0x800000; goto CONV_END;
+conv_1234_23Cx: as_u32(dst) = (as_u32c(src) ^ 0x80) << 8; goto CONV_END;
+conv_1234_C321: as_u32(dst) = bswap_32(as_u32c(src) ^ 0x80); goto CONV_END;
+conv_1234_123C: as_u32(dst) = as_u32c(src) ^ 0x80; goto CONV_END;
}
#endif
#ifdef GET16_END
while(0) {
-get16_1_10: sample = (u_int16_t)as_u8(src) << 8; goto GET16_END;
-get16_1_90: sample = (u_int16_t)(as_u8(src) ^ 0x80) << 8; goto GET16_END;
-get16_12_12: sample = as_u16(src); goto GET16_END;
-get16_12_92: sample = as_u16(src) ^ 0x8000; goto GET16_END;
-get16_12_21: sample = bswap_16(as_u16(src)); goto GET16_END;
-get16_12_A1: sample = bswap_16(as_u16(src) ^ 0x80); goto GET16_END;
-get16_0123_12: sample = as_u32(src) >> 8; goto GET16_END;
-get16_0123_92: sample = (as_u32(src) >> 8) ^ 0x8000; goto GET16_END;
-get16_1230_32: sample = bswap_16(as_u32(src) >> 8); goto GET16_END;
-get16_1230_B2: sample = bswap_16((as_u32(src) >> 8) ^ 0x8000); goto GET16_END;
-get16_1234_12: sample = as_u32(src) >> 16; goto GET16_END;
-get16_1234_92: sample = (as_u32(src) >> 16) ^ 0x8000; goto GET16_END;
-get16_1234_43: sample = bswap_16(as_u32(src)); goto GET16_END;
-get16_1234_C3: sample = bswap_16(as_u32(src) ^ 0x80); goto GET16_END;
+get16_1_10: sample = (u_int16_t)as_u8c(src) << 8; goto GET16_END;
+get16_1_90: sample = (u_int16_t)(as_u8c(src) ^ 0x80) << 8; goto GET16_END;
+get16_12_12: sample = as_u16c(src); goto GET16_END;
+get16_12_92: sample = as_u16c(src) ^ 0x8000; goto GET16_END;
+get16_12_21: sample = bswap_16(as_u16c(src)); goto GET16_END;
+get16_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GET16_END;
+get16_0123_12: sample = as_u32c(src) >> 8; goto GET16_END;
+get16_0123_92: sample = (as_u32c(src) >> 8) ^ 0x8000; goto GET16_END;
+get16_1230_32: sample = bswap_16(as_u32c(src) >> 8); goto GET16_END;
+get16_1230_B2: sample = bswap_16((as_u32c(src) >> 8) ^ 0x8000); goto GET16_END;
+get16_1234_12: sample = as_u32c(src) >> 16; goto GET16_END;
+get16_1234_92: sample = (as_u32c(src) >> 16) ^ 0x8000; goto GET16_END;
+get16_1234_43: sample = bswap_16(as_u32c(src)); goto GET16_END;
+get16_1234_C3: sample = bswap_16(as_u32c(src) ^ 0x80); goto GET16_END;
}
#endif
#ifdef GET32_END
while (0) {
-get32_1_1000: sample = (u_int32_t)as_u8(src) << 24; goto GET32_END;
-get32_1_9000: sample = (u_int32_t)(as_u8(src) ^ 0x80) << 24; goto GET32_END;
-get32_12_1200: sample = (u_int32_t)as_u16(src) << 16; goto GET32_END;
-get32_12_9200: sample = (u_int32_t)(as_u16(src) ^ 0x8000) << 16; goto GET32_END;
-get32_12_2100: sample = (u_int32_t)bswap_16(as_u16(src)) << 16; goto GET32_END;
-get32_12_A100: sample = (u_int32_t)bswap_16(as_u16(src) ^ 0x80) << 16; goto GET32_END;
-get32_0123_1230: sample = as_u32(src) << 8; goto GET32_END;
-get32_0123_9230: sample = (as_u32(src) << 8) ^ 0x80000000; goto GET32_END;
-get32_1230_3210: sample = bswap_32(as_u32(src) >> 8); goto GET32_END;
-get32_1230_B210: sample = bswap_32((as_u32(src) >> 8) ^ 0x80); goto GET32_END;
-get32_1234_1234: sample = as_u32(src); goto GET32_END;
-get32_1234_9234: sample = as_u32(src) ^ 0x80000000; goto GET32_END;
-get32_1234_4321: sample = bswap_32(as_u32(src)); goto GET32_END;
-get32_1234_C321: sample = bswap_32(as_u32(src) ^ 0x80); goto GET32_END;
+get32_1_1000: sample = (u_int32_t)as_u8c(src) << 24; goto GET32_END;
+get32_1_9000: sample = (u_int32_t)(as_u8c(src) ^ 0x80) << 24; goto GET32_END;
+get32_12_1200: sample = (u_int32_t)as_u16c(src) << 16; goto GET32_END;
+get32_12_9200: sample = (u_int32_t)(as_u16c(src) ^ 0x8000) << 16; goto GET32_END;
+get32_12_2100: sample = (u_int32_t)bswap_16(as_u16c(src)) << 16; goto GET32_END;
+get32_12_A100: sample = (u_int32_t)bswap_16(as_u16c(src) ^ 0x80) << 16; goto GET32_END;
+get32_0123_1230: sample = as_u32c(src) << 8; goto GET32_END;
+get32_0123_9230: sample = (as_u32c(src) << 8) ^ 0x80000000; goto GET32_END;
+get32_1230_3210: sample = bswap_32(as_u32c(src) >> 8); goto GET32_END;
+get32_1230_B210: sample = bswap_32((as_u32c(src) >> 8) ^ 0x80); goto GET32_END;
+get32_1234_1234: sample = as_u32c(src); goto GET32_END;
+get32_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GET32_END;
+get32_1234_4321: sample = bswap_32(as_u32c(src)); goto GET32_END;
+get32_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GET32_END;
}
#endif
#ifdef GETU_END
while (0) {
-getu_1_1: sample = as_u8(src); goto GETU_END;
-getu_1_9: sample = as_u8(src) ^ 0x80; goto GETU_END;
-getu_12_12: sample = as_u16(src); goto GETU_END;
-getu_12_92: sample = as_u16(src) ^ 0x8000; goto GETU_END;
-getu_12_21: sample = bswap_16(as_u16(src)); goto GETU_END;
-getu_12_A1: sample = bswap_16(as_u16(src) ^ 0x80); goto GETU_END;
-getu_0123_0123: sample = as_u32(src); goto GETU_END;
-getu_0123_0923: sample = (as_u32(src) ^ 0x800000); goto GETU_END;
-getu_1230_0321: sample = bswap_32(as_u32(src)); goto GETU_END;
-getu_1230_0B21: sample = bswap_32(as_u32(src) ^ 0x8000); goto GETU_END;
-getu_1234_1234: sample = as_u32(src); goto GETU_END;
-getu_1234_9234: sample = as_u32(src) ^ 0x80000000; goto GETU_END;
-getu_1234_4321: sample = bswap_32(as_u32(src)); goto GETU_END;
-getu_1234_C321: sample = bswap_32(as_u32(src) ^ 0x80); goto GETU_END;
+getu_1_1: sample = as_u8c(src); goto GETU_END;
+getu_1_9: sample = as_u8c(src) ^ 0x80; goto GETU_END;
+getu_12_12: sample = as_u16c(src); goto GETU_END;
+getu_12_92: sample = as_u16c(src) ^ 0x8000; goto GETU_END;
+getu_12_21: sample = bswap_16(as_u16c(src)); goto GETU_END;
+getu_12_A1: sample = bswap_16(as_u16c(src) ^ 0x80); goto GETU_END;
+getu_0123_0123: sample = as_u32c(src); goto GETU_END;
+getu_0123_0923: sample = (as_u32c(src) ^ 0x800000); goto GETU_END;
+getu_1230_0321: sample = bswap_32(as_u32c(src)); goto GETU_END;
+getu_1230_0B21: sample = bswap_32(as_u32c(src) ^ 0x8000); goto GETU_END;
+getu_1234_1234: sample = as_u32c(src); goto GETU_END;
+getu_1234_9234: sample = as_u32c(src) ^ 0x80000000; goto GETU_END;
+getu_1234_4321: sample = bswap_32(as_u32c(src)); goto GETU_END;
+getu_1234_C321: sample = bswap_32(as_u32c(src) ^ 0x80); goto GETU_END;
}
#endif
snd_config_t *rawmidi_conf, *conf, *type_conf;
snd_config_iterator_t i, next;
snd_rawmidi_params_t params;
- const char *lib = NULL, *open = NULL;
- int (*open_func)(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
- const char *name, snd_config_t *conf, int mode);
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_rawmidi_t **, snd_rawmidi_t **,
+ const char *, snd_config_t *, int);
void *h;
const char *name1;
assert((inputp || outputp) && name);
continue;
}
if (strcmp(id, "open") == 0) {
- err = snd_config_get_string(n, &open);
+ err = snd_config_get_string(n, &open_name);
if (err < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
return -EINVAL;
}
}
- if (!open) {
- open = buf;
+ if (!open_name) {
+ open_name = buf;
snprintf(buf, sizeof(buf), "_snd_rawmidi_%s_open", str);
}
if (!lib)
SNDERR("Cannot open shared library %s", lib);
return -ENOENT;
}
- open_func = dlsym(h, open);
+ open_func = dlsym(h, open_name);
if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open, lib);
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
dlclose(h);
return -ENXIO;
}
int err;
snd_config_t *seq_conf, *conf, *type_conf;
snd_config_iterator_t i, next;
- const char *lib = NULL, *open = NULL;
- int (*open_func)(snd_seq_t **seqp, const char *name, snd_config_t *conf,
- int streams, int mode);
+ const char *lib = NULL, *open_name = NULL;
+ int (*open_func)(snd_seq_t **, const char *, snd_config_t *,
+ int, int);
void *h;
const char *name1;
assert(seqp && name);
continue;
}
if (strcmp(id, "open") == 0) {
- err = snd_config_get_string(n, &open);
+ err = snd_config_get_string(n, &open_name);
if (err < 0) {
SNDERR("Invalid type for %s", id);
return -EINVAL;
return -EINVAL;
}
}
- if (!open) {
- open = buf;
+ if (!open_name) {
+ open_name = buf;
snprintf(buf, sizeof(buf), "_snd_seq_%s_open", str);
}
if (!lib)
SNDERR("Cannot open shared library %s", lib);
return -ENOENT;
}
- open_func = dlsym(h, open);
+ open_func = dlsym(h, open_name);
if (!open_func) {
- SNDERR("symbol %s is not defined inside %s", open, lib);
+ SNDERR("symbol %s is not defined inside %s", open_name, lib);
dlclose(h);
return -ENXIO;
}
/*
* returns the file descriptor of the client
*/
-int _snd_seq_poll_descriptor(snd_seq_t *seq)
-{
- assert(seq);
- return seq->poll_fd;
-}
-
int snd_seq_poll_descriptors_count(snd_seq_t *seq, short events)
{
int result = 0;
memcpy(seq->tmpbuf + 1, ev->data.ext.ptr, ev->data.ext.len);
buf = seq->tmpbuf;
}
-
- return seq->ops->write(seq, buf, len);
+ return seq->ops->write(seq, buf, (size_t) len);
}
/*
/* midi status */
struct snd_midi_event {
- int qlen; /* queue length */
- int read; /* chars read */
+ size_t qlen; /* queue length */
+ size_t read; /* chars read */
int type; /* current event type */
unsigned char lastcmd;
- int bufsize;
+ size_t bufsize;
unsigned char *buf; /* input buffer */
};
* new/delete record
*/
-int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev)
+int snd_midi_event_new(size_t bufsize, snd_midi_event_t **rdev)
{
snd_midi_event_t *dev;
/*
* resize buffer
*/
-int snd_midi_event_resize_buffer(snd_midi_event_t *dev, int bufsize)
+int snd_midi_event_resize_buffer(snd_midi_event_t *dev, size_t bufsize)
{
unsigned char *new_buf, *old_buf;
/* queued on real-time */
void snd_seq_ev_schedule_real(snd_seq_event_t *ev, int q, int relative,
- snd_seq_real_time_t *time)
+ snd_seq_real_time_t *_time)
{
ev->flags &= ~( SND_SEQ_TIME_STAMP_MASK | SND_SEQ_TIME_MODE_MASK);
ev->flags |= SND_SEQ_TIME_STAMP_REAL;
ev->flags |= relative ? SND_SEQ_TIME_MODE_REL : SND_SEQ_TIME_MODE_ABS;
- ev->time.time = *time;
+ ev->time.time = *_time;
ev->queue = q;
}
return res;
}
-int _snd_timer_poll_descriptor(snd_timer_t *handle)
-{
- snd_timer_t *tmr;
-
- tmr = handle;
- if (!tmr)
- return -EINVAL;
- return tmr->fd;
-}
-
int snd_timer_poll_descriptors_count(snd_timer_t *timer)
{
assert(timer);