mirror of https://github.com/ericonr/sndio.git
add sio_<backend>_nfds() method
This commit is contained in:
parent
2873ad8ad2
commit
c446e8d141
|
@ -89,7 +89,7 @@ sio_open(const char *str, unsigned mode, int nbio)
|
|||
return hdl;
|
||||
#endif
|
||||
#ifdef USE_ALSA
|
||||
hdl = sio_open_alsa("0", mode, nbio);
|
||||
hdl = sio_alsa_open("0", mode, nbio);
|
||||
if (hdl != NULL)
|
||||
return hdl;
|
||||
#endif
|
||||
|
@ -123,7 +123,7 @@ sio_open(const char *str, unsigned mode, int nbio)
|
|||
#ifdef USE_ALSA
|
||||
if (len == (sizeof(prefix_alsa) - 1) &&
|
||||
memcmp(str, prefix_alsa, len) == 0)
|
||||
return sio_open_alsa(sep + 1, mode, nbio);
|
||||
return sio_alsa_open(sep + 1, mode, nbio);
|
||||
#endif
|
||||
DPRINTF("sio_open: %s: unknown device type\n", str);
|
||||
return NULL;
|
||||
|
@ -379,10 +379,7 @@ sio_write(struct sio_hdl *hdl, const void *buf, size_t len)
|
|||
int
|
||||
sio_nfds(struct sio_hdl *hdl)
|
||||
{
|
||||
/*
|
||||
* In the future we might use larger values
|
||||
*/
|
||||
return 1;
|
||||
return hdl->ops->nfds(hdl);
|
||||
}
|
||||
|
||||
int
|
||||
|
|
|
@ -57,6 +57,7 @@ static int sio_aucat_getpar(struct sio_hdl *, struct sio_par *);
|
|||
static int sio_aucat_getcap(struct sio_hdl *, struct sio_cap *);
|
||||
static size_t sio_aucat_read(struct sio_hdl *, void *, size_t);
|
||||
static size_t sio_aucat_write(struct sio_hdl *, const void *, size_t);
|
||||
static int sio_aucat_nfds(struct sio_hdl *);
|
||||
static int sio_aucat_pollfd(struct sio_hdl *, struct pollfd *, int);
|
||||
static int sio_aucat_revents(struct sio_hdl *, struct pollfd *);
|
||||
static int sio_aucat_setvol(struct sio_hdl *, unsigned);
|
||||
|
@ -71,6 +72,7 @@ static struct sio_ops sio_aucat_ops = {
|
|||
sio_aucat_read,
|
||||
sio_aucat_start,
|
||||
sio_aucat_stop,
|
||||
sio_aucat_nfds,
|
||||
sio_aucat_pollfd,
|
||||
sio_aucat_revents,
|
||||
sio_aucat_setvol,
|
||||
|
@ -690,6 +692,12 @@ sio_aucat_write(struct sio_hdl *sh, const void *buf, size_t len)
|
|||
return n;
|
||||
}
|
||||
|
||||
static int
|
||||
sio_aucat_nfds(struct sio_hdl *hdl)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
sio_aucat_pollfd(struct sio_hdl *sh, struct pollfd *pfd, int events)
|
||||
{
|
||||
|
|
|
@ -71,6 +71,7 @@ struct sio_ops {
|
|||
size_t (*read)(struct sio_hdl *, void *, size_t);
|
||||
int (*start)(struct sio_hdl *);
|
||||
int (*stop)(struct sio_hdl *);
|
||||
int (*nfds)(struct sio_hdl *);
|
||||
int (*pollfd)(struct sio_hdl *, struct pollfd *, int);
|
||||
int (*revents)(struct sio_hdl *, struct pollfd *);
|
||||
int (*setvol)(struct sio_hdl *, unsigned);
|
||||
|
@ -82,7 +83,7 @@ struct sio_hdl *sio_aucat_open(const char *, unsigned, int);
|
|||
struct sio_hdl *sio_sun_open(const char *, unsigned, int);
|
||||
#endif
|
||||
#ifdef USE_ALSA
|
||||
struct sio_hdl *sio_open_alsa(const char *, unsigned, int);
|
||||
struct sio_hdl *sio_alsa_open(const char *, unsigned, int);
|
||||
#endif
|
||||
void sio_create(struct sio_hdl *, struct sio_ops *, unsigned, int);
|
||||
void sio_destroy(struct sio_hdl *);
|
||||
|
|
|
@ -63,6 +63,7 @@ static int sio_sun_getpar(struct sio_hdl *, struct sio_par *);
|
|||
static int sio_sun_getcap(struct sio_hdl *, struct sio_cap *);
|
||||
static size_t sio_sun_read(struct sio_hdl *, void *, size_t);
|
||||
static size_t sio_sun_write(struct sio_hdl *, const void *, size_t);
|
||||
static int sio_sun_nfds(struct sio_hdl *);
|
||||
static int sio_sun_pollfd(struct sio_hdl *, struct pollfd *, int);
|
||||
static int sio_sun_revents(struct sio_hdl *, struct pollfd *);
|
||||
|
||||
|
@ -75,6 +76,7 @@ static struct sio_ops sio_sun_ops = {
|
|||
sio_sun_read,
|
||||
sio_sun_start,
|
||||
sio_sun_stop,
|
||||
sio_sun_nfds,
|
||||
sio_sun_pollfd,
|
||||
sio_sun_revents,
|
||||
NULL, /* setvol */
|
||||
|
@ -861,6 +863,12 @@ sio_sun_write(struct sio_hdl *sh, const void *buf, size_t len)
|
|||
return n;
|
||||
}
|
||||
|
||||
static int
|
||||
sio_sun_nfds(struct sio_hdl *hdl)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
sio_sun_pollfd(struct sio_hdl *sh, struct pollfd *pfd, int events)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue