Changeset 3312:f425c2ff782d in roaraudio for libroar/vio_dstr.c
- Timestamp:
- 02/03/10 14:03:41 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroar/vio_dstr.c
r3311 r3312 36 36 37 37 #ifndef ROAR_WITHOUT_VIO_DSTR 38 struct {38 struct _roar_vio_dstr_type { 39 39 int id; 40 40 char * name; … … 212 212 } 213 213 214 char * roar_vio_dstr_get_name(int type) {214 struct _roar_vio_dstr_type * roar_vio_dstr_get_by_type (int type) { 215 215 int i; 216 216 217 217 for (i = 0; _roar_vio_dstr_objs[i].id != ROAR_VIO_DSTR_OBJT_EOL; i++) { 218 218 if ( _roar_vio_dstr_objs[i].id == type ) 219 return _roar_vio_dstr_objs[i].name; 220 } 219 return &(_roar_vio_dstr_objs[i]); 220 } 221 222 return NULL; 223 } 224 225 char * roar_vio_dstr_get_name(int type) { 226 struct _roar_vio_dstr_type * ret; 227 228 if ( (ret = roar_vio_dstr_get_by_type(type)) != NULL ) 229 return ret->name; 221 230 222 231 if ( type == ROAR_VIO_DSTR_OBJT_EOL ) … … 224 233 225 234 return NULL; 235 } 236 237 int roar_vio_dstr_register_type(int type, 238 char *name, 239 int (*setdef) (struct roar_vio_dstr_chain * cur, 240 struct roar_vio_dstr_chain * next), 241 int (*openvio)(struct roar_vio_calls * calls, 242 struct roar_vio_calls * dst, 243 struct roar_vio_dstr_chain * cur)) { 244 struct _roar_vio_dstr_type * ret; 245 246 if ( (ret = roar_vio_dstr_get_by_type(type)) == NULL ) /* we can currently not register new types */ 247 return -1; 248 249 250 // check if things are allready set, we do not want to allow overwrite here. 251 if ( setdef != NULL && ret->setdef != NULL ) 252 return -1; 253 254 if ( openvio != NULL && ret->openvio != NULL ) 255 return -1; 256 257 if ( setdef != NULL ) 258 ret->setdef = setdef; 259 260 if ( openvio != NULL ) 261 ret->openvio = openvio; 262 263 return 0; 226 264 } 227 265
Note: See TracChangeset
for help on using the changeset viewer.