[vlc-commits] PulseAudio: implement TimeGet()
Rémi Denis-Courmont
git at videolan.org
Wed Nov 21 21:27:18 CET 2012
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Wed Nov 21 22:25:15 2012 +0200| [c765fb8c71ee67e1c1428ef1b62cd3b7169b5d4c] | committer: Rémi Denis-Courmont
PulseAudio: implement TimeGet()
This enables the normal VLC core resampling.
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=c765fb8c71ee67e1c1428ef1b62cd3b7169b5d4c
---
modules/audio_output/pulse.c | 22 +++++++++++++++++++---
1 file changed, 19 insertions(+), 3 deletions(-)
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index 3cf70cd..85ed3be 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -426,6 +426,22 @@ static void sink_input_info_cb(pa_context *ctx, const pa_sink_input_info *i,
/*** VLC audio output callbacks ***/
+static int TimeGet(audio_output_t *aout, mtime_t *restrict write_pts)
+{
+ aout_sys_t *sys = aout->sys;
+ pa_stream *s = sys->stream;
+
+ if (pa_stream_is_corked(s) > 0)
+ return -1; /* latency is irrelevant if corked */
+
+ mtime_t delta = vlc_pa_get_latency(aout, sys->context, s);
+ if (delta == VLC_TS_INVALID)
+ return -1;
+
+ *write_pts = mdate() + delta;
+ return 0;
+}
+
/* Memory free callback. The block_t address is in front of the data. */
static void data_free(void *data)
{
@@ -760,8 +776,8 @@ static int Start(audio_output_t *aout, audio_sample_format_t *restrict fmt)
/* Stream parameters */
const pa_stream_flags_t flags = PA_STREAM_START_CORKED
- //| PA_STREAM_INTERPOLATE_TIMING
- | PA_STREAM_NOT_MONOTONIC
+ | PA_STREAM_INTERPOLATE_TIMING
+ | PA_STREAM_NOT_MONOTONIC
| PA_STREAM_AUTO_TIMING_UPDATE
/*| PA_STREAM_FIX_RATE*/;
@@ -936,7 +952,7 @@ static int Open(vlc_object_t *obj)
aout->sys = sys;
aout->start = Start;
aout->stop = Stop;
- aout->time_get = NULL;
+ aout->time_get = TimeGet;
aout->play = Play;
aout->pause = Pause;
aout->flush = Flush;
More information about the vlc-commits
mailing list