Table of Contents

Interface IMediaSource

Namespace
VAST.Media
Assembly
VAST.Common.dll

Defines the contract for a media source.

public interface IMediaSource : IReferenceable, IDisposable
Inherited Members

Properties

Capabilities

Gets the list of capabilities supported by this source.

List<SourceCapability> Capabilities { get; }

Property Value

List<SourceCapability>

IsNetworkSource

Gets a value indicating whether this is a network source rather than a local source.

bool IsNetworkSource { get; }

Property Value

bool

Parameters

Gets or sets the source configuration parameters.

SourceParameters Parameters { get; set; }

Property Value

SourceParameters

State

Gets the current source state.

MediaState State { get; }

Property Value

MediaState

StreamCount

Gets the total number of streams in the source.

int StreamCount { get; }

Property Value

int

UniqueId

Gets or sets the unique identifier for this source.

Guid UniqueId { get; set; }

Property Value

Guid

Uri

Gets or sets the source URI.

string Uri { get; set; }

Property Value

string

Methods

GetMediaType(int)

Gets the media type of the specified stream.

MediaType GetMediaType(int streamIndex)

Parameters

streamIndex int

The index of the stream to get the media type for.

Returns

MediaType

The media type of the requested stream.

Open()

Opens the source. Typically used for network sources to establish a connection to a server.

void Open()

SetDesiredOutputType(int, MediaType)

Sets the desired output media type for the specified stream.

Task SetDesiredOutputType(int streamIndex, MediaType mediaType)

Parameters

streamIndex int

The index of the stream to set the desired output type for.

mediaType MediaType

The desired media type, which can be incomplete and specify only the necessary parameters.

Returns

Task

Remarks

The source should implement decoding or encoding internally to provide the requested output type. The actual output type may not match the desired type exactly; use GetMediaType(int) to obtain the actual output media type.

Start()

Starts the source and begins pushing media data.

void Start()

Stop()

Stops the source. The source cannot be restarted after stopping; a new source must be created if needed.

void Stop()

Events

Error

Occurs when an error is encountered.

event EventHandler<ErrorEventArgs> Error

Event Type

EventHandler<ErrorEventArgs>

NewSample

Occurs when a new sample is ready to be consumed.

event EventHandler<NewSampleEventArgs> NewSample

Event Type

EventHandler<NewSampleEventArgs>

NewStream

Occurs when a new stream is created or stream information becomes available.

event EventHandler<NewStreamEventArgs> NewStream

Event Type

EventHandler<NewStreamEventArgs>

StateChanged

Occurs when the source state changes.

event EventHandler<MediaState> StateChanged

Event Type

EventHandler<MediaState>