Changeset 5533:42f48072307c in roaraudio for roarclients/roarshout.c


Ignore:
Timestamp:
06/12/12 14:39:40 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

Fixed usage of -R/-B/-C/-E as well as --aiprofile in roarclients (Closes: #176)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarshout.c

    r5381 r5533  
    3737 
    3838 printf("    --server SERVER    - Set server hostname\n" 
    39         "    --rate   RATE      - Set sample rate\n" 
    40         "    --bits   BITS      - Set bits per sample\n" 
    41         "    --chans  CHANNELS  - Set number of channels\n" 
    42         "    --codec  CODEC     - Set the codec\n" 
     39        " -R --rate   RATE      - Set sample rate\n" 
     40        " -B --bits   BITS      - Set bits per sample\n" 
     41        " -C --chans  CHANNELS  - Set number of channels\n" 
     42        " -E --codec  CODEC     - Set the codec\n" 
     43        "    --aiprofile PROFILE\n" 
     44        "                       - Set audio profile\n" 
    4345        " -h --help             - Show this help\n" 
    4446        "    --pw-arg           - Password is supplied as argument (default).\n" 
     
    9092int main (int argc, char * argv[]) { 
    9193 enum { ARG, ASK, DSTR } pw_source = ARG; 
    92  int    rate     = 44100; 
    93  int    bits     = 16; 
    94  int    channels = 2; 
    95  int    codec    = ROAR_CODEC_OGG_VORBIS; 
     94 struct roar_audio_info info; 
    9695 char * server   = NULL; 
    9796 char * k; 
     
    113112 char password_buf[128]; 
    114113 
     114 if ( roar_profile2info(&info, "default") == -1 ) 
     115  return 1; 
     116 
     117 info.codec = ROAR_CODEC_OGG_VORBIS; 
     118 
    115119 for (i = 1; i < argc; i++) { 
    116120  k = argv[i]; 
     
    118122  if ( strcmp(k, "--server") == 0 ) { 
    119123   server = argv[++i]; 
    120   } else if ( strcmp(k, "--rate") == 0 ) { 
    121    rate = roar_str2rate(argv[++i]); 
    122   } else if ( strcmp(k, "--bits") == 0 ) { 
    123    bits = roar_str2bits(argv[++i]); 
    124   } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 ) { 
    125    channels = roar_str2channels(argv[++i]); 
    126   } else if ( strcmp(k, "--codec") == 0 ) { 
    127    codec = roar_str2codec(argv[++i]); 
     124  } else if ( strcmp(k, "--rate") == 0 || strcmp(k, "-R") == 0 ) { 
     125   info.rate = roar_str2rate(argv[++i]); 
     126  } else if ( strcmp(k, "--bits") == 0 || strcmp(k, "-B") == 0 ) { 
     127   info.bits = roar_str2bits(argv[++i]); 
     128  } else if ( strcmp(k, "--channels") == 0 || strcmp(k, "--chans") == 0 || strcmp(k, "-C") == 0 ) { 
     129   info.channels = roar_str2channels(argv[++i]); 
     130  } else if ( strcmp(k, "--codec") == 0 || strcmp(k, "-E") == 0 ) { 
     131   info.codec = roar_str2codec(argv[++i]); 
     132  } else if ( !strcmp(k, "--aiprofile") ) { 
     133   if ( roar_profile2info(&info, argv[++i]) == -1 ) { 
     134    fprintf(stderr, "Error: Can not load audio profile: %s: %s\n", argv[i], roar_error2str(roar_error)); 
     135    return 1; 
     136   } 
    128137  } else if ( strcmp(k, "--pw-arg") == 0 ) { 
    129138   pw_source = ARG; 
     
    254263  shout_set_url(shout, s_url); 
    255264 
    256  if ( (vss = roar_vs_new_simple(server, "roarshout", rate, channels, codec, bits, ROAR_DIR_MONITOR, &err)) == NULL ) { 
     265 if ( (vss = roar_vs_new_simple(server, "roarshout", 
     266                                info.rate, info.channels, info.codec, info.bits, 
     267                                ROAR_DIR_MONITOR, &err)) == NULL ) { 
    257268  fprintf(stderr, "Error: can not start monitoring: %s\n", roar_vs_strerr(err)); 
    258269  return 1; 
Note: See TracChangeset for help on using the changeset viewer.