Changeset 1117:b7329495fc22 in roaraudio


Ignore:
Timestamp:
01/16/09 17:32:09 (15 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

added support for sync vio streams

Location:
roard
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • roard/roard.c

    r1115 r1117  
    130130 char * k, * v; 
    131131 int codec; 
     132 int sync = 0; 
    132133 
    133134 ROAR_DBG("add_output(drv='%s', dev='%s', opts='%s') = ?", drv, dev, opts); 
     
    174175  } else if ( strcmp(k, "meta") == 0 ) { 
    175176   streams_set_flag(stream, ROAR_FLAG_META); 
     177  } else if ( strcmp(k, "sync") == 0 ) { 
     178   sync = 1; 
    176179  } else { 
    177180   ROAR_ERR("add_output(*): unknown option '%s'", k); 
     
    203206 if ( prim ) 
    204207  streams_mark_primary(stream); 
     208 
     209 if ( sync ) 
     210  streams_set_flag(stream, ROAR_FLAG_SYNC); 
    205211 
    206212 return 0; 
  • roard/streams.c

    r1116 r1117  
    271271 
    272272int streams_set_sync     (int id, int sync) { 
    273  int fh; 
    274  
    275  if ( (fh = streams_get_fh(id)) == -1 ) 
    276   return -1; 
    277  
    278  return roar_socket_nonblock(fh, sync ? ROAR_SOCKET_BLOCK : ROAR_SOCKET_NONBLOCK); 
     273 int fh = streams_get_fh(id); 
     274 
     275 if ( fh != -1 ) { 
     276  if ( roar_socket_nonblock(fh, sync ? ROAR_SOCKET_BLOCK : ROAR_SOCKET_NONBLOCK) == -1 ) 
     277   return -1; 
     278 
     279  return fdatasync(fh); 
     280 } else { 
     281  return roar_vio_nonblock(&(g_streams[id]->vio), sync); 
     282 } 
    279283} 
    280284 
Note: See TracChangeset for help on using the changeset viewer.