Main Page   Compound List   File List   Compound Members   File Members  

cslmain.h

Go to the documentation of this file.
00001 /* CSL - Common Sound Layer
00002  * Copyright (C) 2000-2001 Stefan Westerfeld and Tim Janik
00003  *
00004  * This library is free software; you can redistribute it and/or
00005  * modify it under the terms of the GNU Lesser General Public
00006  * License as published by the Free Software Foundation; either
00007  * version 2 of the License, or (at your option) any later version.
00008  *
00009  * This library is distributed in the hope that it will be useful,
00010  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00011  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00012  * Lesser General Public License for more details.
00013  *
00014  * You should have received a copy of the GNU Lesser General
00015  * Public License along with this library; if not, write to the
00016  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
00017  * Boston, MA 02111-1307, USA.
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 /* __cplusplus */
00029 
00035 /* --- CSL Driver API --- */
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    /* driver capabilities */
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 /* standard drivers */
00117 
00124 #define CSL_DRIVER_NAME_ARTS    "arts"
00125 
00132 #define CSL_DRIVER_NAME_OSS     "oss"
00133 
00134 
00135 /* --- main API --- */
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 /* --- convenience functions --- */
00153 
00158 typedef struct _CslOptions CslOptions;
00159 
00164 struct _CslOptions
00165 {
00167   unsigned int  float_samples : 1;      /* whether samples are of type float (-F option) */
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   /* Proposed */
00202 typedef struct _CslPollFD {
00203   int fd;           /* file descriptor */
00204   unsigned short events;     /* requested events */
00205   unsigned short revents;    /* returned events */
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 /* __cplusplus */
00218 
00219 #endif /* __CSL_MAIN_H__ */

Generated on Wed Oct 31 18:45:21 2001 for CSL by doxygen1.2.11.1 written by Dimitri van Heesch, © 1997-2001