Changeset 2813:f677c459d89d in roaraudio


Ignore:
Timestamp:
09/29/09 18:00:18 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added prethru support

Location:
roarclients
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roarclients/roarmon.c

    r2712 r2813  
    4444        "  --rdtcs              - Output Radio Data and Transmitter Control System data\n" 
    4545        "  --thru               - Output copy of other stream\n" 
     46        "  --prethru            - Sets prethru flag on stream\n" 
    4647        "  --rel-id ID          - Set ID of relative stream\n" 
    4748        "  --help               - Show this help\n" 
     
    6061 char * k; 
    6162 int    i; 
     63 int    prethru  = 0; 
    6264 struct roar_connection    con; 
    6365 struct roar_stream        s; 
     
    112114   rel_id = atoi(argv[++i]); 
    113115 
     116  } else if ( !strcmp(k, "--prethru") ) { 
     117   prethru = 1; 
     118 
    114119  } else if ( !strcmp(k, "--help") || !strcmp(k, "-h") ) { 
    115120   usage(); 
     
    194199 } 
    195200 
     201 if ( prethru ) { 
     202  if ( roar_stream_set_flags(&con, &s, ROAR_FLAG_PRETHRU, 0) == -1 ) { 
     203   fprintf(stderr, "Error: can not set prethru flag on stream\n"); 
     204   roar_disconnect(&con); 
     205   return 14; 
     206  } 
     207 } 
     208 
    196209 if ( roar_stream_exec(&con, &s) == -1 ) { 
    197210  fprintf(stderr, "Error: can not exec stream\n"); 
  • roarclients/roarmonhttp.c

    r2220 r2813  
    211211 int    channels = 2; 
    212212 int    codec    = ROAR_CODEC_OGG_VORBIS; 
     213 int    rel_id   = -1; 
     214 int    sflags   = ROAR_FLAG_NONE; 
    213215// int    codec    = ROAR_CODEC_DEFAULT; 
    214216 char * server   = NULL; 
     
    220222 int dir = ROAR_DIR_MONITOR; 
    221223 int gopher = 0; 
     224 struct roar_connection    con; 
     225 struct roar_stream        s; 
    222226 
    223227#ifdef ROAR_HAVE_ALARM 
     
    261265  } else if ( !strcmp(k, "bits") ) { 
    262266   bits = atoi(v); 
     267  } else if ( !strcmp(k, "rel-id") || !strcmp(k, "relid") ) { 
     268   rel_id = atoi(v); 
     269  } else if ( !strcmp(k, "set-flag") ) { 
     270   if ( !strcmp(v, "meta") ) { 
     271    sflags |= ROAR_FLAG_META; 
     272   } else if ( !strcmp(v, "cleanmeta") ) { 
     273    sflags |= ROAR_FLAG_CLEANMETA; 
     274   } else if ( !strcmp(v, "prethru") ) { 
     275    sflags |= ROAR_FLAG_PRETHRU; 
     276   } else { 
     277    return 1; 
     278   } 
     279  } else if ( !strcmp(k, "dir") ) { 
     280   if ( (dir = roar_str2dir(v)) == -1 ) 
     281    return 1; 
    263282  } else { 
    264283   return 1; 
     
    272291 } 
    273292 
    274  
    275  if ( (fh = roar_simple_stream(rate, channels, bits, codec, server, dir, "roarmonhttp")) == -1 ) { 
    276 //  fprintf(stderr, "Error: can not start monitoring\n"); 
     293 if ( roar_simple_connect(&con, server, "roarmonhttp") == -1 ) { 
     294  return 10; 
     295 } 
     296 
     297 if ( roar_stream_new(&s, rate, channels, bits, codec) == -1 ) { 
     298  roar_disconnect(&con); 
     299  return 20; 
     300 } 
     301 
     302 if ( rel_id != -1 ) { 
     303  if ( roar_stream_set_rel_id(&s, rel_id) ) { 
     304   roar_disconnect(&con); 
     305   return 21; 
     306  } 
     307 } 
     308 
     309 if ( roar_stream_connect(&con, &s, dir) == -1 ) { 
     310  roar_disconnect(&con); 
     311  return 11; 
     312 } 
     313 
     314 if ( sflags != ROAR_FLAG_NONE ) { 
     315  if ( roar_stream_set_flags(&con, &s, sflags, 0) == -1 ) { 
     316   roar_disconnect(&con); 
     317   return 14; 
     318  } 
     319 } 
     320 
     321 if ( roar_stream_exec(&con, &s) == -1 ) { 
     322  roar_disconnect(&con); 
     323  return 12; 
     324 } 
     325 
     326 if ( (fh = roar_get_connection_fh(&con)) == -1 ) 
    277327  return 1; 
    278  } 
    279328 
    280329 if ( !gopher ) 
     
    292341   break; 
    293342  case ROAR_DIR_MONITOR: 
     343  case ROAR_DIR_THRU: 
    294344    stream(ROAR_STDOUT, fh); 
    295345   break; 
Note: See TracChangeset for help on using the changeset viewer.