X-Git-Url: https://git.sesse.net/?a=blobdiff_plain;f=modules%2Faudio_output%2Fmmdevice.h;h=51f5e427dfe30a0d6ce9466276d2290018f36ee9;hb=fc81c4e2b55c1367bbf67cb7a2b98bb63d4ca6d1;hp=cb24282deea36b8cd00ddafbee98c8c8be9a8f90;hpb=f8c07e70635f15bdd2d71adf2f90a0d5f3b445a5;p=vlc diff --git a/modules/audio_output/mmdevice.h b/modules/audio_output/mmdevice.h index cb24282dee..51f5e427df 100644 --- a/modules/audio_output/mmdevice.h +++ b/modules/audio_output/mmdevice.h @@ -49,13 +49,13 @@ struct aout_stream * \param fmt audio output sample format [IN/OUT] * \param sid audio output session GUID [IN] */ -HRESULT aout_stream_Start(aout_stream_t *s, audio_sample_format_t *fmt, - const GUID *sid); +typedef HRESULT (*aout_stream_start_t)(aout_stream_t *s, + audio_sample_format_t *fmt, const GUID *sid); /** * Destroys an audio output stream. */ -void aout_stream_Stop(aout_stream_t *); +typedef HRESULT (*aout_stream_stop_t)(aout_stream_t *); static inline HRESULT aout_stream_TimeGet(aout_stream_t *s, mtime_t *delay) { @@ -72,9 +72,18 @@ static inline HRESULT aout_stream_Pause(aout_stream_t *s, bool paused) return (s->pause)(s, paused); } -static inline HRESULT aout_stream_Flush(aout_stream_t *s) +static inline HRESULT aout_stream_Flush(aout_stream_t *s, bool wait) { - return (s->flush)(s); + if (wait) + { /* Loosy drain emulation */ + mtime_t delay; + + if (SUCCEEDED(aout_stream_TimeGet(s, &delay))) + Sleep((delay / (CLOCK_FREQ / 1000)) + 1); + return S_OK; + } + else + return (s->flush)(s); } static inline