[polypaudio-commits] r873 - in /trunk/src/polyp: internal.h stream.c stream.h

svnmailer-noreply at 0pointer.de svnmailer-noreply at 0pointer.de
Mon May 15 13:17:13 PDT 2006


Author: lennart
Date: Mon May 15 22:17:11 2006
New Revision: 873

URL: http://0pointer.de/cgi-bin/viewcvs.cgi?rev=873&root=polypaudio&view=rev
Log:
add notification callback which is called when new latency data becomes available

Modified:
    trunk/src/polyp/internal.h
    trunk/src/polyp/stream.c
    trunk/src/polyp/stream.h

Modified: trunk/src/polyp/internal.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/internal.h?rev=873&root=polypaudio&r1=872&r2=873&view=diff
==============================================================================
--- trunk/src/polyp/internal.h (original)
+++ trunk/src/polyp/internal.h Mon May 15 22:17:11 2006
@@ -151,6 +151,8 @@
     void *overflow_userdata;
     pa_stream_notify_cb_t underflow_callback;
     void *underflow_userdata;
+    pa_stream_notify_cb_t latency_update_callback;
+    void *latency_update_userdata;
 };
 
 typedef void (*pa_operation_cb_t)(void);

Modified: trunk/src/polyp/stream.c
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/stream.c?rev=873&root=polypaudio&r1=872&r2=873&view=diff
==============================================================================
--- trunk/src/polyp/stream.c (original)
+++ trunk/src/polyp/stream.c Mon May 15 22:17:11 2006
@@ -63,6 +63,8 @@
     s->overflow_userdata = NULL;
     s->underflow_callback = NULL;
     s->underflow_userdata = NULL;
+    s->latency_update_callback = NULL;
+    s->latency_update_userdata = NULL;
 
     s->direction = PA_STREAM_NODIRECTION;
     s->name = pa_xstrdup(name);
@@ -849,8 +851,11 @@
                 o->stream->write_index_corrections[n].valid = 0;
         }
     }
-    
-    if (o->callback) {
+
+    if (o->stream->latency_update_callback)
+        o->stream->latency_update_callback(o->stream, o->stream->latency_update_userdata);
+    
+    if (o->callback && o->stream && o->stream->state == PA_STREAM_READY) {
         pa_stream_success_cb_t cb = (pa_stream_success_cb_t) o->callback;
         cb(o->stream, o->stream->timing_info_valid, o->userdata);
     }
@@ -997,6 +1002,14 @@
     
     s->underflow_callback = cb;
     s->underflow_userdata = userdata;
+}
+
+void pa_stream_set_latency_update_callback(pa_stream *s, pa_stream_notify_cb_t cb, void *userdata) {
+    assert(s);
+    assert(s->ref >= 1);
+    
+    s->latency_update_callback = cb;
+    s->latency_update_userdata = userdata;
 }
 
 void pa_stream_simple_ack_callback(pa_pdispatch *pd, uint32_t command, PA_GCC_UNUSED uint32_t tag, pa_tagstruct *t, void *userdata) {

Modified: trunk/src/polyp/stream.h
URL: http://0pointer.de/cgi-bin/viewcvs.cgi/trunk/src/polyp/stream.h?rev=873&root=polypaudio&r1=872&r2=873&view=diff
==============================================================================
--- trunk/src/polyp/stream.h (original)
+++ trunk/src/polyp/stream.h Mon May 15 22:17:11 2006
@@ -375,6 +375,9 @@
 /** Set the callback function that is called when a buffer underflow happens. (Only for playback streams) \since 0.8 */
 void pa_stream_set_underflow_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
 
+/** 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 */
+void pa_stream_set_latency_update_callback(pa_stream *p, pa_stream_notify_cb_t cb, void *userdata);
+
 /** Pause (or resume) playback of this stream temporarily. Available on both playback and recording streams. \since 0.3 */
 pa_operation* pa_stream_cork(pa_stream *s, int b, pa_stream_success_cb_t cb, void *userdata);
 




More information about the pulseaudio-commits mailing list