ALSA project - the C library reference
/usr/src/RPM/BUILD/libalsa-1.0.26/include/control_external.h
Go to the documentation of this file.
00001 
00010 /*
00011  *   This library is free software; you can redistribute it and/or modify
00012  *   it under the terms of the GNU Lesser General Public License as
00013  *   published by the Free Software Foundation; either version 2.1 of
00014  *   the License, or (at your option) any later version.
00015  *
00016  *   This program is distributed in the hope that it will be useful,
00017  *   but WITHOUT ANY WARRANTY; without even the implied warranty of
00018  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00019  *   GNU Lesser General Public License for more details.
00020  *
00021  *   You should have received a copy of the GNU Lesser General Public
00022  *   License along with this library; if not, write to the Free Software
00023  *   Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00024  *
00025  */
00026 #ifndef __ALSA_CONTROL_EXTERNAL_H
00027 #define __ALSA_CONTROL_EXTERNAL_H
00028 
00029 #include "control.h"
00030 
00031 #ifdef __cplusplus
00032 extern "C" {
00033 #endif
00034 
00043 #define SND_CTL_PLUGIN_ENTRY(name) _snd_ctl_##name##_open
00044 
00048 #define SND_CTL_PLUGIN_SYMBOL(name) SND_DLSYM_BUILD_VERSION(SND_CTL_PLUGIN_ENTRY(name), SND_CONTROL_DLSYM_VERSION);
00049 
00053 #define SND_CTL_PLUGIN_DEFINE_FUNC(plugin) \
00054 int SND_CTL_PLUGIN_ENTRY(plugin) (snd_ctl_t **handlep, const char *name,\
00055                                   snd_config_t *root, snd_config_t *conf, int mode)
00056 
00058 typedef struct snd_ctl_ext snd_ctl_ext_t;
00060 typedef struct snd_ctl_ext_callback snd_ctl_ext_callback_t;
00062 typedef unsigned long snd_ctl_ext_key_t;
00064 typedef int (snd_ctl_ext_tlv_rw_t)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int op_flag, unsigned int numid,
00065                                    unsigned int *tlv, unsigned int tlv_size);
00066 
00067 /*
00068  * Protocol version
00069  */
00070 #define SND_CTL_EXT_VERSION_MAJOR       1       
00071 #define SND_CTL_EXT_VERSION_MINOR       0       
00072 #define SND_CTL_EXT_VERSION_TINY        1       
00076 #define SND_CTL_EXT_VERSION             ((SND_CTL_EXT_VERSION_MAJOR<<16) |\
00077                                          (SND_CTL_EXT_VERSION_MINOR<<8) |\
00078                                          (SND_CTL_EXT_VERSION_TINY))
00079 
00081 struct snd_ctl_ext {
00086         unsigned int version;
00090         int card_idx;
00094         char id[16];
00098         char driver[16];
00102         char name[32];
00106         char longname[80];
00110         char mixername[80];
00114         int poll_fd;
00115 
00119         const snd_ctl_ext_callback_t *callback;
00123         void *private_data;
00127         snd_ctl_t *handle;
00128 
00129         int nonblock;                   
00130         int subscribed;                 
00135         union {
00136                 snd_ctl_ext_tlv_rw_t *c;
00137                 const unsigned int *p;
00138         } tlv;
00139 };
00140 
00142 struct snd_ctl_ext_callback {
00146         void (*close)(snd_ctl_ext_t *ext);
00150         int (*elem_count)(snd_ctl_ext_t *ext);
00154         int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id);
00158         snd_ctl_ext_key_t (*find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id);
00162         void (*free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key);
00166         int (*get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
00167                              int *type, unsigned int *acc, unsigned int *count);
00171         int (*get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
00172                                 long *imin, long *imax, long *istep);
00176         int (*get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key,
00177                                   int64_t *imin, int64_t *imax, int64_t *istep);
00181         int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
00185         int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item,
00186                                    char *name, size_t name_max_len);
00190         int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
00194         int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
00198         int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
00202         int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
00203                           size_t max_bytes);
00207         int (*read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
00211         int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value);
00215         int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value);
00219         int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items);
00223         int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data,
00224                            size_t max_bytes);
00228         int (*write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958);
00232         void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe);
00236         int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask);
00240         int (*poll_descriptors_count)(snd_ctl_ext_t *ext);
00244         int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space);
00248         int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents);
00249 };
00250 
00254 typedef enum snd_ctl_ext_access {
00255         SND_CTL_EXT_ACCESS_READ = (1<<0),
00256         SND_CTL_EXT_ACCESS_WRITE = (1<<1),
00257         SND_CTL_EXT_ACCESS_READWRITE = (3<<0),
00258         SND_CTL_EXT_ACCESS_VOLATILE = (1<<2),
00259         SND_CTL_EXT_ACCESS_TLV_READ = (1<<4),
00260         SND_CTL_EXT_ACCESS_TLV_WRITE = (1<<5),
00261         SND_CTL_EXT_ACCESS_TLV_READWRITE = (3<<4),
00262         SND_CTL_EXT_ACCESS_TLV_COMMAND = (1<<6),
00263         SND_CTL_EXT_ACCESS_INACTIVE = (1<<8),
00264         SND_CTL_EXT_ACCESS_TLV_CALLBACK = (1<<28),
00265 } snd_ctl_ext_access_t;
00266 
00270 #define SND_CTL_EXT_KEY_NOT_FOUND       (snd_ctl_ext_key_t)(-1)
00271 
00272 int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode);
00273 int snd_ctl_ext_delete(snd_ctl_ext_t *ext);
00274 
00277 #ifdef __cplusplus
00278 }
00279 #endif
00280 
00281 #endif /* __ALSA_CONTROL_EXTERNAL_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines