Changeset 2228:4447191f6703 in roaraudio


Ignore:
Timestamp:
07/28/09 02:15:55 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

started a function to parse the server type

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarinterconnect.c

    r2227 r2228  
    3333#define MT_ROAR    0x10 
    3434#define MT_ESD     0x20 
     35#define MT_DEFAULT MT_ROAR 
    3536 
    3637#define ST_NONE    0x00 
     
    3839#define ST_BIDIR   0x01 
    3940#define ST_FILTER  0x02 
     41// no default here as the default depend on the server type 
    4042 
    4143void usage (void) { 
     
    5658} 
    5759 
     60int parse_type (char * type) { 
     61 int ret = 0; 
     62 
     63 if ( type != NULL ) { 
     64 } 
     65 
     66 if ( (ret & MT_MASK) == MT_NONE ) 
     67  ret |= MT_DEFAULT; 
     68 
     69 if ( (ret & ST_MASK) == ST_NONE ) { 
     70  switch (ret & MT_MASK) { 
     71   case MT_ROAR: ret |= ST_BIDIR;  break; 
     72   case MT_ESD:  ret |= ST_FILTER; break; 
     73   default: 
     74     return MT_NONE|ST_NONE; // error case 
     75    break; 
     76  } 
     77 } 
     78 
     79 return ret; 
     80} 
     81 
    5882int main (int argc, char * argv[]) { 
    5983 struct roar_connection con[1]; 
     
    6387 int    channels = 2; 
    6488 int    codec    = ROAR_CODEC_DEFAULT; 
    65  int    type     = MT_ROAR|ST_BIDIR; 
     89 int    type     = parse_type(NULL); 
    6690 int    tmp; 
    6791 char * server   = NULL; 
     
    78102  } else if ( strcmp(k, "--remote") == 0 ) { 
    79103   remote = argv[++i]; 
     104  } else if ( strcmp(k, "--type") == 0 ) { 
     105   type = parse_type(argv[++i]); 
    80106  } else if ( strcmp(k, "--rate") == 0 ) { 
    81107   rate = atoi(argv[++i]); 
Note: See TracChangeset for help on using the changeset viewer.