Changeset 3136:e9b53172083c in roaraudio


Ignore:
Timestamp:
01/15/10 10:40:14 (12 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support for config option force-{rate,bits,codec,channels}

Files:
3 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/config.h

    r2962 r3136  
    9191  struct roar_libroar_config_codec * codec; 
    9292 } codecs; 
     93 struct roar_audio_info info; 
    9394}; 
    9495 
  • libroar/config.c

    r2962 r3136  
    218218    ROAR_WARN("roar_libroar_config_parse(*): Unknown warning option: %s", v); 
    219219   } 
     220  } else if ( !strcmp(k, "force-rate") ) { 
     221   config->info.rate = atoi(v); 
     222  } else if ( !strcmp(k, "force-bits") ) { 
     223   config->info.bits = atoi(v); 
     224  } else if ( !strcmp(k, "force-channels") ) { 
     225   config->info.channels = atoi(v); 
     226  } else if ( !strcmp(k, "force-codec") ) { 
     227   config->info.codec = roar_str2codec(v); 
    220228  } else if ( !strcmp(k, "codec") ) { 
    221229   if ( roar_libroar_config_parse_codec(config, v) == -1 ) { 
  • libroar/stream.c

    r2951 r3136  
    3636 
    3737int roar_stream_connect (struct roar_connection * con, struct roar_stream * s, int dir) { 
     38 struct roar_libroar_config * config = roar_libroar_get_config(); 
     39 struct roar_stream  ms; 
    3840 struct roar_message m; 
    3941 
    4042 s->dir = dir; 
     43 
     44 memcpy(&ms, s, sizeof(ms)); 
    4145 
    4246 m.cmd     = ROAR_CMD_NEW_STREAM; 
     
    4448 m.pos     = 0; 
    4549 
    46  roar_stream_s2m(s, &m); 
     50 if ( config != NULL ) { 
     51  if ( config->info.rate ) 
     52   ms.info.rate = config->info.rate; 
     53  if ( config->info.bits ) 
     54   ms.info.bits = config->info.bits; 
     55  if ( config->info.channels ) 
     56   ms.info.channels = config->info.channels; 
     57  if ( config->info.codec ) 
     58   ms.info.codec = config->info.codec; 
     59 } 
     60 
     61 roar_stream_s2m(&ms, &m); 
    4762 
    4863 if ( roar_req(con, &m, NULL) != 0 ) 
Note: See TracChangeset for help on using the changeset viewer.