Changeset 5533:42f48072307c in roaraudio for roarclients/roarinterconnect.c
- Timestamp:
- 06/12/12 14:39:40 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarinterconnect.c
r5381 r5533 76 76 printf("\nOptions:\n\n"); 77 77 78 printf(" --server SERVER - Set server hostname\n" 79 " --remote SERVER - Set remote server\n" 80 " --type TYPE - Set type of remote server\n" 81 " --rate RATE - Set sample rate\n" 82 " --bits BITS - Set bits per sample\n" 83 " --chans CHANNELS - Set number of channels\n" 84 " --codec CODEC - Set the codec\n" 85 " --help - Show this help\n" 86 " --verbose -v - Be verbose\n" 78 printf(" --server SERVER - Set server hostname\n" 79 " --remote SERVER - Set remote server\n" 80 " --type TYPE - Set type of remote server\n" 81 " --rate -R RATE - Set sample rate\n" 82 " --bits -B BITS - Set bits per sample\n" 83 " --chans -C CHANNELS - Set number of channels\n" 84 " --codec -E CODEC - Set the codec\n" 85 " --aiprofile PROFILE - Set audio profile\n" 86 " --help - Show this help\n" 87 " --verbose -v - Be verbose\n" 87 88 ); 88 89 89 90 printf("\nPossible Types:\n\n"); 90 printf(" roar - RoarAudio Server\n"91 printf(" roar - RoarAudio Server\n" 91 92 #ifdef ROAR_HAVE_ESD 92 " esd - EsounD Server\n"93 #endif 94 " simple - PulseAudio using simple protocol\n"93 " esd - EsounD Server\n" 94 #endif 95 " simple - PulseAudio using simple protocol\n" 95 96 #ifdef _HAVE_OSS 96 " oss - Open Sound System (OSS) device\n"97 " oss - Open Sound System (OSS) device\n" 97 98 #endif 98 99 #ifdef _HAVE_RSOUND 99 " rsound - RSound server\n"100 " rsound - RSound server\n" 100 101 #endif 101 102 "\n" 102 " bidir - Connect bidirectional\n"103 " filter - Use local server as filter for remote server\n"104 " transmit - Transmit data from local server to remote server\n"105 " receive - Receive data from remote server\n"106 " recplay - Record from and play data to remote server\n"107 " record - Record data from remote server\n"103 " bidir - Connect bidirectional\n" 104 " filter - Use local server as filter for remote server\n" 105 " transmit - Transmit data from local server to remote server\n" 106 " receive - Receive data from remote server\n" 107 " recplay - Record from and play data to remote server\n" 108 " record - Record data from remote server\n" 108 109 ); 109 110 … … 257 258 struct roar_stream stream[1]; 258 259 struct roar_vio_calls vio; 259 #ifdef _HAVE_OSS260 260 struct roar_audio_info info; 261 #endif262 261 #ifdef _HAVE_RSOUND 263 262 rsound_t *rd; 264 263 enum rsd_format fmt = 0; 265 264 #endif 266 int rate = 44100;267 int bits = 16;268 int channels = 2;269 int codec = ROAR_CODEC_DEFAULT;270 265 int type = parse_type(NULL); 271 266 int tmp; … … 278 273 int rport; 279 274 275 if ( roar_profile2info(&info, "default") == -1 ) 276 return 1; 277 280 278 for (i = 1; i < argc; i++) { 281 279 k = argv[i]; … … 287 285 } else if ( strcmp(k, "--type") == 0 ) { 288 286 type = parse_type(argv[++i]); 289 } else if ( strcmp(k, "--rate") == 0 ) { 290 rate = roar_str2rate(argv[++i]); 291 } else if ( strcmp(k, "--bits") == 0 ) { 292 bits = roar_str2bits(argv[++i]); 293 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) { 294 channels = roar_str2channels(argv[++i]); 295 } else if ( strcmp(k, "--codec") == 0 ) { 296 codec = roar_str2codec(argv[++i]); 287 } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) { 288 info.rate = roar_str2rate(argv[++i]); 289 } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) { 290 info.bits = roar_str2bits(argv[++i]); 291 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) { 292 info.channels = roar_str2channels(argv[++i]); 293 } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) { 294 info.codec = roar_str2codec(argv[++i]); 295 } else if ( !strcmp(k, "--aiprofile") ) { 296 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 297 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 298 return 1; 299 } 297 300 } else if ( strcmp(k, "--verbose") == 0 || strcmp(k, "-v") == 0 ) { 298 301 g_verbose++; … … 339 342 return 2; 340 343 } 341 if ( roar_vio_simple_stream(&vio, rate, channels, bits, codec, remote, tmp, CLIENT_NAME, -1) == -1 ) { 344 if ( roar_vio_simple_stream(&vio, 345 info.rate, info.channels, info.bits, info.codec, 346 remote, tmp, CLIENT_NAME, -1) == -1 ) { 342 347 fprintf(stderr, "Error: can not open RoarAudio stream to %s: %s\n", remote, roar_error2str(roar_error)); 343 348 return 2; … … 374 379 return 2; 375 380 } 376 info.rate = rate;377 info.channels = channels;378 info.bits = bits;379 info.codec = codec;380 381 if ( roar_cdriver_oss(&vio, "OSS", remote, &info, tmp) == -1 ) { 381 382 fprintf(stderr, "Error: can not open OSS device %s: %s\n", remote, roar_error2str(roar_error)); … … 393 394 tmp = ESD_STREAM|ESD_PLAY; 394 395 395 switch ( bits) {396 switch (info.bits) { 396 397 case 8: tmp |= ESD_BITS8; break; 397 398 case 16: tmp |= ESD_BITS16; break; … … 401 402 } 402 403 403 switch ( channels) {404 switch (info.channels) { 404 405 case 1: tmp |= ESD_MONO; break; 405 406 case 2: tmp |= ESD_STEREO; break; … … 410 411 411 412 // TODO: FIXME: this is only true if the esd runs on a LE system,... 412 if ( bits == 8 &&codec != ROAR_CODEC_PCM_U_LE ) {413 if ( info.bits == 8 && info.codec != ROAR_CODEC_PCM_U_LE ) { 413 414 fprintf(stderr, "Error: EsounD only supports unsigned PCM in 8 bit mode\n"); 414 415 return 2; 415 } else if ( bits == 16 &&codec != ROAR_CODEC_DEFAULT ) {416 } else if ( info.bits == 16 && info.codec != ROAR_CODEC_DEFAULT ) { 416 417 fprintf(stderr, "Error: EsounD only supports signed PCM in 16 bit mode\n"); 417 418 return 2; … … 420 421 switch (type & ST_MASK) { 421 422 case ST_FILTER: 422 rfh = esd_filter_stream(tmp, rate, remote, CLIENT_NAME);423 rfh = esd_filter_stream(tmp, info.rate, remote, CLIENT_NAME); 423 424 break; 424 425 case ST_TRANSMIT: 425 rfh = esd_play_stream(tmp, rate, remote, CLIENT_NAME);426 rfh = esd_play_stream(tmp, info.rate, remote, CLIENT_NAME); 426 427 localdir = ROAR_DIR_MONITOR; 427 428 break; 428 429 case ST_RECEIVE: 429 rfh = esd_monitor_stream(tmp, rate, remote, CLIENT_NAME);430 rfh = esd_monitor_stream(tmp, info.rate, remote, CLIENT_NAME); 430 431 localdir = ROAR_DIR_PLAY; 431 432 break; … … 439 440 #ifdef _HAVE_RSOUND 440 441 case MT_RSOUND: 441 fmt = para2rsdfmt( bits,codec);442 fmt = para2rsdfmt(info.bits, info.codec); 442 443 443 444 if ( fmt == 0 ) { … … 452 453 rsd_init(&rd); 453 454 rsd_set_param(rd, RSD_HOST, remote); 454 rsd_set_param(rd, RSD_CHANNELS, &channels); 455 rsd_set_param(rd, RSD_SAMPLERATE, &rate); 455 tmp = info.channels; 456 rsd_set_param(rd, RSD_CHANNELS, &tmp); 457 tmp = info.rate; 458 rsd_set_param(rd, RSD_SAMPLERATE, &tmp); 456 459 rsd_set_param(rd, RSD_FORMAT, &fmt); 457 460 #ifdef RSD_IDENTITY … … 526 529 } 527 530 528 if ( roar_stream_new(stream, rate, channels, bits,codec) == -1 ) {531 if ( roar_stream_new(stream, info.rate, info.channels, info.bits, info.codec) == -1 ) { 529 532 roar_disconnect(con); 530 533 return 21;
Note: See TracChangeset
for help on using the changeset viewer.