Changeset 1022:fe708cd3a6a6 in roaraudio


Ignore:
Timestamp:
12/21/08 14:31:39 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added roar source driver

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/include/sources.h

    r668 r1022  
    4040int sources_add_wav  (char * driver, char * device, char * container, char * options, int primary); 
    4141int sources_add_cf   (char * driver, char * device, char * container, char * options, int primary); 
     42int sources_add_roar (char * driver, char * device, char * container, char * options, int primary); 
    4243 
    4344#endif 
  • roard/sources.c

    r668 r1022  
    5050 } else if ( strcmp(driver, "cf") == 0 ) { 
    5151  return sources_add_cf(driver, device, container, options, primary); 
     52 } else if ( strcmp(driver, "roar") == 0 ) { 
     53  return sources_add_roar(driver, device, container, options, primary); 
    5254 } 
    5355 
     
    186188} 
    187189 
     190int sources_add_roar (char * driver, char * device, char * container, char * options, int primary) { 
     191 int  stream; 
     192 int  fh; 
     193 int  codec = ROAR_CODEC_DEFAULT; 
     194 struct roar_stream * s; 
     195 
     196 if ( options != NULL && *options ) { 
     197  if ( (codec = roar_str2codec(options)) == -1 ) { 
     198   return -1; 
     199  } 
     200 } 
     201 
     202 if ( (fh = roar_simple_monitor(g_sa->rate, g_sa->channels, g_sa->bits, codec, device, "roard")) == -1 ) { 
     203  return -1; 
     204 } 
     205 
     206 if ( (stream = streams_new()) == -1 ) { 
     207  close(fh); 
     208  return -1; 
     209 } 
     210 
     211 streams_get(stream, (struct roar_stream_server **)&s); 
     212 
     213 memcpy(&(s->info), g_sa, sizeof(struct roar_audio_info)); 
     214 
     215 s->dir        = ROAR_DIR_PLAY; 
     216 s->pos_rel_id = -1; 
     217 s->info.codec = codec; 
     218 
     219 ROAR_STREAM_SERVER(s)->codec_orgi = codec; 
     220 
     221 streams_set_fh(stream, fh); 
     222 
     223 if ( primary ) 
     224  streams_mark_primary(stream); 
     225 
     226 client_stream_add(g_source_client, stream); 
     227 
     228 return 0; 
     229} 
     230 
    188231//ll 
Note: See TracChangeset for help on using the changeset viewer.