Changeset 1814:66a142f333e9 in roaraudio


Ignore:
Timestamp:
05/22/09 19:56:03 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

don't use the simple interface anymore in roarmon as we need to set the stream's rel_id

File:
1 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarmon.c

    r1808 r1814  
    4141        "  --light              - Output light control\n" 
    4242        "  --thru               - Output copy of other stream\n" 
     43        "  --rel-id ID          - Set ID of relative stream\n" 
    4344        "  --help               - Show this help\n" 
    4445       ); 
     
    5253 int    codec    = ROAR_CODEC_DEFAULT; 
    5354 int    dir      = ROAR_DIR_MONITOR; 
     55 int    rel_id   = -1; 
    5456 char * server   = NULL; 
    5557 char * k; 
     
    5860 int    out = -1; 
    5961 char buf[BUFSIZE]; 
     62 struct roar_connection con; 
     63 struct roar_stream     s; 
    6064 
    6165 for (i = 1; i < argc; i++) { 
     
    8791  } else if ( !strcmp(k, "--thru") ) { 
    8892   dir   = ROAR_DIR_THRU; 
     93  } else if ( !strcmp(k, "--rel-id") ) { 
     94   rel_id = atoi(argv[++i]); 
    8995 
    9096  } else if ( !strcmp(k, "--help") || !strcmp(k, "-h") ) { 
     
    106112  out = ROAR_STDOUT; 
    107113 
    108  if ( (fh = roar_simple_stream(rate, channels, bits, codec, server, dir, "roarmon")) == -1 ) { 
    109   fprintf(stderr, "Error: can not start monitoring\n"); 
    110   return 1; 
     114 if ( roar_simple_connect(&con, server, "roarmon") == -1 ) { 
     115  fprintf(stderr, "Error: can not connect to server\n"); 
     116  return 10; 
    111117 } 
     118 
     119 if ( roar_stream_new(&s, rate, channels, bits, codec) == -1 ) { 
     120  fprintf(stderr, "Error: can not create stream\n"); 
     121  roar_disconnect(&con); 
     122  return 20; 
     123 } 
     124 
     125 if ( rel_id != -1 ) { 
     126  if ( roar_stream_set_rel_id(&s, rel_id) ) { 
     127   fprintf(stderr, "Error: can not set id or realative stream\n"); 
     128   roar_disconnect(&con); 
     129   return 21; 
     130  } 
     131 } 
     132 
     133 if ( roar_stream_connect(&con, &s, dir) == -1 ) { 
     134  fprintf(stderr, "Error: can not connect stream to server\n"); 
     135  roar_disconnect(&con); 
     136  return 11; 
     137 } 
     138 
     139 if ( roar_stream_exec(&con, &s) == -1 ) { 
     140  fprintf(stderr, "Error: can not exec stream\n"); 
     141  roar_disconnect(&con); 
     142  return 12; 
     143 } 
     144 
     145 if ( (fh = roar_get_connection_fh(&con)) == -1 ) { 
     146  fprintf(stderr, "Error: can not get stream fh\n"); 
     147  roar_disconnect(&con); 
     148  return 13; 
     149 } 
     150 
     151 ROAR_SHUTDOWN(fh, SHUT_WR); 
    112152 
    113153 while((i = read(fh, buf, BUFSIZE))) 
Note: See TracChangeset for help on using the changeset viewer.