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.

# Conflicts:
#	src/LibVLCSharp/Media.cs
  • Loading branch information
jeremyVignelles authored and mfkl committed Nov 9, 2020
1 parent feebe64 commit 7f5feda
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/LibVLCSharp/Media.cs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,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 @@ -295,7 +295,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/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/StreamMediaInput.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,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 7f5feda

Please sign in to comment.