Skip to content

libvlc: add helper delay function #384

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions src/LibVLCSharp/Shared/LibVLC.cs
Original file line number Diff line number Diff line change
Expand Up @@ -776,6 +776,13 @@ static void GetLogContext(IntPtr logContext, out string? module, out string? fil
/// </summary>
public long Clock => Native.LibVLCClock();

/// <summary>
/// Return the delay (in microseconds) until a certain timestamp.
/// </summary>
/// <param name="pts">timestamp in microsecond</param>
/// <returns>negative if timestamp is in the past, positive if it is in the future</returns>
public long Delay(long pts) => pts - Clock;

#region Exit

static readonly InternalExitCallback ExitCallbackHandle = ExitCallback;
Expand Down
2 changes: 1 addition & 1 deletion src/LibVLCSharp/Shared/MediaPlayer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2039,7 +2039,7 @@ public delegate uint LibVLCVideoFormatCb(ref IntPtr opaque, IntPtr chroma, ref u
/// <param name="data">data pointer as passed to libvlc_audio_set_callbacks() [IN]</param>
/// <param name="samples">pointer to a table of audio samples to play back [IN]</param>
/// <param name="count">number of audio samples to play back</param>
/// <param name="pts">expected play time stamp (see libvlc_delay())</param>
/// <param name="pts">expected play time stamp (see <see cref="LibVLC.Delay(long)"/>)</param>
/// <remarks>
/// <para>The LibVLC media player decodes and post-processes the audio signal</para>
/// <para>asynchronously (in an internal thread). Whenever audio samples are ready</para>
Expand Down