Control API encapsulation. Better names for kernel API. Simpler PCM hw_params API. Added missing const.

This commit is contained in:
Abramo Bagnara 2001-02-06 23:48:10 +00:00
parent ccb399f0cd
commit 8f0cb26fdf
71 changed files with 2001 additions and 694 deletions

View file

@ -19,14 +19,13 @@
*
*/
#include <assert.h>
#include "local.h"
#include "list.h"
typedef struct {
typedef struct _snd_ctl_ops {
int (*close)(snd_ctl_t *handle);
int (*poll_descriptor)(snd_ctl_t *handle);
int (*hw_info)(snd_ctl_t *handle, snd_ctl_hw_info_t *info);
int (*hw_info)(snd_ctl_t *handle, snd_ctl_info_t *info);
int (*clist)(snd_ctl_t *handle, snd_control_list_t *list);
int (*cinfo)(snd_ctl_t *handle, snd_control_info_t *info);
int (*cread)(snd_ctl_t *handle, snd_control_t *control);
@ -53,12 +52,46 @@ struct _snd_ctl {
struct list_head hlist; /* list of all controls */
void *hroot; /* root of controls */
void *hroot_new; /* new croot */
snd_ctl_hsort_t *hsort;
snd_ctl_hcallback_rebuild_t *callback_rebuild;
snd_ctl_hsort_t hsort;
snd_ctl_hcallback_rebuild_t callback_rebuild;
void *callback_rebuild_private_data;
snd_ctl_hcallback_add_t *callback_add;
snd_ctl_hcallback_add_t callback_add;
void *callback_add_private_data;
};
int snd_ctl_hw_open(snd_ctl_t **handle, char *name, int card);
int snd_ctl_shm_open(snd_ctl_t **handlep, char *name, char *socket, char *sname);
struct _snd_ctl_callbacks {
void *private_data; /* may be used by an application */
void (*rebuild) (snd_ctl_t *handle, void *private_data);
void (*value) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
void (*change) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
void (*add) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
void (*remove) (snd_ctl_t *handle, void *private_data, snd_control_id_t * id);
void *reserved[58]; /* reserved for the future use - must be NULL!!! */
};
struct _snd_hcontrol_list {
unsigned int offset; /* W: first control ID to get */
unsigned int space; /* W: count of control IDs to get */
unsigned int used; /* R: count of available (set) controls */
unsigned int count; /* R: count of all available controls */
snd_control_id_t *pids; /* W: IDs */
};
struct _snd_hcontrol {
snd_control_id_t id; /* must be always on top */
struct list_head list; /* links for list of all hcontrols */
int change: 1, /* structure change */
value: 1; /* value change */
/* event callbacks */
snd_hcontrol_callback_t callback_change;
snd_hcontrol_callback_t callback_value;
snd_hcontrol_callback_t callback_remove;
/* private data */
void *private_data;
snd_hcontrol_private_free_t private_free;
/* links */
snd_ctl_t *handle; /* associated handle */
};
int snd_ctl_hw_open(snd_ctl_t **handle, const char *name, int card);
int snd_ctl_shm_open(snd_ctl_t **handlep, const char *name, const char *socket, const char *sname);