Table of Contents

Class StreamMediaInput

Namespace
LibVLCSharp.Shared
Assembly
LibVLCSharp.dll

A MediaInput implementation that reads from a .NET stream

public class StreamMediaInput : MediaInput, IDisposable
Inheritance
StreamMediaInput
Implements
Inherited Members

Constructors

StreamMediaInput(Stream)

Initializes a new instance of StreamMediaInput, which reads from the given .NET stream.

public StreamMediaInput(Stream stream)

Parameters

stream Stream

The stream to be read from.

Remarks

You are still responsible to dispose the stream you give as input.

Methods

Close()

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

public override void Close()

Open(out ulong)

LibVLC calls this method when it wants to open the media

public override 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 override 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 override 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