mirror of
https://github.com/alsa-project/alsa-lib.git
synced 2025-10-29 05:40:25 -04:00
Lot of cleanings with the help of gcc3
This commit is contained in:
parent
ce8275b943
commit
5b50ec848a
59 changed files with 669 additions and 667 deletions
|
|
@ -53,7 +53,7 @@ char *command;
|
|||
|
||||
#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;
|
||||
|
|
@ -81,7 +81,7 @@ int make_local_socket(const char *filename)
|
|||
return sock;
|
||||
}
|
||||
|
||||
int make_inet_socket(int port)
|
||||
static int make_inet_socket(int port)
|
||||
{
|
||||
struct sockaddr_in addr;
|
||||
int sock;
|
||||
|
|
@ -106,7 +106,7 @@ int make_inet_socket(int port)
|
|||
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));
|
||||
|
|
@ -131,7 +131,7 @@ int send_fd(int socket, void *data, size_t len, int fd)
|
|||
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;
|
||||
|
|
@ -150,7 +150,7 @@ struct waiter {
|
|||
};
|
||||
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];
|
||||
|
|
@ -165,7 +165,7 @@ void add_waiter(int fd, unsigned short events, waiter_handler_t handler,
|
|||
pollfds_count++;
|
||||
}
|
||||
|
||||
void del_waiter(int fd)
|
||||
static void del_waiter(int fd)
|
||||
{
|
||||
waiter_t *w = &waiters[fd];
|
||||
unsigned int k;
|
||||
|
|
@ -243,7 +243,8 @@ typedef struct {
|
|||
} 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];
|
||||
|
|
@ -265,8 +266,9 @@ int pcm_handler(waiter_t *waiter, unsigned short events)
|
|||
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;
|
||||
|
|
@ -301,7 +303,7 @@ int pcm_shm_open(client_t *client, int *cookie)
|
|||
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
@ -326,7 +328,7 @@ int pcm_shm_close(client_t *client)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int shm_ack(client_t *client)
|
||||
static int shm_ack(client_t *client)
|
||||
{
|
||||
struct pollfd pfd;
|
||||
int err;
|
||||
|
|
@ -341,7 +343,7 @@ int shm_ack(client_t *client)
|
|||
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;
|
||||
|
|
@ -356,7 +358,7 @@ int shm_ack_fd(client_t *client, int fd)
|
|||
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];
|
||||
|
|
@ -476,7 +478,7 @@ transport_ops_t pcm_shm_ops = {
|
|||
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];
|
||||
|
|
@ -493,7 +495,7 @@ int ctl_handler(waiter_t *waiter, unsigned short events)
|
|||
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;
|
||||
|
|
@ -530,7 +532,7 @@ int ctl_shm_open(client_t *client, int *cookie)
|
|||
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
@ -555,7 +557,7 @@ int ctl_shm_close(client_t *client)
|
|||
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];
|
||||
|
|
@ -644,7 +646,7 @@ transport_ops_t ctl_shm_ops = {
|
|||
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;
|
||||
|
|
@ -718,7 +720,7 @@ int snd_client_open(client_t *client)
|
|||
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)
|
||||
|
|
@ -732,7 +734,7 @@ int client_poll_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED
|
|||
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) {
|
||||
|
|
@ -750,7 +752,7 @@ int client_ctrl_handler(waiter_t *waiter, unsigned short events)
|
|||
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;
|
||||
|
|
@ -802,7 +804,7 @@ int inet_pending_handler(waiter_t *waiter, unsigned short events)
|
|||
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);
|
||||
|
|
@ -821,7 +823,7 @@ int local_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
|
|||
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);
|
||||
|
|
@ -839,7 +841,7 @@ int inet_handler(waiter_t *waiter, unsigned short events ATTRIBUTE_UNUSED)
|
|||
return 0;
|
||||
}
|
||||
|
||||
int server(const char *sockname, int port)
|
||||
static int server(const char *sockname, int port)
|
||||
{
|
||||
int err;
|
||||
unsigned int k;
|
||||
|
|
@ -854,8 +856,8 @@ int server(const char *sockname, int port)
|
|||
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);
|
||||
|
|
@ -922,7 +924,7 @@ int server(const char *sockname, int port)
|
|||
}
|
||||
|
||||
|
||||
void usage()
|
||||
static void usage(void)
|
||||
{
|
||||
fprintf(stderr, "\
|
||||
Usage: %s [OPTIONS] server
|
||||
|
|
@ -931,8 +933,6 @@ Usage: %s [OPTIONS] server
|
|||
", command);
|
||||
}
|
||||
|
||||
extern int is_local(struct hostent *hent);
|
||||
|
||||
int main(int argc, char **argv)
|
||||
{
|
||||
static struct option long_options[] = {
|
||||
|
|
@ -941,7 +941,7 @@ int main(int argc, char **argv)
|
|||
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;
|
||||
|
|
@ -991,7 +991,7 @@ int main(int argc, char **argv)
|
|||
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;
|
||||
|
|
@ -1022,10 +1022,10 @@ int main(int argc, char **argv)
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -18,9 +18,13 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#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,
|
||||
|
|
|
|||
|
|
@ -20,9 +20,6 @@ typedef struct _snd_config_iterator *snd_config_iterator_t;
|
|||
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);
|
||||
|
|
@ -72,7 +69,7 @@ snd_config_type_t snd_config_get_type(snd_config_t *config);
|
|||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -257,7 +257,6 @@ int snd_defaults_pcm_device(void);
|
|||
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);
|
||||
|
|
@ -327,6 +326,8 @@ extern "C" {
|
|||
*/
|
||||
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
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
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
|
||||
|
|
@ -36,7 +36,7 @@ void snd_ctl_elem_id_set_name(snd_ctl_elem_id_t *obj, const char *val);
|
|||
|
||||
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
|
||||
|
|
@ -62,7 +62,7 @@ const char *snd_ctl_card_info_get_mixerid(const snd_ctl_card_info_t *obj);
|
|||
|
||||
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
|
||||
|
|
@ -74,7 +74,7 @@ void snd_ctl_event_copy(snd_ctl_event_t *dst, const snd_ctl_event_t *src);
|
|||
|
||||
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
|
||||
|
|
@ -104,7 +104,7 @@ const char *snd_ctl_elem_list_get_name(const snd_ctl_elem_list_t *obj, unsigned
|
|||
|
||||
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
|
||||
|
|
@ -170,7 +170,7 @@ void snd_ctl_elem_info_set_name(snd_ctl_elem_info_t *obj, const char *val);
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -36,7 +36,7 @@ int snd_hwdep_close(snd_hwdep_t *hwdep);
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -15,12 +15,13 @@ extern "C" {
|
|||
#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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -37,6 +37,7 @@ int snd_mixer_detach(snd_mixer_t *mixer, const char *name);
|
|||
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);
|
||||
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -14,8 +14,8 @@ typedef enum _snd_output_type {
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -291,7 +291,6 @@ extern "C" {
|
|||
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);
|
||||
|
|
@ -327,6 +326,7 @@ int snd_pcm_wait(snd_pcm_t *pcm, int timeout);
|
|||
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);
|
||||
|
|
@ -382,10 +382,11 @@ snd_pcm_sframes_t snd_pcm_mmap_writen(snd_pcm_t *pcm, void **bufs, snd_pcm_ufram
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -4,7 +4,7 @@ extern "C" {
|
|||
|
||||
|
||||
|
||||
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
|
||||
|
|
@ -21,7 +21,7 @@ int snd_pcm_access_mask_test(const snd_pcm_access_mask_t *mask, snd_pcm_access_t
|
|||
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
|
||||
|
|
@ -37,7 +37,7 @@ int snd_pcm_format_mask_test(const snd_pcm_format_mask_t *mask, snd_pcm_format_t
|
|||
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
|
||||
|
|
@ -53,7 +53,7 @@ int snd_pcm_subformat_mask_test(const snd_pcm_subformat_mask_t *mask, snd_pcm_su
|
|||
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
|
||||
|
|
@ -182,7 +182,7 @@ unsigned int snd_pcm_hw_params_set_tick_time_near(snd_pcm_t *pcm, snd_pcm_hw_par
|
|||
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
|
||||
|
|
@ -221,7 +221,7 @@ snd_pcm_uframes_t snd_pcm_sw_params_get_silence_threshold(const snd_pcm_sw_param
|
|||
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
|
||||
|
|
@ -243,7 +243,7 @@ snd_pcm_uframes_t snd_pcm_status_get_avail(const snd_pcm_status_t *obj);
|
|||
|
||||
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
|
||||
|
|
|
|||
|
|
@ -49,7 +49,7 @@ int snd_rawmidi_close(snd_rawmidi_t *rmidi);
|
|||
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
|
||||
|
|
@ -72,7 +72,7 @@ void snd_rawmidi_info_set_device(snd_rawmidi_info_t *obj, unsigned int val);
|
|||
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
|
||||
|
|
@ -89,7 +89,7 @@ int snd_rawmidi_params_set_no_active_sensing(snd_rawmidi_t *rmidi, snd_rawmidi_p
|
|||
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
|
||||
|
|
@ -101,6 +101,7 @@ void snd_rawmidi_status_copy(snd_rawmidi_status_t *dst, const snd_rawmidi_status
|
|||
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);
|
||||
|
|
@ -108,6 +109,7 @@ ssize_t snd_rawmidi_write(snd_rawmidi_t *rmidi, const void *buffer, size_t size)
|
|||
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
|
||||
}
|
||||
|
|
|
|||
|
|
@ -368,17 +368,16 @@ int snd_seq_add_sync_std_master(snd_seq_t *seq, int queue, snd_seq_addr_t *dest,
|
|||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -10,8 +10,8 @@ typedef struct snd_midi_event snd_midi_event_t;
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ void snd_seq_ev_schedule_tick(snd_seq_event_t *ev, int q, int relative,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -382,7 +382,7 @@ static int _snd_config_search(snd_config_t *config, const char *id, int len, snd
|
|||
} 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;
|
||||
}
|
||||
|
|
@ -581,7 +581,7 @@ static int parse_defs(snd_config_t *father, input_t *input)
|
|||
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) {
|
||||
|
|
@ -800,7 +800,7 @@ int snd_config_load(snd_config_t *config, snd_input_t *in)
|
|||
fd = input.current;
|
||||
if (err < 0) {
|
||||
if (input.error < 0) {
|
||||
char *str;
|
||||
const char *str;
|
||||
switch (input.error) {
|
||||
case UNTERMINATED_STRING:
|
||||
str = "Unterminated string";
|
||||
|
|
|
|||
|
|
@ -372,8 +372,8 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
|
|||
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);
|
||||
|
|
@ -423,7 +423,7 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
|
|||
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;
|
||||
|
|
@ -433,7 +433,7 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
|
|||
}
|
||||
}
|
||||
if (!open) {
|
||||
open = buf;
|
||||
open_name = buf;
|
||||
snprintf(buf, sizeof(buf), "_snd_ctl_%s_open", str);
|
||||
}
|
||||
if (!lib)
|
||||
|
|
@ -443,9 +443,9 @@ int snd_ctl_open(snd_ctl_t **ctlp, const char *name, int mode)
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -80,4 +80,4 @@ struct _snd_hctl {
|
|||
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -40,8 +40,6 @@ typedef struct {
|
|||
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;
|
||||
|
|
@ -402,7 +400,7 @@ static int make_inet_socket(const char *host, int port)
|
|||
}
|
||||
#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;
|
||||
|
|
@ -417,9 +415,9 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket,
|
|||
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;
|
||||
|
|
@ -470,7 +468,7 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket,
|
|||
goto _err;
|
||||
}
|
||||
shm = calloc(1, sizeof(snd_ctl_shm_t));
|
||||
if (!ctl) {
|
||||
if (!shm) {
|
||||
free(ctl);
|
||||
result = -ENOMEM;
|
||||
goto _err;
|
||||
|
|
@ -496,8 +494,6 @@ int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket,
|
|||
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;
|
||||
|
|
@ -505,7 +501,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int m
|
|||
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;
|
||||
|
|
@ -567,7 +563,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int m
|
|||
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;
|
||||
|
|
@ -590,7 +586,7 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int m
|
|||
SNDERR("host is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!socket) {
|
||||
if (!sockname) {
|
||||
SNDERR("socket is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -604,6 +600,6 @@ int _snd_ctl_shm_open(snd_ctl_t **handlep, char *name, snd_config_t *conf, int m
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -173,7 +173,7 @@ static int snd_hctl_elem_throw_event(snd_hctl_elem_t *elem,
|
|||
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;
|
||||
|
||||
|
|
@ -190,7 +190,7 @@ static int snd_hctl_compare_mixer_priority_lookup(char **name, char * const *nam
|
|||
|
||||
static int get_compare_weight(const char *name)
|
||||
{
|
||||
static char *names[] = {
|
||||
static const char *names[] = {
|
||||
"Master",
|
||||
"Hardware Master",
|
||||
"Headphone",
|
||||
|
|
@ -221,7 +221,7 @@ static int get_compare_weight(const char *name)
|
|||
"IEC958",
|
||||
NULL
|
||||
};
|
||||
static char *names1[] = {
|
||||
static const char *names1[] = {
|
||||
"Switch",
|
||||
"Volume",
|
||||
"Playback",
|
||||
|
|
@ -235,7 +235,7 @@ static int get_compare_weight(const char *name)
|
|||
"-",
|
||||
NULL
|
||||
};
|
||||
static char *names2[] = {
|
||||
static const char *names2[] = {
|
||||
"Switch",
|
||||
"Volume",
|
||||
"Bypass",
|
||||
|
|
@ -248,12 +248,12 @@ static int get_compare_weight(const char *name)
|
|||
};
|
||||
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;
|
||||
}
|
||||
|
|
@ -356,8 +356,8 @@ static void snd_hctl_sort(snd_hctl_t *hctl)
|
|||
{
|
||||
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);
|
||||
|
|
@ -625,7 +625,7 @@ static int snd_hctl_handle_event(snd_hctl_t *hctl, snd_ctl_event_t *event)
|
|||
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) {
|
||||
|
|
|
|||
|
|
@ -117,7 +117,7 @@ int snd_hwdep_info(snd_hwdep_t *hwdep, snd_hwdep_info_t *info)
|
|||
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)
|
||||
|
|
|
|||
16
src/input.c
16
src/input.c
|
|
@ -128,14 +128,14 @@ static int snd_input_stdio_close(snd_input_t *input ATTRIBUTE_UNUSED)
|
|||
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)
|
||||
|
|
@ -166,7 +166,7 @@ static snd_input_ops_t snd_input_stdio_ops = {
|
|||
* \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;
|
||||
|
|
@ -180,7 +180,7 @@ int snd_input_stdio_attach(snd_input_t **inputp, FILE *fp, int close)
|
|||
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;
|
||||
|
|
@ -228,7 +228,7 @@ static int snd_input_buffer_close(snd_input_t *input)
|
|||
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);
|
||||
|
|
@ -288,7 +288,7 @@ static snd_input_ops_t snd_input_buffer_ops = {
|
|||
* \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;
|
||||
|
|
@ -303,13 +303,13 @@ int snd_input_buffer_open(snd_input_t **inputp, const char *buf, int size)
|
|||
}
|
||||
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;
|
||||
|
|
|
|||
|
|
@ -259,12 +259,12 @@ int snd_instr_iwffff_open_rom(snd_iwffff_handle_t **handle, int card, int bank,
|
|||
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);
|
||||
|
|
@ -275,7 +275,7 @@ int snd_instr_iwffff_open_rom(snd_iwffff_handle_t **handle, int card, int bank,
|
|||
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
|
||||
|
|
@ -303,7 +303,7 @@ int snd_instr_iwffff_open_rom(snd_iwffff_handle_t **handle, int card, int bank,
|
|||
*handle = iwf;
|
||||
return 0;
|
||||
}
|
||||
index++;
|
||||
idx++;
|
||||
lseek(fd, SEEK_CUR, next_ffff);
|
||||
}
|
||||
close(fd);
|
||||
|
|
|
|||
|
|
@ -186,7 +186,7 @@ int snd_mixer_detach(snd_mixer_t *mixer, const char *name)
|
|||
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++;
|
||||
|
|
@ -411,8 +411,8 @@ static int snd_mixer_sort(snd_mixer_t *mixer)
|
|||
{
|
||||
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);
|
||||
|
|
@ -490,10 +490,11 @@ int snd_mixer_wait(snd_mixer_t *mixer, int timeout)
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ void bag_free(bag_t *bag);
|
|||
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;
|
||||
|
||||
|
|
|
|||
|
|
@ -104,9 +104,9 @@ static const char *get_short_name(const char *lname)
|
|||
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",
|
||||
|
|
@ -147,7 +147,7 @@ static int get_compare_weight(const char *name, int index)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
@ -653,9 +653,9 @@ static int base_len(const char *name, selem_ctl_type_t *type)
|
|||
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;
|
||||
|
|
@ -761,7 +761,7 @@ int simple_add1(snd_mixer_class_t *class, const char *name,
|
|||
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;
|
||||
|
|
@ -803,8 +803,8 @@ int simple_event_add(snd_mixer_class_t *class, snd_hctl_elem_t *helem)
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
@ -823,15 +823,15 @@ int simple_event_remove(snd_hctl_elem_t *helem,
|
|||
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)
|
||||
|
|
@ -1186,7 +1186,7 @@ int snd_mixer_selem_get_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_c
|
|||
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);
|
||||
|
|
@ -1233,7 +1233,7 @@ int snd_mixer_selem_set_capture_volume(snd_mixer_elem_t *elem, snd_mixer_selem_c
|
|||
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;
|
||||
|
|
@ -1280,7 +1280,7 @@ int snd_mixer_selem_set_capture_volume_all(snd_mixer_elem_t *elem, long value)
|
|||
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);
|
||||
|
|
@ -1333,7 +1333,7 @@ int snd_mixer_selem_set_capture_switch(snd_mixer_elem_t *elem, snd_mixer_selem_c
|
|||
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) {
|
||||
|
|
@ -1384,7 +1384,7 @@ int snd_mixer_selem_set_capture_switch_all(snd_mixer_elem_t *elem, int 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",
|
||||
|
|
@ -1392,7 +1392,7 @@ const char *snd_mixer_selem_channel_name(snd_mixer_selem_channel_id_t channel)
|
|||
[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)
|
||||
|
|
|
|||
10
src/output.c
10
src/output.c
|
|
@ -165,7 +165,7 @@ static snd_output_ops_t snd_output_stdio_ops = {
|
|||
* \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;
|
||||
|
|
@ -179,7 +179,7 @@ int snd_output_stdio_attach(snd_output_t **outputp, FILE *fp, int close)
|
|||
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;
|
||||
|
|
@ -227,10 +227,10 @@ static int snd_output_buffer_close(snd_output_t *output ATTRIBUTE_UNUSED)
|
|||
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
|
||||
|
|
|
|||
|
|
@ -26,10 +26,10 @@
|
|||
#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,
|
||||
|
|
@ -379,7 +379,8 @@ void snd_interval_print(const snd_interval_t *i, snd_output_t *out)
|
|||
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;
|
||||
|
|
@ -389,6 +390,7 @@ void boundary_abs(int a, int adir, int *b, int *bdir)
|
|||
*bdir = adir;
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
||||
void boundary_sub(int a, int adir, int b, int bdir, int *c, int *cdir)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -19,11 +19,7 @@
|
|||
*
|
||||
*/
|
||||
|
||||
#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)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -21,11 +21,7 @@
|
|||
|
||||
#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
|
||||
|
|
|
|||
|
|
@ -647,10 +647,10 @@ const char *snd_pcm_stream_name(snd_pcm_stream_t stream)
|
|||
* \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)];
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -923,9 +923,9 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
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);
|
||||
|
|
@ -1025,7 +1025,7 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *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;
|
||||
|
|
@ -1036,8 +1036,8 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (!open) {
|
||||
open = buf;
|
||||
if (!open_name) {
|
||||
open_name = buf;
|
||||
snprintf(buf, sizeof(buf), "_snd_pcm_%s_open", str);
|
||||
}
|
||||
if (!lib)
|
||||
|
|
@ -1047,9 +1047,9 @@ int snd_pcm_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -1323,7 +1323,7 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -1331,7 +1331,7 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -1339,7 +1339,7 @@ int snd_pcm_area_copy(const snd_pcm_channel_area_t *dst_area, snd_pcm_uframes_t
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -1550,7 +1550,7 @@ void snd_pcm_access_mask_any(snd_pcm_access_mask_t *mask)
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1641,7 +1641,7 @@ void snd_pcm_format_mask_any(snd_pcm_format_mask_t *mask)
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1733,7 +1733,7 @@ void snd_pcm_subformat_mask_any(snd_pcm_subformat_mask_t *mask)
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1888,7 +1888,7 @@ int snd_pcm_hw_params_get_format(const snd_pcm_hw_params_t *params)
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -1900,7 +1900,7 @@ int snd_pcm_hw_params_test_format(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, s
|
|||
*/
|
||||
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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -4091,7 +4091,7 @@ snd_pcm_sframes_t snd_pcm_read_areas(snd_pcm_t *pcm, const snd_pcm_channel_area_
|
|||
#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,
|
||||
|
|
@ -4174,7 +4174,7 @@ snd_pcm_sframes_t snd_pcm_write_areas(snd_pcm_t *pcm, const snd_pcm_channel_area
|
|||
}
|
||||
}
|
||||
_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)
|
||||
|
|
|
|||
|
|
@ -55,13 +55,14 @@ typedef void (*adpcm_f)(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 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;
|
||||
|
|
@ -194,7 +195,8 @@ void snd_pcm_adpcm_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,
|
||||
snd_pcm_adpcm_state_t *states)
|
||||
{
|
||||
#define PUT16_LABELS
|
||||
|
|
@ -211,7 +213,7 @@ void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *dst_areas,
|
|||
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;
|
||||
|
|
@ -220,7 +222,7 @@ void snd_pcm_adpcm_decode(const snd_pcm_channel_area_t *dst_areas,
|
|||
frames1 = frames;
|
||||
while (frames1-- > 0) {
|
||||
int16_t sample;
|
||||
int v;
|
||||
unsigned char v;
|
||||
if (srcbit)
|
||||
v = *src & 0x0f;
|
||||
else
|
||||
|
|
@ -246,7 +248,8 @@ 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)
|
||||
{
|
||||
#define GET16_LABELS
|
||||
|
|
@ -266,7 +269,7 @@ void snd_pcm_adpcm_encode(const snd_pcm_channel_area_t *dst_areas,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@ typedef void (*alaw_f)(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 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;
|
||||
|
|
@ -124,7 +125,8 @@ 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)
|
||||
{
|
||||
#define PUT16_LABELS
|
||||
#include "plugin_ops.h"
|
||||
|
|
@ -132,7 +134,7 @@ void snd_pcm_alaw_decode(const snd_pcm_channel_area_t *dst_areas,
|
|||
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;
|
||||
|
|
@ -160,7 +162,8 @@ 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)
|
||||
{
|
||||
#define GET16_LABELS
|
||||
#include "plugin_ops.h"
|
||||
|
|
|
|||
|
|
@ -30,7 +30,7 @@ typedef enum _snd_pcm_file_format {
|
|||
typedef struct {
|
||||
snd_pcm_t *slave;
|
||||
int close_slave;
|
||||
const char *fname;
|
||||
char *fname;
|
||||
int fd;
|
||||
int format;
|
||||
snd_pcm_uframes_t appl_ptr;
|
||||
|
|
@ -430,7 +430,7 @@ int snd_pcm_file_open(snd_pcm_t **pcmp, const char *name, const char *fname, int
|
|||
return -ENOMEM;
|
||||
}
|
||||
|
||||
file->fname = fname;
|
||||
file->fname = strdup(fname);
|
||||
file->fd = fd;
|
||||
file->format = format;
|
||||
file->slave = slave;
|
||||
|
|
@ -515,11 +515,6 @@ int _snd_pcm_file_open(snd_pcm_t **pcmp, const char *name,
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -343,7 +343,7 @@ static snd_pcm_sframes_t snd_pcm_hw_readi(snd_pcm_t *pcm, void *buffer, snd_pcm_
|
|||
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;
|
||||
|
|
@ -361,7 +361,8 @@ static int snd_pcm_hw_mmap_status(snd_pcm_t *pcm)
|
|||
{
|
||||
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");
|
||||
|
|
@ -376,7 +377,8 @@ static int snd_pcm_hw_mmap_control(snd_pcm_t *pcm)
|
|||
{
|
||||
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");
|
||||
|
|
@ -411,7 +413,7 @@ static int snd_pcm_hw_mmap(snd_pcm_t *pcm)
|
|||
{
|
||||
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");
|
||||
|
|
@ -481,7 +483,7 @@ static snd_pcm_sframes_t snd_pcm_hw_avail_update(snd_pcm_t *pcm)
|
|||
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",
|
||||
|
|
@ -527,10 +529,10 @@ snd_pcm_fast_ops_t snd_pcm_hw_fast_ops = {
|
|||
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;
|
||||
|
|
@ -645,11 +647,6 @@ int snd_pcm_hw_open_subdevice(snd_pcm_t **pcmp, int card, int device, int subdev
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@
|
|||
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;
|
||||
|
||||
|
|
@ -90,7 +90,8 @@ int snd_pcm_linear_put_index(snd_pcm_format_t src_format, snd_pcm_format_t dst_f
|
|||
|
||||
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"
|
||||
|
|
|
|||
|
|
@ -192,7 +192,7 @@ int snd_pcm_plug_open(snd_pcm_t **pcmp,
|
|||
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);
|
||||
|
||||
|
|
@ -293,7 +293,7 @@ static inline void *snd_pcm_channel_area_addr(const snd_pcm_channel_area_t *area
|
|||
{
|
||||
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)
|
||||
|
|
@ -498,46 +498,46 @@ int snd_pcm_hw_strategy_simple_choices(snd_pcm_hw_strategy_t *strategy, int orde
|
|||
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_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 ((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_MMAP ((1U << SND_PCM_ACCESS_MMAP_INTERLEAVED) | \
|
||||
(1U << SND_PCM_ACCESS_MMAP_NONINTERLEAVED) | \
|
||||
(1U << 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_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))
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -40,7 +40,7 @@
|
|||
|
||||
struct _snd_pcm_scope {
|
||||
int enabled;
|
||||
const char *name;
|
||||
char *name;
|
||||
snd_pcm_scope_ops_t *ops;
|
||||
void *private_data;
|
||||
struct list_head list;
|
||||
|
|
@ -65,10 +65,10 @@ typedef struct _snd_pcm_meter {
|
|||
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) {
|
||||
|
|
@ -108,7 +108,8 @@ static void snd_pcm_meter_update_main(snd_pcm_t *pcm)
|
|||
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);
|
||||
|
|
@ -139,13 +140,14 @@ static int snd_pcm_meter_update_scope(snd_pcm_t *pcm)
|
|||
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);
|
||||
|
|
@ -155,7 +157,7 @@ int snd_pcm_scope_remove(snd_pcm_scope_t *scope)
|
|||
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);
|
||||
|
|
@ -164,7 +166,7 @@ int snd_pcm_scope_enable(snd_pcm_scope_t *scope)
|
|||
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);
|
||||
|
|
@ -391,7 +393,8 @@ static snd_pcm_sframes_t snd_pcm_meter_mmap_forward(snd_pcm_t *pcm, snd_pcm_ufra
|
|||
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;
|
||||
|
|
@ -451,13 +454,13 @@ static int snd_pcm_meter_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_
|
|||
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);
|
||||
|
|
@ -637,15 +640,15 @@ int snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name, unsigned int frequenc
|
|||
}
|
||||
|
||||
|
||||
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);
|
||||
|
|
@ -674,7 +677,7 @@ int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *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;
|
||||
|
|
@ -685,8 +688,8 @@ int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (!open) {
|
||||
open = buf;
|
||||
if (!open_name) {
|
||||
open_name = buf;
|
||||
snprintf(buf, sizeof(buf), "_snd_pcm_scope_%s_open", str);
|
||||
}
|
||||
if (!lib)
|
||||
|
|
@ -696,9 +699,9 @@ int snd_pcm_meter_add_scope_conf(snd_pcm_t *pcm, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -762,7 +765,7 @@ int _snd_pcm_meter_open(snd_pcm_t **pcmp, const char *name,
|
|||
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)
|
||||
|
|
@ -894,7 +897,7 @@ snd_pcm_uframes_t snd_pcm_meter_get_boundary(snd_pcm_t *pcm)
|
|||
*/
|
||||
void snd_pcm_scope_set_name(snd_pcm_scope_t *scope, const char *val)
|
||||
{
|
||||
scope->name = val;
|
||||
scope->name = strdup(val);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
@ -954,7 +957,7 @@ static int s16_enable(snd_pcm_scope_t *scope)
|
|||
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;
|
||||
|
|
@ -964,7 +967,7 @@ static int s16_enable(snd_pcm_scope_t *scope)
|
|||
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:
|
||||
|
|
@ -980,12 +983,12 @@ static int s16_enable(snd_pcm_scope_t *scope)
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -387,7 +387,7 @@ u_int64_t snd_pcm_format_silence_64(snd_pcm_format_t format)
|
|||
return 0;
|
||||
default:
|
||||
assert(0);
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -110,10 +110,10 @@ void snd_pcm_mmap_hw_forward(snd_pcm_t *pcm, snd_pcm_uframes_t frames)
|
|||
*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;
|
||||
|
|
@ -143,10 +143,10 @@ snd_pcm_uframes_t snd_pcm_mmap_write_areas(snd_pcm_t *pcm,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -27,12 +27,13 @@ typedef void (*mulaw_f)(const snd_pcm_channel_area_t *src_areas,
|
|||
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;
|
||||
|
|
@ -141,7 +142,8 @@ 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)
|
||||
{
|
||||
#define PUT16_LABELS
|
||||
#include "plugin_ops.h"
|
||||
|
|
@ -149,7 +151,7 @@ void snd_pcm_mulaw_decode(const snd_pcm_channel_area_t *dst_areas,
|
|||
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;
|
||||
|
|
@ -177,7 +179,8 @@ 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)
|
||||
{
|
||||
#define GET16_LABELS
|
||||
#include "plugin_ops.h"
|
||||
|
|
|
|||
|
|
@ -85,9 +85,9 @@ static int snd_pcm_multi_info(snd_pcm_t *pcm, snd_pcm_info_t *info)
|
|||
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;
|
||||
}
|
||||
|
|
@ -107,11 +107,11 @@ static int snd_pcm_multi_hw_refine_cprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t
|
|||
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;
|
||||
|
|
@ -126,7 +126,7 @@ static int snd_pcm_multi_hw_refine_sprepare(snd_pcm_t *pcm, int slave_idx,
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -159,7 +159,7 @@ static int snd_pcm_multi_hw_refine_schange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
|
|||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
@ -194,7 +194,7 @@ static int snd_pcm_multi_hw_refine_cchange(snd_pcm_t *pcm ATTRIBUTE_UNUSED,
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -244,7 +244,7 @@ static int snd_pcm_multi_hw_refine(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
|
|||
}
|
||||
|
||||
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;
|
||||
|
|
@ -443,13 +443,6 @@ static int snd_pcm_multi_munmap(snd_pcm_t *pcm ATTRIBUTE_UNUSED)
|
|||
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;
|
||||
|
|
@ -592,7 +585,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
|||
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;
|
||||
|
|
@ -663,14 +656,14 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
|||
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;
|
||||
}
|
||||
|
|
@ -691,7 +684,7 @@ int _snd_pcm_multi_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
|||
}
|
||||
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) {
|
||||
|
|
|
|||
|
|
@ -57,9 +57,9 @@ static int snd_pcm_null_info(snd_pcm_t *pcm ATTRIBUTE_UNUSED, snd_pcm_info_t * i
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -21,45 +21,45 @@
|
|||
|
||||
#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));
|
||||
|
|
@ -134,12 +134,12 @@ unsigned int snd_pcm_hw_param_get_min(const snd_pcm_hw_params_t *params,
|
|||
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)
|
||||
|
|
@ -153,7 +153,7 @@ unsigned int snd_pcm_hw_param_get_max(const snd_pcm_hw_params_t *params,
|
|||
return snd_interval_max(i);
|
||||
}
|
||||
assert(0);
|
||||
return -EINVAL;
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Return the mask for field PAR.
|
||||
|
|
@ -208,8 +208,8 @@ void _snd_pcm_hw_param_set_empty(snd_pcm_hw_params_t *params,
|
|||
}
|
||||
}
|
||||
|
||||
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));
|
||||
|
|
@ -261,8 +261,8 @@ int snd_pcm_hw_param_set_integer(snd_pcm_t *pcm,
|
|||
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))
|
||||
|
|
@ -297,8 +297,8 @@ unsigned int snd_pcm_hw_param_set_first(snd_pcm_t *pcm,
|
|||
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))
|
||||
|
|
@ -337,21 +337,21 @@ int _snd_pcm_hw_param_set_min(snd_pcm_hw_params_t *params,
|
|||
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;
|
||||
|
|
@ -407,23 +407,23 @@ int _snd_pcm_hw_param_set_max(snd_pcm_hw_params_t *params,
|
|||
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;
|
||||
|
|
@ -790,6 +790,7 @@ unsigned int snd_pcm_hw_param_set_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *para
|
|||
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).
|
||||
|
|
@ -860,12 +861,13 @@ int snd_pcm_hw_param_set_next(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
|||
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;
|
||||
|
|
@ -902,8 +904,9 @@ void snd_pcm_hw_param_refine_near(snd_pcm_t *pcm,
|
|||
|
||||
/* ---- 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));
|
||||
|
|
@ -912,6 +915,7 @@ int snd_pcm_hw_param_empty(const snd_pcm_hw_params_t *params,
|
|||
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,
|
||||
|
|
@ -953,7 +957,7 @@ int snd_pcm_hw_param_never_eq(const snd_pcm_hw_params_t *params,
|
|||
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);
|
||||
|
|
@ -966,8 +970,9 @@ 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_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);
|
||||
|
|
@ -980,6 +985,7 @@ unsigned int snd_pcm_hw_param_count(const snd_pcm_hw_params_t *params,
|
|||
assert(0);
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
int _snd_pcm_hw_param_refine(snd_pcm_hw_params_t *params,
|
||||
snd_pcm_hw_param_t var,
|
||||
|
|
@ -1003,8 +1009,9 @@ int _snd_pcm_hw_param_refine(snd_pcm_hw_params_t *params,
|
|||
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);
|
||||
|
|
@ -1012,6 +1019,7 @@ void _snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t 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);
|
||||
|
|
@ -1019,9 +1027,11 @@ void _snd_pcm_hw_param_copy(snd_pcm_hw_params_t *params, snd_pcm_hw_param_t 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)
|
||||
|
|
@ -1506,8 +1516,8 @@ struct _snd_pcm_hw_rule {
|
|||
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]),
|
||||
|
|
@ -1515,7 +1525,7 @@ int snd_pcm_hw_rule_mul(snd_pcm_hw_params_t *params,
|
|||
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;
|
||||
|
|
@ -1524,8 +1534,8 @@ int snd_pcm_hw_rule_div(snd_pcm_hw_params_t *params,
|
|||
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]),
|
||||
|
|
@ -1534,8 +1544,8 @@ int snd_pcm_hw_rule_muldivk(snd_pcm_hw_params_t *params,
|
|||
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]),
|
||||
|
|
@ -1544,8 +1554,8 @@ int snd_pcm_hw_rule_mulkdiv(snd_pcm_hw_params_t *params,
|
|||
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;
|
||||
|
|
@ -1558,7 +1568,7 @@ int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params,
|
|||
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;
|
||||
|
|
@ -1569,8 +1579,8 @@ int snd_pcm_hw_rule_format(snd_pcm_hw_params_t *params,
|
|||
}
|
||||
|
||||
|
||||
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;
|
||||
|
|
@ -2008,7 +2018,7 @@ int snd_pcm_hw_params_slave(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -273,7 +273,7 @@ static int snd_pcm_plug_change_channels(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm
|
|||
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;
|
||||
|
|
@ -288,7 +288,7 @@ static int snd_pcm_plug_change_format(snd_pcm_t *pcm, snd_pcm_t **new, snd_pcm_p
|
|||
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 ||
|
||||
|
|
@ -362,7 +362,7 @@ static int snd_pcm_plug_insert_plugins(snd_pcm_t *pcm,
|
|||
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,
|
||||
|
|
|
|||
|
|
@ -110,7 +110,7 @@ int snd_pcm_plugin_prepare(snd_pcm_t *pcm)
|
|||
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;
|
||||
|
|
@ -169,7 +169,7 @@ snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames
|
|||
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) {
|
||||
|
|
@ -181,20 +181,20 @@ snd_pcm_sframes_t snd_pcm_plugin_rewind(snd_pcm_t *pcm, snd_pcm_uframes_t frames
|
|||
}
|
||||
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;
|
||||
|
|
@ -225,10 +225,10 @@ snd_pcm_uframes_t snd_pcm_plugin_write_areas(snd_pcm_t *pcm,
|
|||
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;
|
||||
|
|
@ -350,15 +350,17 @@ snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *pcm)
|
|||
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);
|
||||
|
|
@ -398,7 +400,7 @@ snd_pcm_sframes_t snd_pcm_plugin_avail_update(snd_pcm_t *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");
|
||||
|
|
@ -418,12 +420,6 @@ int snd_pcm_plugin_munmap(snd_pcm_t *pcm)
|
|||
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;
|
||||
|
|
@ -446,7 +442,7 @@ int snd_pcm_plugin_status(snd_pcm_t *pcm, snd_pcm_status_t * status)
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -95,37 +95,42 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt
|
|||
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 */
|
||||
|
|
@ -136,11 +141,13 @@ void snd_pcm_adpcm_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,
|
||||
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);
|
||||
|
|
|
|||
|
|
@ -39,30 +39,30 @@ typedef snd_pcm_uframes_t (*rate_f)(const snd_pcm_channel_area_t *dst_areas,
|
|||
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
|
||||
|
|
@ -129,14 +129,14 @@ snd_pcm_uframes_t snd_pcm_rate_expand(const snd_pcm_channel_area_t *dst_areas,
|
|||
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
|
||||
|
|
@ -436,7 +436,7 @@ snd_pcm_rate_read_areas(snd_pcm_t *pcm,
|
|||
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 */
|
||||
|
|
@ -446,7 +446,7 @@ snd_pcm_sframes_t snd_pcm_rate_client_frames(snd_pcm_t *pcm, snd_pcm_sframes_t f
|
|||
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 */
|
||||
|
|
@ -489,7 +489,7 @@ snd_pcm_ops_t snd_pcm_rate_ops = {
|
|||
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;
|
||||
|
|
@ -581,7 +581,8 @@ int _snd_pcm_rate_open(snd_pcm_t **pcmp, const char *name,
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -45,10 +45,10 @@ typedef struct snd_pcm_route_ttable_dst snd_pcm_route_ttable_dst_t;
|
|||
|
||||
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;
|
||||
|
|
@ -87,24 +87,24 @@ typedef struct {
|
|||
} 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"
|
||||
|
|
@ -143,13 +143,13 @@ void snd_pcm_route_convert1_one(const snd_pcm_channel_area_t *dst_area,
|
|||
}
|
||||
}
|
||||
|
||||
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
|
||||
|
|
@ -376,13 +376,13 @@ void snd_pcm_route_convert1_many(const snd_pcm_channel_area_t *dst_area,
|
|||
}
|
||||
}
|
||||
|
||||
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;
|
||||
|
|
@ -459,7 +459,7 @@ static int snd_pcm_route_hw_refine_sprepare(snd_pcm_t *pcm, snd_pcm_hw_params_t
|
|||
}
|
||||
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;
|
||||
}
|
||||
|
|
@ -650,10 +650,10 @@ snd_pcm_ops_t snd_pcm_route_ops = {
|
|||
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;
|
||||
|
|
@ -710,7 +710,7 @@ int route_load_ttable(snd_pcm_route_params_t *params, snd_pcm_stream_t stream,
|
|||
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);
|
||||
|
|
@ -723,7 +723,7 @@ int route_load_ttable(snd_pcm_route_params_t *params, snd_pcm_stream_t stream,
|
|||
|
||||
|
||||
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,
|
||||
|
|
@ -801,11 +801,11 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt
|
|||
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 ||
|
||||
|
|
@ -814,10 +814,10 @@ int snd_pcm_route_load_ttable(snd_config_t *tt, snd_pcm_route_ttable_entry_t *tt
|
|||
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;
|
||||
|
|
|
|||
|
|
@ -334,7 +334,7 @@ static snd_pcm_uframes_t _snd_pcm_share_slave_missing(snd_pcm_share_slave_t *sla
|
|||
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;
|
||||
|
|
@ -775,7 +775,7 @@ static snd_pcm_sframes_t _snd_pcm_share_mmap_forward(snd_pcm_t *pcm, snd_pcm_ufr
|
|||
}
|
||||
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);
|
||||
|
|
@ -1314,7 +1314,6 @@ int snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, const char *sname,
|
|||
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]);
|
||||
|
|
@ -1456,7 +1455,8 @@ int _snd_pcm_share_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
|||
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);
|
||||
|
|
|
|||
|
|
@ -43,7 +43,7 @@ typedef struct {
|
|||
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));
|
||||
|
|
@ -68,7 +68,7 @@ int receive_fd(int socket, void *data, size_t len, int *fd)
|
|||
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;
|
||||
|
|
@ -563,7 +563,7 @@ static int make_inet_socket(const char *host, int port)
|
|||
}
|
||||
#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;
|
||||
|
|
@ -578,9 +578,9 @@ int snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, const char *socket, con
|
|||
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;
|
||||
|
|
@ -687,7 +687,7 @@ int is_local(struct hostent *hent)
|
|||
}
|
||||
|
||||
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) {
|
||||
|
|
@ -698,17 +698,17 @@ int is_local(struct hostent *hent)
|
|||
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);
|
||||
|
|
@ -724,7 +724,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
|||
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;
|
||||
|
|
@ -786,7 +786,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
|||
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;
|
||||
|
|
@ -809,7 +809,7 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
|||
SNDERR("host is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
if (!socket) {
|
||||
if (!sockname) {
|
||||
SNDERR("socket is not defined");
|
||||
return -EINVAL;
|
||||
}
|
||||
|
|
@ -823,6 +823,6 @@ int _snd_pcm_shm_open(snd_pcm_t **pcmp, const char *name, snd_config_t *conf,
|
|||
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);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -29,6 +29,15 @@
|
|||
#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,
|
||||
|
|
@ -40,10 +49,10 @@ static void *copy_labels[4] = {
|
|||
|
||||
#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
|
||||
|
||||
|
|
@ -183,100 +192,100 @@ static void *conv_labels[4 * 2 * 2 * 4 * 2] = {
|
|||
|
||||
#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
|
||||
|
||||
|
|
@ -304,20 +313,20 @@ static void *get16_labels[4 * 2 * 2] = {
|
|||
|
||||
#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
|
||||
|
||||
|
|
@ -386,20 +395,20 @@ static void *get32_labels[4 * 2 * 2] = {
|
|||
|
||||
#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
|
||||
|
||||
|
|
@ -468,20 +477,20 @@ static void *getu_labels[4 * 2 * 2] = {
|
|||
|
||||
#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
|
||||
|
||||
|
|
|
|||
|
|
@ -80,9 +80,9 @@ int snd_rawmidi_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
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);
|
||||
|
|
@ -132,7 +132,7 @@ int snd_rawmidi_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
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;
|
||||
|
|
@ -143,8 +143,8 @@ int snd_rawmidi_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (!open) {
|
||||
open = buf;
|
||||
if (!open_name) {
|
||||
open_name = buf;
|
||||
snprintf(buf, sizeof(buf), "_snd_rawmidi_%s_open", str);
|
||||
}
|
||||
if (!lib)
|
||||
|
|
@ -154,9 +154,9 @@ int snd_rawmidi_open(snd_rawmidi_t **inputp, snd_rawmidi_t **outputp,
|
|||
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;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -44,9 +44,9 @@ int snd_seq_open(snd_seq_t **seqp, const char *name,
|
|||
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);
|
||||
|
|
@ -91,7 +91,7 @@ int snd_seq_open(snd_seq_t **seqp, const char *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;
|
||||
|
|
@ -102,8 +102,8 @@ int snd_seq_open(snd_seq_t **seqp, const char *name,
|
|||
return -EINVAL;
|
||||
}
|
||||
}
|
||||
if (!open) {
|
||||
open = buf;
|
||||
if (!open_name) {
|
||||
open_name = buf;
|
||||
snprintf(buf, sizeof(buf), "_snd_seq_%s_open", str);
|
||||
}
|
||||
if (!lib)
|
||||
|
|
@ -113,9 +113,9 @@ int snd_seq_open(snd_seq_t **seqp, const char *name,
|
|||
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;
|
||||
}
|
||||
|
|
@ -147,12 +147,6 @@ int snd_seq_close(snd_seq_t *seq)
|
|||
/*
|
||||
* 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;
|
||||
|
|
@ -753,8 +747,7 @@ int snd_seq_event_output_direct(snd_seq_t *seq, snd_seq_event_t *ev)
|
|||
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);
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
|
|
@ -25,11 +25,11 @@
|
|||
|
||||
/* 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 */
|
||||
};
|
||||
|
||||
|
|
@ -116,7 +116,7 @@ static struct extra_event_list_t {
|
|||
* 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;
|
||||
|
||||
|
|
@ -174,7 +174,7 @@ void snd_midi_event_init(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;
|
||||
|
||||
|
|
|
|||
|
|
@ -47,12 +47,12 @@ void snd_seq_ev_schedule_tick(snd_seq_event_t *ev, int q, int relative,
|
|||
|
||||
/* 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;
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -74,16 +74,6 @@ int snd_timer_close(snd_timer_t *handle)
|
|||
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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue