Changeset 3455:5a26f2fec851 in roaraudio for libroarpulse/channelmap.c
- Timestamp:
- 02/13/10 21:14:01 (14 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
libroarpulse/channelmap.c
r3422 r3455 192 192 193 193 /** Parse a channel position list into a channel map structure. \since 0.8.1 */ 194 pa_channel_map *pa_channel_map_parse(pa_channel_map *map, const char *s); 194 pa_channel_map *pa_channel_map_parse(pa_channel_map *map, const char *s) { 195 int i; 196 char * c; 197 size_t len; 198 pa_channel_position_t * v; 199 200 if ( map == NULL ) 201 return NULL; 202 203 map->channels = 0; 204 205 if ( s == NULL ) 206 return map; 207 208 while (*s != 0) { 209 c = strstr(s, ","); 210 211 if ( c == NULL ) { 212 len = strlen(s); 213 } else { 214 len = c - s; 215 } 216 217 v = &(map->map[map->channels++]); 218 219 *v = PA_CHANNEL_POSITION_INVALID; 220 221 for (i = 0; *v != PA_CHANNEL_POSITION_INVALID && _roar_po_chanpos[i].name != NULL; i++) { 222 if ( !strncasecmp(_roar_po_chanpos[i].name, s, len) && _roar_po_chanpos[i].name[len] == 0 ) { 223 *v = _roar_po_chanpos[i].pos; 224 } 225 } 226 227 if ( c == NULL ) { 228 break; 229 } else { 230 s = c + 1; 231 } 232 } 233 234 return map; 235 } 195 236 196 237 /** Compare two channel maps. Return 1 if both match. */
Note: See TracChangeset
for help on using the changeset viewer.