Changeset 5533:42f48072307c in roaraudio for roarclients/roarmonhttp.c
- Timestamp:
- 06/12/12 14:39:40 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarmonhttp.c
r5381 r5533 47 47 " --bits -B BITS - Set bits per sample\n" 48 48 " --chans -C CHANNELS - Set number of channels\n" 49 " --codec CODEC - Set the codec\n" 49 " --codec -E CODEC - Set the codec\n" 50 " --aiprofile PROFILE - Set audio profile\n" 50 51 " --rel-id ID - Set ID of relative stream\n" 51 52 " --inetd - Start in inetd mode (STDIN and STDOUT connected to socket)\n" … … 231 232 232 233 int main (int argc, char * argv[]) { 233 int rate = 44100; 234 int bits = 16; 235 int channels = 2; 236 int codec = ROAR_CODEC_OGG_VORBIS; 234 struct roar_audio_info info; 237 235 int rel_id = -1; 238 236 int sflags = ROAR_FLAG_NONE; … … 252 250 #endif 253 251 252 if ( roar_profile2info(&info, "default") == -1 ) 253 return 1; 254 255 info.codec = ROAR_CODEC_OGG_VORBIS; 256 254 257 for (i = 1; i < argc; i++) { 255 258 k = argv[i]; … … 263 266 } else if ( !strcmp(k, "--server") ) { 264 267 roar_libroar_set_server(argv[++i]); 265 } else if ( !strcmp(k, "--codec") ) {266 codec = roar_str2codec(argv[++i]);268 } else if ( !strcmp(k, "--codec") || !strcmp(k, "-E") ) { 269 info.codec = roar_str2codec(argv[++i]); 267 270 } else if ( !strcmp(k, "--rate") || !strcmp(k, "-r") || !strcmp(k, "-R") ) { 268 rate = roar_str2rate(argv[++i]);271 info.rate = roar_str2rate(argv[++i]); 269 272 } else if ( !strcmp(k, "--bits") || !strcmp(k, "-B") ) { 270 bits = roar_str2bits(argv[++i]);273 info.bits = roar_str2bits(argv[++i]); 271 274 } else if ( !strcmp(k, "--channels") || !strcmp(k, "--chans") || !strcmp(k, "-C") ) { 272 channels = roar_str2channels(argv[++i]); 275 info.channels = roar_str2channels(argv[++i]); 276 } else if ( !strcmp(k, "--aiprofile") ) { 277 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 278 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 279 return 1; 280 } 273 281 } else if ( !strcmp(k, "--rel-id") ) { 274 282 rel_id = atoi(argv[++i]); … … 294 302 295 303 if ( !strcmp(k, "codec") ) { 296 if ( ( codec = roar_str2codec(v)) == -1)304 if ( (info.codec = roar_str2codec(v)) == ROAR_AUDIO_INFO_INVALID ) 297 305 return 1; 298 306 } else if ( !strcmp(k, "channels") ) { 299 channels = roar_str2channels(v);307 info.channels = roar_str2channels(v); 300 308 } else if ( !strcmp(k, "rate") ) { 301 rate = roar_str2rate(v);309 info.rate = roar_str2rate(v); 302 310 } else if ( !strcmp(k, "bits") ) { 303 bits = roar_str2bits(v); 311 info.bits = roar_str2bits(v); 312 } else if ( !strcmp(k, "aiprofile") ) { 313 if ( roar_profile2info(&info, v) == -1 ) 314 return 1; 304 315 } else if ( !strcmp(k, "rel-id") || !strcmp(k, "relid") ) { 305 316 rel_id = atoi(v); … … 328 339 } 329 340 330 if ( roar_stream_new(&s, rate, channels, bits,codec) == -1 ) {341 if ( roar_stream_new(&s, info.rate, info.channels, info.bits, info.codec) == -1 ) { 331 342 roar_disconnect(&con); 332 343 return 20; … … 361 372 362 373 if ( !gopher ) 363 print_header( codec, rate,channels);374 print_header(info.codec, info.rate, info.channels); 364 375 365 376 /*
Note: See TracChangeset
for help on using the changeset viewer.