From 89dd7ec0a1f9a09ef15930d9e380085b3f6ed12f Mon Sep 17 00:00:00 2001 From: Lennart Poettering Date: Wed, 27 Oct 2004 01:14:03 +0000 Subject: update to new API git-svn-id: file:///home/lennart/svn/public/pavumeter/trunk@19 c62a5a7b-6fe3-0310-9d5a-afe6de46906b --- src/vumeter.cc | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/vumeter.cc b/src/vumeter.cc index 9c2a83b..578ede3 100644 --- a/src/vumeter.cc +++ b/src/vumeter.cc @@ -279,8 +279,9 @@ static struct pa_stream *stream = NULL; static struct pa_sample_spec sample_spec = { (enum pa_sample_format) 0, 0, 0 }; static char* source_name = NULL; -static void stream_get_latency_callback(struct pa_stream *, const struct pa_latency_info *l, void *) { +static void stream_get_latency_info_callback(struct pa_stream *s, const struct pa_latency_info *l, void *) { pa_usec_t t; + int negative = 0; if (!l) { g_message("Failed to get latency information: %s", pa_strerror(pa_context_errno(context))); @@ -290,17 +291,17 @@ static void stream_get_latency_callback(struct pa_stream *, const struct pa_late if (!mainWindow) return; - - t = l->source_usec + l->buffer_usec + l->transport_usec; - mainWindow->updateLatency(l->sink_usec > t ? l->sink_usec - t : 0); + t = pa_stream_get_latency(s, l, &negative); + + mainWindow->updateLatency(negative ? 0 : t); } static gboolean latency_func(gpointer) { if (!stream) return false; - pa_operation_unref(pa_stream_get_latency(stream, stream_get_latency_callback, NULL)); + pa_operation_unref(pa_stream_get_latency_info(stream, stream_get_latency_info_callback, NULL)); return true; } @@ -321,7 +322,7 @@ static void stream_state_callback(struct pa_stream *s, void *) { mainWindow = new MainWindow(sample_spec.channels, source_name); g_timeout_add(100, latency_func, NULL); - pa_operation_unref(pa_stream_get_latency(stream, stream_get_latency_callback, NULL)); + pa_operation_unref(pa_stream_get_latency_info(stream, stream_get_latency_info_callback, NULL)); break; case PA_STREAM_FAILED: -- cgit