Table of Contents

Class SrtClientSource

Namespace
VAST.SRT
Assembly
VAST.SRT.dll

Represents an SRT client source that connects to a remote SRT server and receives media data.

public class SrtClientSource : INetworkSource, INetworkEndPoint, IInteractiveMediaSource, IMediaSource, IReferenceable, IDisposable, IMessaging, INetworkStat
Inheritance
SrtClientSource
Implements
Inherited Members

Constructors

SrtClientSource()

Initializes a new instance of the SrtClientSource class.

public SrtClientSource()

Properties

Accept

Gets or sets a value indicating whether the source is accepted.

public bool Accept { get; set; }

Property Value

bool

AllowEos

Gets or sets whether source will stop on end of stream.

public bool AllowEos { get; set; }

Property Value

bool

Available

Gets a value indicating whether the source actually supports exposed IInteractiveMediaSource for the currently opened URI.

public bool Available { get; }

Property Value

bool

CanPause

Gets a value indicating whether the source is capable of pausing.

public bool CanPause { get; }

Property Value

bool

CanSeek

Gets a value indicating whether the source is capable of seeking.

public bool CanSeek { get; }

Property Value

bool

Capabilities

Gets the list of source capabilities.

public List<SourceCapability> Capabilities { get; }

Property Value

List<SourceCapability>

CurrentStat

Gets the current network statistics.

public NetworkStat CurrentStat { get; }

Property Value

NetworkStat

Duration

Gets the source duration if applicable, otherwise 0.

public TimeSpan Duration { get; }

Property Value

TimeSpan

EndPoint

Gets the connected end point information.

public IPProtoEndPoint EndPoint { get; }

Property Value

IPProtoEndPoint

IsChangeable

Gets a value indicating whether the source is changeable, i.e. the duration will change over time.

public bool IsChangeable { get; }

Property Value

bool

IsDisposed

Gets a value indicating whether the object is already disposed and cannot be used anymore.

public bool IsDisposed { get; }

Property Value

bool

IsMessagingSupported

Gets a value indicating whether the remote peer supports messaging. If value is null then it is not yet determined whether the remote peer supports messaging.

public bool? IsMessagingSupported { get; }

Property Value

bool?

IsMonitor

Gets or sets a value indicating whether the source is monitoring file changes.

public bool IsMonitor { get; set; }

Property Value

bool

IsNetworkSource

Gets a value indicating whether it is a network or local source.

public bool IsNetworkSource { get; }

Property Value

bool

Loop

Gets or sets a value indicating whether playback should be an endless loop. If value is true then seek and pause are not available.

public bool Loop { get; set; }

Property Value

bool

Parameters

Gets or sets the source parameters.

public SourceParameters Parameters { get; set; }

Property Value

SourceParameters

PlaybackRate

Gets or sets the playback rate (if applicable). If value is 1 then normal playback pace is maintained. If value is more than 1 then it means fast forward playback with possible I-frames only stream if supported by source. If value is in (0..1) range then it means slow motion playback. If value is less or equal to -1 then it means rewind playback with possible I-frames only stream if supported by source. If value is double.MaxValue then source pushes samples as quickly as possible, without considering sample timestamps and playback time.

public double PlaybackRate { get; set; }

Property Value

double

Position

Gets or sets the source playback position if seek is supported.

public TimeSpan Position { get; set; }

Property Value

TimeSpan

PublishingPath

Gets or sets the publishing point name extracted from the source URI or by any other means (depends on the protocol).

public string PublishingPath { get; set; }

Property Value

string

ReceivedUri

Gets or sets the source URI when present (depends on the protocol).

public string ReceivedUri { get; set; }

Property Value

string

RefCount

Gets the current reference count of the object.

public int RefCount { get; }

Property Value

int

SocketError

Gets the socket error received on disconnection.

public ExtendedSocketError SocketError { get; }

Property Value

ExtendedSocketError

State

Gets the current source state.

