ALSA project - the C library reference
|
00001 00011 /* 00012 * This library is free software; you can redistribute it and/or modify 00013 * it under the terms of the GNU Lesser General Public License as 00014 * published by the Free Software Foundation; either version 2.1 of 00015 * the License, or (at your option) any later version. 00016 * 00017 * This program is distributed in the hope that it will be useful, 00018 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00019 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00020 * GNU Lesser General Public License for more details. 00021 * 00022 * You should have received a copy of the GNU Lesser General Public 00023 * License along with this library; if not, write to the Free Software 00024 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 00025 * 00026 */ 00027 00028 #ifndef __ALSA_GLOBAL_H_ 00029 #define __ALSA_GLOBAL_H_ 00030 00031 /* for timeval and timespec */ 00032 #include <time.h> 00033 00034 #ifdef __cplusplus 00035 extern "C" { 00036 #endif 00037 00047 const char *snd_asoundlib_version(void); 00048 00049 #ifndef ATTRIBUTE_UNUSED 00050 00051 #define ATTRIBUTE_UNUSED __attribute__ ((__unused__)) 00052 #endif 00053 00054 #ifdef PIC /* dynamic build */ 00055 00057 #define __SND_DLSYM_VERSION(name, version) _ ## name ## version 00058 00062 #define SND_DLSYM_BUILD_VERSION(name, version) char __SND_DLSYM_VERSION(name, version); 00063 00064 #else /* static build */ 00065 00066 struct snd_dlsym_link { 00067 struct snd_dlsym_link *next; 00068 const char *dlsym_name; 00069 const void *dlsym_ptr; 00070 }; 00071 00072 extern struct snd_dlsym_link *snd_dlsym_start; 00073 00075 #define __SND_DLSYM_VERSION(prefix, name, version) _ ## prefix ## name ## version 00076 00080 #define SND_DLSYM_BUILD_VERSION(name, version) \ 00081 static struct snd_dlsym_link __SND_DLSYM_VERSION(snd_dlsym_, name, version); \ 00082 void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) __attribute__ ((constructor)); \ 00083 void __SND_DLSYM_VERSION(snd_dlsym_constructor_, name, version) (void) { \ 00084 __SND_DLSYM_VERSION(snd_dlsym_, name, version).next = snd_dlsym_start; \ 00085 __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_name = # name; \ 00086 __SND_DLSYM_VERSION(snd_dlsym_, name, version).dlsym_ptr = (void *)&name; \ 00087 snd_dlsym_start = &__SND_DLSYM_VERSION(snd_dlsym_, name, version); \ 00088 } 00089 00090 #endif 00091 00092 #ifndef __STRING 00093 00094 #define __STRING(x) #x 00095 #endif 00096 00098 #define SND_DLSYM_VERSION(version) __STRING(version) 00099 00100 void *snd_dlopen(const char *file, int mode); 00101 void *snd_dlsym(void *handle, const char *name, const char *version); 00102 int snd_dlclose(void *handle); 00103 00104 00106 #define __snd_alloca(ptr,type) do { *ptr = (type##_t *) alloca(type##_sizeof()); memset(*ptr, 0, type##_sizeof()); } while (0) 00107 00114 typedef struct _snd_async_handler snd_async_handler_t; 00115 00121 typedef void (*snd_async_callback_t)(snd_async_handler_t *handler); 00122 00123 int snd_async_add_handler(snd_async_handler_t **handler, int fd, 00124 snd_async_callback_t callback, void *private_data); 00125 int snd_async_del_handler(snd_async_handler_t *handler); 00126 int snd_async_handler_get_fd(snd_async_handler_t *handler); 00127 int snd_async_handler_get_signo(snd_async_handler_t *handler); 00128 void *snd_async_handler_get_callback_private(snd_async_handler_t *handler); 00129 00130 struct snd_shm_area *snd_shm_area_create(int shmid, void *ptr); 00131 struct snd_shm_area *snd_shm_area_share(struct snd_shm_area *area); 00132 int snd_shm_area_destroy(struct snd_shm_area *area); 00133 00134 int snd_user_file(const char *file, char **result); 00135 00136 #if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE) 00137 struct timeval { 00138 time_t tv_sec; /* seconds */ 00139 long tv_usec; /* microseconds */ 00140 }; 00141 00142 struct timespec { 00143 time_t tv_sec; /* seconds */ 00144 long tv_nsec; /* nanoseconds */ 00145 }; 00146 #endif 00147 00149 typedef struct timeval snd_timestamp_t; 00151 typedef struct timespec snd_htimestamp_t; 00152 00155 #ifdef __cplusplus 00156 } 00157 #endif 00158 00159 #endif /* __ALSA_GLOBAL_H */