Skip to content

Commit

Permalink
Declared non-seekable streams as non-seekable in callback input
Browse files Browse the repository at this point in the history
These are the same changes as ZeBobo5/Vlc.DotNet#648

Also increased the buffer size to match the libvlc buffer size.
  • Loading branch information
jeremyVignelles authored and mfkl committed Nov 9, 2020
1 parent 3e8855e commit 7b53d50
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/LibVLCSharp/Shared/Media.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ internal struct Native
[DllImport(Constants.LibraryName, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_new_callbacks")]
internal static extern IntPtr LibVLCMediaNewCallbacks(IntPtr libVLC, InternalOpenMedia openCb, InternalReadMedia readCb,
InternalSeekMedia seekCb, InternalCloseMedia closeCb, IntPtr opaque);
InternalSeekMedia? seekCb, InternalCloseMedia closeCb, IntPtr opaque);

[DllImport(Constants.LibraryName, CallingConvention = CallingConvention.Cdecl,
EntryPoint = "libvlc_media_add_option")]
Expand Down Expand Up @@ -284,7 +284,7 @@ static IntPtr CtorFromInput(LibVLC libVLC, MediaInput input)
return Native.LibVLCMediaNewCallbacks(libVLC.NativeReference,
OpenMediaCallbackHandle,
ReadMediaCallbackHandle,
SeekMediaCallbackHandle,
input.CanSeek ? SeekMediaCallbackHandle : null,
CloseMediaCallbackHandle,
GCHandle.ToIntPtr(input.GcHandle));
}
Expand Down
5 changes: 5 additions & 0 deletions src/LibVLCSharp/Shared/MediaInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ protected MediaInput()
GcHandle = GCHandle.Alloc(this);
}

/// <summary>
/// A value indicating whether this Media input can be seeked in.
/// </summary>
public bool CanSeek { get; protected set; } = true;

/// <summary>
/// LibVLC calls this method when it wants to open the media
/// </summary>
Expand Down
1 change: 1 addition & 0 deletions src/LibVLCSharp/Shared/StreamMediaInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ public class StreamMediaInput : MediaInput
public StreamMediaInput(Stream stream)
{
_stream = stream ?? throw new ArgumentNullException(nameof(stream));
CanSeek = stream.CanSeek;
}

/// <summary>
Expand Down

0 comments on commit 7b53d50

Please sign in to comment.