From 106277fbe22780f5846aecc2883edf43906da079 Mon Sep 17 00:00:00 2001 From: Martin Finkel Date: Tue, 25 Mar 2025 13:45:57 +0700 Subject: [PATCH] libvlc: add helper delay function --- src/LibVLCSharp/Shared/LibVLC.cs | 7 +++++++ src/LibVLCSharp/Shared/MediaPlayer.cs | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/LibVLCSharp/Shared/LibVLC.cs b/src/LibVLCSharp/Shared/LibVLC.cs index 3bfd7a66..893fb71b 100644 --- a/src/LibVLCSharp/Shared/LibVLC.cs +++ b/src/LibVLCSharp/Shared/LibVLC.cs @@ -776,6 +776,13 @@ static void GetLogContext(IntPtr logContext, out string? module, out string? fil /// public long Clock => Native.LibVLCClock(); + /// + /// Return the delay (in microseconds) until a certain timestamp. + /// + /// timestamp in microsecond + /// negative if timestamp is in the past, positive if it is in the future + public long Delay(long pts) => pts - Clock; + #region Exit static readonly InternalExitCallback ExitCallbackHandle = ExitCallback; diff --git a/src/LibVLCSharp/Shared/MediaPlayer.cs b/src/LibVLCSharp/Shared/MediaPlayer.cs index fa564255..c61bbd94 100644 --- a/src/LibVLCSharp/Shared/MediaPlayer.cs +++ b/src/LibVLCSharp/Shared/MediaPlayer.cs @@ -2039,7 +2039,7 @@ public delegate uint LibVLCVideoFormatCb(ref IntPtr opaque, IntPtr chroma, ref u /// data pointer as passed to libvlc_audio_set_callbacks() [IN] /// pointer to a table of audio samples to play back [IN] /// number of audio samples to play back - /// expected play time stamp (see libvlc_delay()) + /// expected play time stamp (see ) /// /// The LibVLC media player decodes and post-processes the audio signal /// asynchronously (in an internal thread). Whenever audio samples are ready