ALSA project - the C library reference
|
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; 00063 #ifdef DOC_HIDDEN 00064 /* redefine typedef's for stupid doxygen */ 00065 typedef snd_ctl_ext snd_ctl_ext_t; 00066 typedef snd_ctl_ext_callback snd_ctl_ext_callback_t; 00067 #endif 00068 00069 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, 00070 unsigned int *tlv, unsigned int tlv_size); 00071 00072 /* 00073 * Protocol version 00074 */ 00075 #define SND_CTL_EXT_VERSION_MAJOR 1 00076 #define SND_CTL_EXT_VERSION_MINOR 0 00077 #define SND_CTL_EXT_VERSION_TINY 1 00081 #define SND_CTL_EXT_VERSION ((SND_CTL_EXT_VERSION_MAJOR<<16) |\ 00082 (SND_CTL_EXT_VERSION_MINOR<<8) |\ 00083 (SND_CTL_EXT_VERSION_TINY)) 00084 00086 struct snd_ctl_ext { 00091 unsigned int version; 00095 int card_idx; 00099 char id[16]; 00103 char driver[16]; 00107 char name[32]; 00111 char longname[80]; 00115 char mixername[80]; 00119 int poll_fd; 00120 00124 const snd_ctl_ext_callback_t *callback; 00128 void *private_data; 00132 snd_ctl_t *handle; 00133 00134 int nonblock; 00135 int subscribed; 00140 union { 00141 snd_ctl_ext_tlv_rw_t *c; 00142 const unsigned int *p; 00143 } tlv; 00144 }; 00145 00147 struct snd_ctl_ext_callback { 00151 void (*close)(snd_ctl_ext_t *ext); 00155 int (*elem_count)(snd_ctl_ext_t *ext); 00159 int (*elem_list)(snd_ctl_ext_t *ext, unsigned int offset, snd_ctl_elem_id_t *id); 00163 snd_ctl_ext_key_t (*find_elem)(snd_ctl_ext_t *ext, const snd_ctl_elem_id_t *id); 00167 void (*free_key)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key); 00171 int (*get_attribute)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, 00172 int *type, unsigned int *acc, unsigned int *count); 00176 int (*get_integer_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, 00177 long *imin, long *imax, long *istep); 00181 int (*get_integer64_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, 00182 int64_t *imin, int64_t *imax, int64_t *istep); 00186 int (*get_enumerated_info)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items); 00190 int (*get_enumerated_name)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int item, 00191 char *name, size_t name_max_len); 00195 int (*read_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value); 00199 int (*read_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value); 00203 int (*read_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items); 00207 int (*read_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data, 00208 size_t max_bytes); 00212 int (*read_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958); 00216 int (*write_integer)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, long *value); 00220 int (*write_integer64)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, int64_t *value); 00224 int (*write_enumerated)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned int *items); 00228 int (*write_bytes)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, unsigned char *data, 00229 size_t max_bytes); 00233 int (*write_iec958)(snd_ctl_ext_t *ext, snd_ctl_ext_key_t key, snd_aes_iec958_t *iec958); 00237 void (*subscribe_events)(snd_ctl_ext_t *ext, int subscribe); 00241 int (*read_event)(snd_ctl_ext_t *ext, snd_ctl_elem_id_t *id, unsigned int *event_mask); 00245 int (*poll_descriptors_count)(snd_ctl_ext_t *ext); 00249 int (*poll_descriptors)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int space); 00253 int (*poll_revents)(snd_ctl_ext_t *ext, struct pollfd *pfds, unsigned int nfds, unsigned short *revents); 00254 }; 00255 00259 typedef enum snd_ctl_ext_access { 00260 SND_CTL_EXT_ACCESS_READ = (1<<0), 00261 SND_CTL_EXT_ACCESS_WRITE = (1<<1), 00262 SND_CTL_EXT_ACCESS_READWRITE = (3<<0), 00263 SND_CTL_EXT_ACCESS_VOLATILE = (1<<2), 00264 SND_CTL_EXT_ACCESS_TLV_READ = (1<<4), 00265 SND_CTL_EXT_ACCESS_TLV_WRITE = (1<<5), 00266 SND_CTL_EXT_ACCESS_TLV_READWRITE = (3<<4), 00267 SND_CTL_EXT_ACCESS_TLV_COMMAND = (1<<6), 00268 SND_CTL_EXT_ACCESS_INACTIVE = (1<<8), 00269 SND_CTL_EXT_ACCESS_TLV_CALLBACK = (1<<28), 00270 } snd_ctl_ext_access_t; 00271 00275 #define SND_CTL_EXT_KEY_NOT_FOUND (snd_ctl_ext_key_t)(-1) 00276 00277 int snd_ctl_ext_create(snd_ctl_ext_t *ext, const char *name, int mode); 00278 int snd_ctl_ext_delete(snd_ctl_ext_t *ext); 00279 00282 #ifdef __cplusplus 00283 } 00284 #endif 00285 00286 #endif /* __ALSA_CONTROL_EXTERNAL_H */