Changeset 4629:27acd1cc7e9c in roaraudio


Ignore:
Timestamp:
11/27/10 16:29:18 (11 years ago)
Author:
phi
Branch:
default
Phase:
public
Message:

support to reset buffer

Files:
4 edited

Legend:

Unmodified
Added
Removed
  • include/libroar/buffer.h

    r4625 r4629  
    101101int roar_buffer_ring_avail(struct roar_buffer *  buf, size_t * readlen, size_t * writelen); 
    102102 
     103int roar_buffer_ring_reset(struct roar_buffer *  buf); 
     104 
    103105#endif 
    104106 
  • include/libroar/vs.h

    r4626 r4629  
    234234ssize_t roar_vs_get_avail_write(roar_vs_t * vss, int * error); 
    235235 
     236int     roar_vs_reset_buffer(roar_vs_t * vss, int writering, int readring, int * error); 
     237 
    236238/* Misc controls. 
    237239 */ 
  • libroar/buffer.c

    r4625 r4629  
    729729} 
    730730 
     731int roar_buffer_ring_reset(struct roar_buffer *  buf) { 
     732 if ( buf == NULL ) 
     733  return -1; 
     734 
     735 if ( !(buf->flags & ROAR_BUFFER_FLAG_RING) ) 
     736  return -1; 
     737 
     738 buf->meta.ring.read_pos = buf->meta.ring.write_pos = 0; 
     739 
     740 return 0; 
     741} 
     742 
    731743//ll 
  • libroar/vs.c

    r4628 r4629  
    12381238} 
    12391239 
     1240int     roar_vs_reset_buffer(roar_vs_t * vss, int writering, int readring, int * error) { 
     1241 _ckvss(-1); 
     1242 
     1243 if ( !(vss->flags & FLAG_BUFFERED) ) { 
     1244  _seterr(ROAR_ERROR_INVAL); 
     1245  return -1; 
     1246 } 
     1247 
     1248 if ( writering != ROAR_VS_TRUE || writering != ROAR_VS_FALSE || 
     1249      readring  != ROAR_VS_TRUE || readring  != ROAR_VS_FALSE ) { 
     1250  _seterr(ROAR_ERROR_INVAL); 
     1251  return -1; 
     1252 } 
     1253 
     1254 if ( writering ) { 
     1255  if ( roar_buffer_ring_reset(vss->writering) == -1 ) { 
     1256   _seterrre(); 
     1257   return -1; 
     1258  } 
     1259 } 
     1260 
     1261 if ( readring ) { 
     1262  if ( roar_buffer_ring_reset(vss->readring) == -1 ) { 
     1263   _seterrre(); 
     1264   return -1; 
     1265  } 
     1266 } 
     1267 
     1268 return 0; 
     1269} 
     1270 
    12401271int     roar_vs_ctl           (roar_vs_t * vss, roar_vs_ctlcmd cmd, void * argp, int * error) { 
    12411272 _ckvss(-1); 
Note: See TracChangeset for help on using the changeset viewer.