Changeset 3312:f425c2ff782d in roaraudio
- Timestamp:
- 02/03/10 14:03:41 (14 years ago)
- Branch:
- default
- Phase:
- public
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
include/libroar/vio_dstr.h
r3309 r3312 174 174 char * roar_vio_dstr_get_name(int type); 175 175 176 int roar_vio_dstr_register_type(int type, 177 char *name, 178 int (*setdef) (struct roar_vio_dstr_chain * cur, 179 struct roar_vio_dstr_chain * next), 180 int (*openvio)(struct roar_vio_calls * calls, 181 struct roar_vio_calls * dst, 182 struct roar_vio_dstr_chain * cur)); 183 176 184 int roar_vio_dstr_init_defaults (struct roar_vio_defaults * def, int type, int o_flags, mode_t o_mode); 177 185 int roar_vio_dstr_init_defaults_c (struct roar_vio_defaults * def, int type, struct roar_vio_defaults * odef, int o_flags); -
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.