00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019 #ifndef __CSL_MAIN_H__
00020 #define __CSL_MAIN_H__
00021
00022
00023 #include <csl/csldefs.h>
00024 #include <csl/cslutils.h>
00025
00026 #ifdef __cplusplus
00027 extern "C" {
00028 #endif
00029
00035
00036
00041 typedef struct _CslDriver CslDriver;
00042
00048 typedef struct _CslMutex CslMutex;
00049
00054 typedef void (*CslMutexLock) (CslMutex *mutex);
00055
00060 typedef void (*CslMutexUnlock) (CslMutex *mutex);
00061
00066 typedef void (*CslMutexDestroy) (CslMutex *mutex);
00067
00074 struct _CslMutex
00075 {
00076 void *user_data;
00077 CslMutexLock lock;
00078 CslMutexUnlock unlock;
00079 CslMutexDestroy destroy;
00080 };
00081
00087 typedef enum
00088 {
00089 CSL_ENONE,
00090 CSL_EINTERN,
00091 CSL_ENODRIVER,
00092 CSL_ENOIMPL,
00093 CSL_EBUSY,
00094 CSL_EPERMS,
00095 CSL_EIO,
00096 CSL_EFMTINVAL,
00097 CSL_EGETCAPS,
00098 CSL_ECAPSUPPORT,
00099 CSL_ESETCAPS
00100 } CslErrorType;
00101
00108 typedef enum
00109 {
00110 CSL_DRIVER_CAP_PCM = (1 << 0),
00111 CSL_DRIVER_CAP_SAMPLE = (1 << 1),
00112 CSL_DRIVER_CAP_MIXER = (1 << 2),
00113 CSL_DRIVER_CAP_MASK = 0x07
00114 } CslDriverCaps;
00115
00116
00117
00124 #define CSL_DRIVER_NAME_ARTS "arts"
00125
00132 #define CSL_DRIVER_NAME_OSS "oss"
00133
00134
00135
00136
00137 const char** csl_list_drivers (unsigned int *n_backends);
00138
00139 CslErrorType csl_driver_init (const char *driver_name,
00140 CslDriver **driver);
00141
00142 CslErrorType csl_driver_init_mutex (const char *driver_name,
00143 CslDriverCaps required_caps,
00144 CslMutex *mutex,
00145 CslDriver **driver);
00146
00147 void csl_driver_shutdown (CslDriver *driver);
00148
00149 const char* csl_strerror (CslErrorType error_type);
00150
00151
00152
00153
00158 typedef struct _CslOptions CslOptions;
00159
00164 struct _CslOptions
00165 {
00167 unsigned int float_samples : 1;
00169 unsigned int signed_samples : 1;
00171 unsigned int unsigned_samples : 1;
00173 unsigned int big_endian : 1;
00175 unsigned int little_endian : 1;
00177 unsigned int n_bits;
00179 unsigned int n_channels;
00181 unsigned int rate;
00183 CslDebugFlags debug_flags;
00185 unsigned int endianess;
00187 unsigned int pcm_format;
00188 };
00189
00190 void csl_options_parse (CslOptions *options,
00191 int *argc_p,
00192 char **argv_p[]);
00193
00194 char* csl_options_dump (CslOptions *options);
00195
00196 char* csl_options_describe (unsigned int indent);
00197
00198 char* csl_describe_pcm_format (unsigned int pcm_format);
00199
00200
00201 #if 0
00202 typedef struct _CslPollFD {
00203 int fd;
00204 unsigned short events;
00205 unsigned short revents;
00206 } CslPollFD;
00207
00208 unsigned int csl_poll_count_fds (void);
00209 unsigned int csl_poll_get_fds (unsigned int n_fds, CslPollFD *fds);
00210 void csl_poll_handle_fds (unsigned int n_fds, CslPollFD *fds);
00211 void csl_poll_wait (unsigned int time_in_ms);
00212 #endif
00213
00214
00215 #ifdef __cplusplus
00216 }
00217 #endif
00218
00219 #endif