Table of Contents

Class MediaInput

Namespace
LibVLCSharp.Shared
Assembly
LibVLCSharp.dll

An abstract class that lets libvlc read a media from callbacks.

Override this to provide your own reading mechanism, or you can use the StreamMediaInput class

public abstract class MediaInput : IDisposable
Inheritance
MediaInput
Implements
Derived
Inherited Members

Constructors

MediaInput()

The constructor

protected MediaInput()

Properties

CanSeek

A value indicating whether this Media input can be seeked in.

public bool CanSeek { get; protected set; }

Property Value

bool

GcHandle

The GCHandle to be passed to callbacks as userData

public GCHandle GcHandle { get; }

Property Value

GCHandle

Methods

Close()

LibVLC calls this method when it wants to close the media.

public abstract void Close()

Dispose()

Disposes of this instance

public void Dispose()

Dispose(bool)

Override this to dispose things in your child class

protected virtual void Dispose(bool disposing)

Parameters

disposing bool

Open(out ulong)

LibVLC calls this method when it wants to open the media

public abstract bool Open(out ulong size)

Parameters

size ulong

This value must be filled with the length of the media (or ulong.MaxValue if unknown)

Returns

bool

true if the stream opened successfully

Read(nint, uint)

LibVLC calls this method when it wants to read the media

public abstract int Read(nint buf, uint len)

Parameters

buf nint

The buffer where read data must be written

len uint

The buffer length

Returns

int

strictly positive number of bytes read, 0 on end-of-stream, or -1 on non-recoverable error

Seek(ulong)

LibVLC calls this method when it wants to seek to a specific position in the media

public abstract bool Seek(ulong offset)

Parameters

offset ulong

The offset, in bytes, since the beginning of the stream

Returns

bool

true if the seek succeeded, false otherwise