Changeset 4919:1b5c8bae01ec in roaraudio


Ignore:
Timestamp:
05/08/11 01:32:13 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

converted roaraudio source from old to new source interface, updataing to vio.

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/include/sources.h

    r4807 r4919  
    6262int sources_add_wav  (char * driver, char * device, char * container, char * options, int primary); 
    6363int sources_add_cf   (char * driver, char * device, char * container, char * options, int primary); 
    64 int sources_add_roar (char * driver, char * device, char * container, char * options, int primary); 
    6564 
     65int sources_add_roar (int stream, char * device, int fh, char * driver); 
    6666int sources_add_radionoise (int stream, char * device, int fh, char * driver); 
    6767 
  • roard/sources.c

    r4807 r4919  
    3636#endif 
    3737 {"cf",   "Old CF source",               "/some/file.ext", SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, sources_add_cf,   NULL}, 
    38  {"roar", "Old simple RoarAudio source", "some.host",      SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, sources_add_roar, NULL}, 
     38 {"roar", "New simple RoarAudio source", "some.host",      SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, NULL, sources_add_roar}, 
    3939#ifndef ROAR_WITHOUT_DCOMP_CDRIVER 
    4040 {"oss",  "OSS CDriver",                 "/dev/audio",     SRC_FLAG_NONE,  ROAR_SUBSYS_WAVEFORM, NULL, sources_add_cdriver}, 
     
    397397#undef _ret 
    398398 
    399  
    400 int sources_add_roar (char * driver, char * device, char * container, char * options, int primary) { 
    401  int  stream; 
    402  int  fh; 
    403  int  codec = ROAR_CODEC_DEFAULT; 
    404  struct roar_stream * s; 
    405  
    406  if ( options != NULL && *options ) { 
    407   if ( !strncmp(options, "codec=", 6) ) 
    408    options += 6; 
    409  
    410   if ( (codec = roar_str2codec(options)) == -1 ) { 
    411    return -1; 
    412   } 
    413  } 
    414  
    415  if ( (fh = roar_simple_monitor(g_sa->rate, g_sa->channels, g_sa->bits, codec, device, "roard")) == -1 ) { 
    416   return -1; 
    417  } 
    418  
    419  if ( (stream = streams_new()) == -1 ) { 
    420   close(fh); 
    421   return -1; 
    422  } 
    423  
    424  streams_get_clientobj(stream, &s); 
    425  
    426  memcpy(&(s->info), g_sa, sizeof(struct roar_audio_info)); 
    427  
    428  if ( streams_set_dir(stream, ROAR_DIR_PLAY, 1) == -1 ) { 
    429   streams_delete(stream); 
    430   close(fh); 
    431   return -1; 
    432  } 
    433  
    434  s->pos_rel_id = -1; 
    435  s->info.codec = codec; 
    436  
    437  ROAR_STREAM_SERVER(s)->codec_orgi = codec; 
    438  
    439  streams_set_fh(stream, fh); 
    440  
    441  if ( primary ) 
    442   streams_mark_primary(stream); 
    443  
    444  streams_set_flag(stream, ROAR_FLAG_SOURCE); 
    445  client_stream_add(g_source_client, stream); 
    446  
    447  return 0; 
    448 } 
    449  
    450399#ifndef ROAR_WITHOUT_DCOMP_CDRIVER 
    451400int sources_add_cdriver (int stream   , char * device, int fh, char * driver) { 
     
    531480} 
    532481 
     482int sources_add_roar (int stream, char * device, int fh, char * driver) { 
     483 struct roar_stream_server * ss; 
     484 struct roar_stream        * s; 
     485 
     486 if ( fh > -1 ) 
     487  return -1; 
     488 
     489 if ( streams_get(stream, &ss) == -1 ) 
     490  return -1; 
     491 
     492 s = ROAR_STREAM(ss); 
     493 
     494 if ( roar_vio_simple_stream(&(ss->vio), s->info.rate, s->info.channels, s->info.bits, s->info.codec, 
     495                             device, ROAR_DIR_MONITOR, "roard") == -1 ) 
     496  return -1; 
     497 
     498 return streams_set_fh(stream, -2); 
     499} 
     500 
    533501#endif 
    534502 
Note: See TracChangeset for help on using the changeset viewer.