[vlc-commits] aout: pass system play time to play callback
Rémi Denis-Courmont
git at videolan.org
Fri May 4 19:49:02 CEST 2018
vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Fri May 4 20:45:05 2018 +0300| [f1b244cd43c0c1cf9a18db612dc3445531694463] | committer: Rémi Denis-Courmont
aout: pass system play time to play callback
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=f1b244cd43c0c1cf9a18db612dc3445531694463
---
include/vlc_aout.h | 4 +++-
modules/audio_output/adummy.c | 4 ++--
modules/audio_output/alsa.c | 5 +++--
modules/audio_output/amem.c | 5 ++---
modules/audio_output/audiotrack.c | 3 ++-
modules/audio_output/audiounit_ios.m | 4 ++--
modules/audio_output/coreaudio_common.c | 4 +++-
modules/audio_output/directsound.c | 3 ++-
modules/audio_output/file.c | 5 +++--
modules/audio_output/jack.c | 5 +++--
modules/audio_output/kai.c | 5 +++--
modules/audio_output/mmdevice.c | 3 ++-
modules/audio_output/opensles_android.c | 3 ++-
modules/audio_output/oss.c | 5 +++--
modules/audio_output/pulse.c | 3 ++-
modules/audio_output/sndio.c | 5 +++--
modules/audio_output/tizen_audio.c | 3 ++-
modules/audio_output/waveout.c | 5 +++--
modules/audio_output/winstore.c | 3 ++-
src/audio_output/aout_internal.h | 2 +-
src/audio_output/dec.c | 6 +++---
src/audio_output/output.c | 4 ++--
22 files changed, 53 insertions(+), 36 deletions(-)
diff --git a/include/vlc_aout.h b/include/vlc_aout.h
index e3153b8e25..a5c1c26a7d 100644
--- a/include/vlc_aout.h
+++ b/include/vlc_aout.h
@@ -146,8 +146,10 @@ struct audio_output
* \return 0 on success, non-zero on failure or lack of data
* \note A stream must have been started when called.
*/
- void (*play)(audio_output_t *, block_t *);
+ void (*play)(audio_output_t *, block_t *block, mtime_t date);
/**< Queues a block of samples for playback (mandatory, cannot be NULL).
+ * \param block block of audio samples
+ * \param date intended system time to render the first sample
* \note A stream must have been started when called.
*/
void (*pause)( audio_output_t *, bool pause, mtime_t date);
diff --git a/modules/audio_output/adummy.c b/modules/audio_output/adummy.c
index 8c40bdddde..fbec096b25 100644
--- a/modules/audio_output/adummy.c
+++ b/modules/audio_output/adummy.c
@@ -42,10 +42,10 @@ vlc_module_end ()
#define A52_FRAME_NB 1536
-static void Play(audio_output_t *aout, block_t *block)
+static void Play(audio_output_t *aout, block_t *block, mtime_t date)
{
block_Release( block );
- (void) aout;
+ (void) aout; (void) date;
}
static void Flush(audio_output_t *aout, bool wait)
diff --git a/modules/audio_output/alsa.c b/modules/audio_output/alsa.c
index acf3ed590d..b9319debba 100644
--- a/modules/audio_output/alsa.c
+++ b/modules/audio_output/alsa.c
@@ -291,7 +291,7 @@ out:
#endif
static int TimeGet (audio_output_t *aout, mtime_t *);
-static void Play (audio_output_t *, block_t *);
+static void Play(audio_output_t *, block_t *, mtime_t);
static void Pause (audio_output_t *, bool, mtime_t);
static void PauseDummy (audio_output_t *, bool, mtime_t);
static void Flush (audio_output_t *, bool);
@@ -647,7 +647,7 @@ static int TimeGet (audio_output_t *aout, mtime_t *restrict delay)
/**
* Queues one audio buffer to the hardware.
*/
-static void Play (audio_output_t *aout, block_t *block)
+static void Play(audio_output_t *aout, block_t *block, mtime_t date)
{
aout_sys_t *sys = aout->sys;
@@ -687,6 +687,7 @@ static void Play (audio_output_t *aout, block_t *block)
}
}
block_Release (block);
+ (void) date;
}
/**
diff --git a/modules/audio_output/amem.c b/modules/audio_output/amem.c
index 30535e1ab8..7e0829e001 100644
--- a/modules/audio_output/amem.c
+++ b/modules/audio_output/amem.c
@@ -80,12 +80,11 @@ typedef struct
bool ready;
} aout_sys_t;
-static void Play (audio_output_t *aout, block_t *block)
+static void Play(audio_output_t *aout, block_t *block, mtime_t date)
{
aout_sys_t *sys = aout->sys;
- sys->play (sys->opaque, block->p_buffer, block->i_nb_samples,
- block->i_pts);
+ sys->play(sys->opaque, block->p_buffer, block->i_nb_samples, date);
block_Release (block);
}
diff --git a/modules/audio_output/audiotrack.c b/modules/audio_output/audiotrack.c
index 934826d3c7..3b36e47308 100644
--- a/modules/audio_output/audiotrack.c
+++ b/modules/audio_output/audiotrack.c
@@ -1727,7 +1727,7 @@ AudioTrack_Thread( void *p_data )
}
static void
-Play( audio_output_t *p_aout, block_t *p_buffer )
+Play( audio_output_t *p_aout, block_t *p_buffer, mtime_t i_date )
{
JNIEnv *env = NULL;
size_t i_buffer_offset = 0;
@@ -1803,6 +1803,7 @@ Play( audio_output_t *p_aout, block_t *p_buffer )
bailout:
vlc_mutex_unlock( &p_sys->lock );
block_Release( p_buffer );
+ (void) i_date;
}
static void
diff --git a/modules/audio_output/audiounit_ios.m b/modules/audio_output/audiounit_ios.m
index 682ac1e15e..db6e1224d8 100644
--- a/modules/audio_output/audiounit_ios.m
+++ b/modules/audio_output/audiounit_ios.m
@@ -376,14 +376,14 @@ MuteSet(audio_output_t *p_aout, bool mute)
}
static void
-Play(audio_output_t * p_aout, block_t * p_block)
+Play(audio_output_t * p_aout, block_t * p_block, mtime_t date)
{
aout_sys_t * p_sys = p_aout->sys;
if (p_sys->b_muted)
block_Release(p_block);
else
- ca_Play(p_aout, p_block);
+ ca_Play(p_aout, p_block, date);
}
#pragma mark initialization
diff --git a/modules/audio_output/coreaudio_common.c b/modules/audio_output/coreaudio_common.c
index da1ba1a8c9..e43fcf6602 100644
--- a/modules/audio_output/coreaudio_common.c
+++ b/modules/audio_output/coreaudio_common.c
@@ -281,7 +281,7 @@ ca_Pause(audio_output_t * p_aout, bool pause, mtime_t date)
}
void
-ca_Play(audio_output_t * p_aout, block_t * p_block)
+ca_Play(audio_output_t * p_aout, block_t * p_block, mtime_t date)
{
struct aout_sys_common *p_sys = (struct aout_sys_common *) p_aout->sys;
@@ -350,6 +350,8 @@ ca_Play(audio_output_t * p_aout, block_t * p_block)
if (i_underrun_size > 0)
msg_Warn(p_aout, "underrun of %zu bytes", i_underrun_size);
+
+ (void) date;
}
int
diff --git a/modules/audio_output/directsound.c b/modules/audio_output/directsound.c
index 707d2d9deb..df0bf5128b 100644
--- a/modules/audio_output/directsound.c
+++ b/modules/audio_output/directsound.c
@@ -303,10 +303,11 @@ static HRESULT StreamPlay( aout_stream_t *s, block_t *block )
return Play( VLC_OBJECT(s), s->sys, block );
}
-static void OutputPlay( audio_output_t *aout, block_t *block )
+static void OutputPlay( audio_output_t *aout, block_t *block, mtime_t date )
{
aout_sys_t *sys = aout->sys;
Play( VLC_OBJECT(aout), &sys->s, block );
+ (void) date;
}
static HRESULT Pause( aout_stream_sys_t *sys, bool pause )
diff --git a/modules/audio_output/file.c b/modules/audio_output/file.c
index 6fe0083a26..77bca519f0 100644
--- a/modules/audio_output/file.c
+++ b/modules/audio_output/file.c
@@ -74,7 +74,7 @@ static const int pi_channels_maps[CHANNELS_MAX+1] =
* Local prototypes.
*****************************************************************************/
static int Open ( vlc_object_t * );
-static void Play ( audio_output_t *, block_t * );
+static void Play ( audio_output_t *, block_t *, mtime_t );
static void Flush ( audio_output_t *, bool );
/*****************************************************************************
@@ -315,7 +315,7 @@ static void Stop( audio_output_t *p_aout )
/*****************************************************************************
* Play: pretend to play a sound
*****************************************************************************/
-static void Play( audio_output_t * p_aout, block_t *p_buffer )
+static void Play( audio_output_t * p_aout, block_t *p_buffer, mtime_t date )
{
aout_sys_t *p_sys = p_aout->sys;
if( fwrite( p_buffer->p_buffer, p_buffer->i_buffer, 1,
@@ -331,6 +331,7 @@ static void Play( audio_output_t * p_aout, block_t *p_buffer )
}
block_Release( p_buffer );
+ (void) date;
}
static void Flush( audio_output_t *aout, bool wait )
diff --git a/modules/audio_output/jack.c b/modules/audio_output/jack.c
index e995b10ff4..e7696e0978 100644
--- a/modules/audio_output/jack.c
+++ b/modules/audio_output/jack.c
@@ -70,7 +70,7 @@ typedef struct
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
-static void Play ( audio_output_t * p_aout, block_t * p_block );
+static void Play ( audio_output_t * p_aout, block_t *, mtime_t );
static void Pause ( audio_output_t *aout, bool paused, mtime_t date );
static void Flush ( audio_output_t *p_aout, bool wait );
static int TimeGet ( audio_output_t *, mtime_t * );
@@ -283,7 +283,7 @@ error_out:
return status;
}
-static void Play (audio_output_t * p_aout, block_t * p_block)
+static void Play(audio_output_t * p_aout, block_t * p_block, mtime_t date)
{
aout_sys_t *p_sys = p_aout->sys;
jack_ringbuffer_t *rb = p_sys->p_jack_ringbuffer;
@@ -310,6 +310,7 @@ static void Play (audio_output_t * p_aout, block_t * p_block)
}
block_Release(p_block);
+ (void) date;
}
/**
diff --git a/modules/audio_output/kai.c b/modules/audio_output/kai.c
index 99ea583343..59706c1926 100644
--- a/modules/audio_output/kai.c
+++ b/modules/audio_output/kai.c
@@ -72,7 +72,7 @@ typedef struct
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
-static void Play ( audio_output_t *_p_aout, block_t *block );
+static void Play ( audio_output_t *_p_aout, block_t *block, mtime_t );
static void Pause ( audio_output_t *, bool, mtime_t );
static void Flush ( audio_output_t *, bool );
static int TimeGet ( audio_output_t *, mtime_t *restrict );
@@ -233,7 +233,7 @@ exit_kai_done :
/*****************************************************************************
* Play: play a sound samples buffer
*****************************************************************************/
-static void Play (audio_output_t *p_aout, block_t *block)
+static void Play(audio_output_t *p_aout, block_t *block, mtime_t date)
{
aout_sys_t *p_sys = p_aout->sys;
@@ -242,6 +242,7 @@ static void Play (audio_output_t *p_aout, block_t *block)
WriteBuffer( p_aout, block->p_buffer, block->i_buffer );
block_Release( block );
+ (void) date;
}
/*****************************************************************************
diff --git a/modules/audio_output/mmdevice.c b/modules/audio_output/mmdevice.c
index a4f99d3c5e..4a07403acb 100644
--- a/modules/audio_output/mmdevice.c
+++ b/modules/audio_output/mmdevice.c
@@ -136,7 +136,7 @@ static int TimeGet(audio_output_t *aout, mtime_t *restrict delay)
return SUCCEEDED(hr) ? 0 : -1;
}
-static void Play(audio_output_t *aout, block_t *block)
+static void Play(audio_output_t *aout, block_t *block, mtime_t date)
{
aout_sys_t *sys = aout->sys;
HRESULT hr;
@@ -146,6 +146,7 @@ static void Play(audio_output_t *aout, block_t *block)
LeaveMTA();
vlc_FromHR(aout, hr);
+ (void) date;
}
static void Pause(audio_output_t *aout, bool paused, mtime_t date)
diff --git a/modules/audio_output/opensles_android.c b/modules/audio_output/opensles_android.c
index 475ac93e54..a9d451263d 100644
--- a/modules/audio_output/opensles_android.c
+++ b/modules/audio_output/opensles_android.c
@@ -321,7 +321,7 @@ static int WriteBuffer(audio_output_t *aout)
/*****************************************************************************
* Play: play a sound
*****************************************************************************/
-static void Play(audio_output_t *aout, block_t *p_buffer)
+static void Play(audio_output_t *aout, block_t *p_buffer, mtime_t date)
{
aout_sys_t *sys = aout->sys;
@@ -338,6 +338,7 @@ static void Play(audio_output_t *aout, block_t *p_buffer)
;
vlc_mutex_unlock(&sys->lock);
+ (void) date;
}
static void PlayedCallback (SLAndroidSimpleBufferQueueItf caller, void *pContext)
diff --git a/modules/audio_output/oss.c b/modules/audio_output/oss.c
index 1fb380eb62..7202e95992 100644
--- a/modules/audio_output/oss.c
+++ b/modules/audio_output/oss.c
@@ -88,7 +88,7 @@ vlc_module_begin ()
vlc_module_end ()
static int TimeGet (audio_output_t *, mtime_t *);
-static void Play (audio_output_t *, block_t *);
+static void Play(audio_output_t *, block_t *, mtime_t);
static void Pause (audio_output_t *, bool, mtime_t);
static void Flush (audio_output_t *, bool);
@@ -269,7 +269,7 @@ static int TimeGet (audio_output_t *aout, mtime_t *restrict pts)
/**
* Queues one audio buffer to the hardware.
*/
-static void Play (audio_output_t *aout, block_t *block)
+static void Play(audio_output_t *aout, block_t *block, mtime_t date)
{
aout_sys_t *sys = aout->sys;
int fd = sys->fd;
@@ -286,6 +286,7 @@ static void Play (audio_output_t *aout, block_t *block)
msg_Err (aout, "cannot write samples: %s", vlc_strerror_c(errno));
}
block_Release (block);
+ (void) date;
}
/**
diff --git a/modules/audio_output/pulse.c b/modules/audio_output/pulse.c
index e216975e00..798bf2a690 100644
--- a/modules/audio_output/pulse.c
+++ b/modules/audio_output/pulse.c
@@ -485,7 +485,7 @@ static void *data_convert(block_t **pp)
/**
* Queue one audio frame to the playback stream
*/
-static void Play(audio_output_t *aout, block_t *block)
+static void Play(audio_output_t *aout, block_t *block, mtime_t date)
{
aout_sys_t *sys = aout->sys;
pa_stream *s = sys->stream;
@@ -523,6 +523,7 @@ static void Play(audio_output_t *aout, block_t *block)
}
pa_threaded_mainloop_unlock(sys->mainloop);
+ (void) date;
}
/**
diff --git a/modules/audio_output/sndio.c b/modules/audio_output/sndio.c
index 548b6e31ca..c240f505c4 100644
--- a/modules/audio_output/sndio.c
+++ b/modules/audio_output/sndio.c
@@ -44,7 +44,7 @@ vlc_module_begin ()
vlc_module_end ()
static int TimeGet (audio_output_t *, mtime_t *);
-static void Play (audio_output_t *, block_t *);
+static void Play(audio_output_t *, block_t *, mtime_t);
static void Flush (audio_output_t *, bool);
static int VolumeSet (audio_output_t *, float);
static int MuteSet (audio_output_t *, bool);
@@ -230,13 +230,14 @@ static int TimeGet (audio_output_t *aout, mtime_t *restrict delay)
return 0;
}
-static void Play (audio_output_t *aout, block_t *block)
+static void Play(audio_output_t *aout, block_t *block, mtime_t date)
{
aout_sys_t *sys = aout->sys;
sio_write (sys->hdl, block->p_buffer, block->i_buffer);
sys->delay += block->i_nb_samples;
block_Release (block);
+ (void) date;
}
static void Flush (audio_output_t *aout, bool wait)
diff --git a/modules/audio_output/tizen_audio.c b/modules/audio_output/tizen_audio.c
index b10265b9d2..972bb667a7 100644
--- a/modules/audio_output/tizen_audio.c
+++ b/modules/audio_output/tizen_audio.c
@@ -265,7 +265,7 @@ Stop( audio_output_t *p_aout )
}
static void
-Play( audio_output_t *p_aout, block_t *p_block )
+Play( audio_output_t *p_aout, block_t *p_block, mtime_t date )
{
aout_sys_t *p_sys = p_aout->sys;
@@ -295,6 +295,7 @@ Play( audio_output_t *p_aout, block_t *p_block )
}
}
}
+ (void) date;
}
static void
diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c
index 5b67ddb0b4..750bd7840a 100644
--- a/modules/audio_output/waveout.c
+++ b/modules/audio_output/waveout.c
@@ -49,7 +49,7 @@
*****************************************************************************/
static int Open ( vlc_object_t * );
static void Close ( vlc_object_t * );
-static void Play ( audio_output_t *, block_t * );
+static void Play ( audio_output_t *, block_t *, mtime_t );
/*****************************************************************************
* notification_thread_t: waveOut event thread
@@ -343,7 +343,7 @@ static int Start( audio_output_t *p_aout, audio_sample_format_t *restrict fmt )
* This doesn't actually play the buffer. This just stores the buffer so it
* can be played by the callback thread.
*****************************************************************************/
-static void Play( audio_output_t *p_aout, block_t *block )
+static void Play( audio_output_t *p_aout, block_t *block, mtime_t date )
{
aout_sys_t *sys = p_aout->sys;
@@ -380,6 +380,7 @@ static void Play( audio_output_t *p_aout, block_t *block )
sys->i_frames++;
sys->i_played_length += block->i_length;
vlc_mutex_unlock( &sys->lock );
+ (void) date;
}
/*****************************************************************************
diff --git a/modules/audio_output/winstore.c b/modules/audio_output/winstore.c
index 1990b899e4..494f61d332 100644
--- a/modules/audio_output/winstore.c
+++ b/modules/audio_output/winstore.c
@@ -150,7 +150,7 @@ static int TimeGet(audio_output_t *aout, mtime_t *restrict delay)
return SUCCEEDED(hr) ? 0 : -1;
}
-static void Play(audio_output_t *aout, block_t *block)
+static void Play(audio_output_t *aout, block_t *block, mtime_t date)
{
aout_sys_t *sys = aout->sys;
if( unlikely( sys->client == NULL ) )
@@ -161,6 +161,7 @@ static void Play(audio_output_t *aout, block_t *block)
LeaveMTA();
vlc_FromHR(aout, hr);
+ (void) date;
}
static void Pause(audio_output_t *aout, bool paused, mtime_t date)
diff --git a/src/audio_output/aout_internal.h b/src/audio_output/aout_internal.h
index 2aad079b45..19ad579247 100644
--- a/src/audio_output/aout_internal.h
+++ b/src/audio_output/aout_internal.h
@@ -130,7 +130,7 @@ void aout_Destroy (audio_output_t *);
int aout_OutputNew(audio_output_t *, audio_sample_format_t *,
aout_filters_cfg_t *filters_cfg);
int aout_OutputTimeGet(audio_output_t *, mtime_t *);
-void aout_OutputPlay(audio_output_t *, block_t *);
+void aout_OutputPlay(audio_output_t *, block_t *block, mtime_t date);
void aout_OutputPause( audio_output_t * p_aout, bool, mtime_t );
void aout_OutputFlush( audio_output_t * p_aout, bool );
void aout_OutputDelete( audio_output_t * p_aout );
diff --git a/src/audio_output/dec.c b/src/audio_output/dec.c
index 2d330c3348..135768381a 100644
--- a/src/audio_output/dec.c
+++ b/src/audio_output/dec.c
@@ -221,7 +221,7 @@ static void aout_DecSilence (audio_output_t *aout, mtime_t length, mtime_t pts)
block->i_pts = pts;
block->i_dts = pts;
block->i_length = length;
- aout_OutputPlay (aout, block);
+ aout_OutputPlay(aout, block, pts);
}
static void aout_DecSynchronize(audio_output_t *aout, mtime_t dec_pts)
@@ -396,7 +396,7 @@ int aout_DecPlay(audio_output_t *aout, block_t *block)
/* Output */
owner->sync.end = block->i_pts + block->i_length + 1;
owner->sync.discontinuity = false;
- aout_OutputPlay (aout, block);
+ aout_OutputPlay(aout, block, block->i_pts);
atomic_fetch_add_explicit(&owner->buffers_played, 1, memory_order_relaxed);
return ret;
drop:
@@ -451,7 +451,7 @@ void aout_DecFlush (audio_output_t *aout, bool wait)
{
block_t *block = aout_FiltersDrain (owner->filters);
if (block)
- aout_OutputPlay (aout, block);
+ aout_OutputPlay(aout, block, block->i_pts);
}
else
aout_FiltersFlush (owner->filters);
diff --git a/src/audio_output/output.c b/src/audio_output/output.c
index 1bbbe9716e..6939b08301 100644
--- a/src/audio_output/output.c
+++ b/src/audio_output/output.c
@@ -627,7 +627,7 @@ int aout_OutputTimeGet (audio_output_t *aout, mtime_t *delay)
* \note This can only be called after a successful aout_OutputNew().
* \warning The caller must NOT hold the audio output lock.
*/
-void aout_OutputPlay (audio_output_t *aout, block_t *block)
+void aout_OutputPlay(audio_output_t *aout, block_t *block, mtime_t date)
{
#ifndef NDEBUG
aout_owner_t *owner = aout_owner (aout);
@@ -637,7 +637,7 @@ void aout_OutputPlay (audio_output_t *aout, block_t *block)
owner->mixer_format.i_frame_length);
#endif
aout_OutputLock(aout);
- aout->play (aout, block);
+ aout->play(aout, block, date);
aout_OutputUnlock(aout);
}
More information about the vlc-commits
mailing list