Changeset 3429:8b04b92caa30 in roaraudio for libroarpulse


Ignore:
Timestamp:
02/12/10 00:05:18 (10 years ago)
Author:
phi
Branch:
default
Message:

added a lot functions to set callbacks

File:
1 edited

Legend:

Unmodified
Added
Removed
  • libroarpulse/stream.c

    r3428 r3429  
    5757 struct { 
    5858  struct _roar_pa_stream_cb change_state; 
     59  struct _roar_pa_stream_cb write; 
     60  struct _roar_pa_stream_cb read; 
     61  struct _roar_pa_stream_cb overflow; 
     62  struct _roar_pa_stream_cb underflow; 
     63  struct _roar_pa_stream_cb latency; 
    5964 } cb; 
    6065}; 
     
    254259/** Set the callback function that is called when new data may be 
    255260 * written to the stream. */ 
    256 void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata); 
     261void pa_stream_set_write_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata) { 
     262 if ( p == NULL ) 
     263  return; 
     264 
     265 p->cb.write.cb.rcb    = cb; 
     266 p->cb.write.userdata  = userdata; 
     267} 
    257268 
    258269/** Set the callback function that is called when new data is available from the stream. 
    259270 * Return the number of bytes read. \since 0.8 */ 
    260 void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata); 
     271void pa_stream_set_read_callback(pa_stream *p, pa_stream_request_cb_t cb, void *userdata) { 
     272 if ( p == NULL ) 
     273  return; 
     274 
     275 p->cb.read.cb.rcb    = cb; 
     276 p->cb.read.userdata  = userdata; 
     277} 
    261278 
    262279/** Set the callback function that is called when a buffer overflow happens. (Only for playback streams) \since 0.8 */ 
    263 void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata); 
     280void pa_stream_set_overflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata) { 
     281 if ( p == NULL ) 
     282  return; 
     283 
     284 p->cb.overflow.cb.ncb    = cb; 
     285 p->cb.overflow.userdata  = userdata; 
     286} 
    264287 
    265288/** Set the callback function that is called when a buffer underflow happens. (Only for playback streams) \since 0.8 */ 
    266 void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata); 
     289void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata) { 
     290 if ( p == NULL ) 
     291  return; 
     292 
     293 p->cb.underflow.cb.ncb    = cb; 
     294 p->cb.underflow.userdata  = userdata; 
     295} 
    267296 
    268297/** Set the callback function that is called whenever a latency information update happens. Useful on PA_STREAM_AUTO_TIMING_UPDATE streams only. (Only for playback streams) \since 0.8.2 */ 
    269 void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata); 
     298void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata) { 
     299 if ( p == NULL ) 
     300  return; 
     301 
     302 p->cb.latency.cb.ncb    = cb; 
     303 p->cb.latency.userdata  = userdata; 
     304} 
    270305 
    271306/** Pause (or resume) playback of this stream temporarily. Available on both playback and recording streams. \since 0.3 */ 
Note: See TracChangeset for help on using the changeset viewer.