public MediaState State { get; }

Property Value

MediaState

StreamCount

Gets the total stream count of the source.

public int StreamCount { get; }

Property Value

int

UniqueId

Gets or sets the unique source identifier.

public Guid UniqueId { get; set; }

Property Value

Guid

Uri

Gets or sets the URI to be opened to pull data from.

public string Uri { get; set; }

Property Value

string

Methods

AddRef()

Adds a reference to this object.

public void AddRef()

Dispose()

Releases all resources used by the SrtClientSource class.

public void Dispose()

GetMediaType(int)

Gets the media type of the stream.

public MediaType GetMediaType(int streamIndex)

Parameters

streamIndex int

The stream index to get the media type for.

Returns

MediaType

The media type of the requested stream, or null if not found.

GetMediaTypeAndIndices(int)

Gets the media type of the specified stream and all indices.

public NewStreamEventArgs GetMediaTypeAndIndices(int streamIndex)

Parameters

streamIndex int

The stream index to get the media type for.

Returns

NewStreamEventArgs

The media type and all indices of the requested stream, or null if not found.

Open()

Opens the source using the specified URI.

public void Open()

Pause()

Pauses pushing of media data.

public void Pause()

QueueRequiredAction(ActionRequiredEventArgs)

Queues the required action for further processing.

public void QueueRequiredAction(ActionRequiredEventArgs e)

Parameters

e ActionRequiredEventArgs

The required action.

Release()

Releases a reference to this object. If the reference count becomes 0 then the Dispose() method is called. The calling object must not use the current object after this call.

public void Release()

SendMessage(byte[], int, int)

Sends a binary message to a remote peer.

public void SendMessage(byte[] message, int offset, int size)

Parameters

message byte[]

The byte array containing the message data.

offset int

The offset in the byte array to start from.

size int

The number of bytes to send.

SendMessage(string)

Sends a text message to a remote peer.

public void SendMessage(string message)

Parameters

message string

The text message to send.

SendMessage(VersatileBuffer)

Sends a binary message to a remote peer.

public void SendMessage(VersatileBuffer buffer)

Parameters

buffer VersatileBuffer

The buffer containing the message data.

SetDesiredOutputType(int, MediaType)

Sets desired output media type of the specified stream. Desired media type could be an incomplete media type specifying only necessary parameters. Source should implement decoding or encoding internally to provide requested output type. It is not guaranteed though that an actual output type will match a desired type exactly. GetMediaType function should be used to obtain actual output media type.

public Task SetDesiredOutputType(int streamIndex, MediaType mediaType)

Parameters

streamIndex int

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

mediaType MediaType

The desired media type.

Returns

Task

A Task representing the asynchronous operation.

Start()

Starts media pushing.

public void Start()

Stop()

Stops media pushing and closes the source.

public void Stop()

Events

Error

Occurs when an error has occurred.

public event EventHandler<ErrorEventArgs> Error

Event Type

EventHandler<ErrorEventArgs>

MessagingSupportDetermined

Occurs when it has been determined whether the remote peer supports messaging.

public event EventHandler<bool> MessagingSupportDetermined

Event Type

EventHandler<bool>

NewMessage

Occurs when a new message from a remote peer has arrived.

public event EventHandler<MessageEventArgs> NewMessage

Event Type

EventHandler<MessageEventArgs>

NewSample

Occurs when a new sample is ready.

public event EventHandler<NewSampleEventArgs> NewSample

Event Type

EventHandler<NewSampleEventArgs>

NewStream

Occurs when a new stream has been created.

public event EventHandler<NewStreamEventArgs> NewStream

Event Type

EventHandler<NewStreamEventArgs>

SourceChanged

Occurs when the source has changed, i.e. duration and frame tables have to be updated.

public event EventHandler SourceChanged

Event Type

EventHandler

StateChanged

Occurs when the source state has changed.

public event EventHandler<MediaState> StateChanged

Event Type

EventHandler<MediaState>