Changeset 5533:42f48072307c in roaraudio for roarclients/roarradio.c
- Timestamp:
- 06/12/12 14:39:40 (12 years ago)
- Branch:
- default
- Phase:
- public
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
roarclients/roarradio.c
r5381 r5533 35 35 printf("\nOptions:\n\n"); 36 36 37 printf(" --server SERVER - Set server hostname\n" 38 " --rate RATE - Set sample rate\n" 39 " --bits BITS - Set bits per sample\n" 40 " --chans CHANNELS - Set number of channels\n" 41 " --codec CODEC - Set the codec\n" 42 " --help - Show this help\n" 37 printf(" --server SERVER - Set server hostname\n" 38 " --rate -R RATE - Set sample rate\n" 39 " --bits -B BITS - Set bits per sample\n" 40 " --chans -C CHANNELS - Set number of channels\n" 41 " --codec -E CODEC - Set the codec\n" 42 " --aiprofile PROFILE - Set audio profile\n" 43 " --help - Show this help\n" 43 44 ); 44 45 … … 51 52 52 53 int main (int argc, char * argv[]) { 53 int rate = 44100; 54 int bits = 16; 55 int channels = 2; 56 int codec = ROAR_CODEC_OGG_VORBIS; 54 struct roar_audio_info info; 57 55 char * server = NULL; 58 56 char * k; … … 69 67 ssize_t slen; 70 68 69 if ( roar_profile2info(&info, "default") == -1 ) 70 return 1; 71 72 info.codec = ROAR_CODEC_OGG_VORBIS; 73 71 74 for (i = 1; i < argc; i++) { 72 75 k = argv[i]; … … 74 77 if ( strcmp(k, "--server") == 0 ) { 75 78 server = argv[++i]; 76 } else if ( strcmp(k, "--rate") == 0 ) { 77 rate = roar_str2rate(argv[++i]); 78 } else if ( strcmp(k, "--bits") == 0 ) { 79 bits = roar_str2bits(argv[++i]); 80 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) { 81 channels = roar_str2channels(argv[++i]); 82 } else if ( strcmp(k, "--codec") == 0 ) { 83 codec = roar_str2codec(argv[++i]); 79 } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) { 80 info.rate = roar_str2rate(argv[++i]); 81 } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) { 82 info.bits = roar_str2bits(argv[++i]); 83 } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) { 84 info.channels = roar_str2channels(argv[++i]); 85 } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) { 86 info.codec = roar_str2codec(argv[++i]); 87 } else if ( !strcmp(k, "--aiprofile") ) { 88 if ( roar_profile2info(&info, argv[++i]) == -1 ) { 89 fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 90 return 1; 91 } 84 92 } else if ( strcmp(k, "--help") == 0 ) { 85 93 usage(); … … 206 214 } 207 215 208 if ( roar_stream_new(stream, rate, channels, bits,codec) == -1 ) {216 if ( roar_stream_new(stream, info.rate, info.channels, info.bits, info.codec) == -1 ) { 209 217 roar_disconnect(con); 210 218 return 1;
Note: See TracChangeset
for help on using the changeset viewer.