Changeset 3431:a62fa829e0af in roaraudio for libroarpulse


Ignore:
Timestamp:
02/12/10 14:48:08 (10 years ago)
Author:
phi
Branch:
default
Message:

added pa_stream_drop() and pa_stream_peek()

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarpulse/stream.c

    r3430 r3431  
    224224        pa_stream *p                 /**< The stream to use */, 
    225225        const void **data            /**< Pointer to pointer that will point to data */, 
    226         size_t *length              /**< The length of the data read */); 
     226        size_t *length              /**< The length of the data read */) { 
     227 if ( data == NULL || length == NULL ) 
     228  return -1; 
     229 
     230 *data   = NULL; 
     231 *length = 0; 
     232 
     233 if ( p == NULL ) 
     234  return -1; 
     235 
     236 if ( p->iobuffer == NULL ) 
     237  return 0; 
     238 
     239 if ( roar_buffer_get_len(p->iobuffer, length) == -1 ) { 
     240  *length = 0; 
     241  return -1; 
     242 } 
     243 
     244 if ( roar_buffer_get_data(p->iobuffer, (void**)data) == -1 ) { 
     245  *length = 0; 
     246  *data   = NULL; 
     247  return -1; 
     248 } 
     249 
     250 return 0; 
     251} 
    227252 
    228253/** Remove the current fragment on record streams. It is invalid to do this without first 
    229254 * calling pa_stream_peek(). \since 0.8 */ 
    230 int pa_stream_drop(pa_stream *p); 
     255int pa_stream_drop(pa_stream *p) { 
     256 if ( p == NULL ) 
     257  return -1; 
     258 
     259 if ( p->iobuffer == NULL ) 
     260  return -1; 
     261 
     262 return roar_buffer_next(&(p->iobuffer)); 
     263} 
    231264 
    232265/** Return the nember of bytes that may be written using pa_stream_write() */ 
Note: See TracChangeset for help on using the changeset viewer.