Table of Contents

Class RtspClientSource

Namespace
VAST.RTSP
Assembly
VAST.RTSP.dll

Represents an RTSP client source that pulls media data from a remote RTSP or RTP server.

public class RtspClientSource : INetworkSource, IMediaSource, IReferenceable, IDisposable, INetworkEndPoint, IMessaging, INetworkStat, IDiscardable
Inheritance
RtspClientSource
Implements
Inherited Members

Constructors

RtspClientSource()

Initializes a new instance of the RtspClientSource class.

public RtspClientSource()

Properties

Accept

Whether source is accepted or not

public bool Accept { get; set; }

Property Value

bool

AllowAdaptiveStreamSwitch

Gets or sets whether to apply automatic adaptive stream switching in the source. Makes sense only when IsAdaptiveStreamSwitchSupported returns true. Can be changed any time before or after a source is opened.

public bool AllowAdaptiveStreamSwitch { get; set; }

Property Value

bool

Capabilities

Gets the list of source capabilities

public List<SourceCapability> Capabilities { get; }

Property Value

List<SourceCapability>

CurrentStat

Gets current network statistics

public NetworkStat CurrentStat { get; }

Property Value

NetworkStat

DiscardMode

Gets or sets discarding strategy. Can only be set before the Open() call. Afterwards it'll not have any effect.

public DiscardMode DiscardMode { get; set; }

Property Value

DiscardMode

DiscardState

Gets current discard state of all original streams. The number of elements is equal to OriginalStreamCount. Can return empty list if source is not opened yet, is stopped or errored.

public List<bool> DiscardState { get; }

Property Value

List<bool>

EndPoint

Connected end point info

public IPProtoEndPoint EndPoint { get; }

Property Value

IPProtoEndPoint

IsAdaptiveStreamSwitchSupported

Gets whether adaptive stream switching supported by the source.

public bool IsAdaptiveStreamSwitchSupported { get; }

Property Value

bool

IsDisposed

Can be used to check whether object is already disposed and can't be used anymore

public bool IsDisposed { get; }

Property Value

bool

IsMessagingSupported

Gets whether remote peer supports messaging. If value is null then it's not yet determined whether remote peer supports messaging.

public bool? IsMessagingSupported { get; }

Property Value

bool?

IsNetworkSource

Whether it's a network or local source.

public bool IsNetworkSource { get; }

Property Value

bool

OriginalStreamCount

Gets original stream count of the source

public int OriginalStreamCount { get; }

Property Value

int

Parameters

Gets or sets source parameters

public SourceParameters Parameters { get; set; }

Property Value

SourceParameters

PublishingPath

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

Source URI when present (depends on the protocol)

public string ReceivedUri { get; set; }

Property Value

string

RefCount

Gets current reference count of the object

public int RefCount { get; }

Property Value

int

Sdp

Gets or sets a source RTP stream's SDP for sideloading. Can only be set for RTP sources, otherwise it throws.

public string Sdp { get; set; }

Property Value

string

SessionName

Gets the RTSP session name.

public string SessionName { get; }

Property Value

string

SocketError

Socket error got on disconnection

public ExtendedSocketError SocketError { get; }

Property Value

ExtendedSocketError

State

Current source state

public MediaState State { get; }

Property Value

MediaState

StreamCount

Total stream count of the source

public int StreamCount { get; }

Property Value

int

UniqueId

Unique source id

public Guid UniqueId { get; set; }

Property Value

Guid

Uri

URI to be opened to pull data from

public string Uri { get; set; }

Property Value

string

Methods

AddRef()

Add reference

public void AddRef()

Discard(Dictionary<int, bool>)

Applies discard flags for selected streams. This is a smooth discard request which should not produce any interruptions in playback. Can be called any time after a source state becomes MediaState.Opened.

public void Discard(Dictionary<int, bool> values)

Parameters

values Dictionary<int, bool>

Map of stream index to discard value

Dispose()

Releases all resources used by the RtspClientSource class.

public void Dispose()

GetMediaType(int)

Gets media type of the stream

public MediaType GetMediaType(int streamIndex)

Parameters

streamIndex int

Stream index to get media type for

Returns

MediaType

Media type of requested stream

GetOriginalMediaType(int)

Gets media type of the specified original stream

public MediaType GetOriginalMediaType(int streamIndex)

Parameters

streamIndex int

Original stream index to get media type for

Returns

MediaType

Media type of requested stream

Open()

Open source using specified URI

public void Open()

Release()

Release reference. If reference count becomes 0 then Dispose() method is called. Calling object must not use current object after this call.

public void Release()

SendMessage(byte[], int, int)

Sends a binary message to the 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 reading from.

size int

The number of bytes to send.

SendMessage(string)

Sends a text message to the remote peer.

public void SendMessage(string message)

Parameters

message string

The text message to send.

SendMessage(VersatileBuffer)

Sends a binary message to the remote peer using a VersatileBuffer.

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 desiredType)

Parameters

streamIndex int

Stream index to set desired output media type for

desiredType MediaType

Desired media type

Returns

Task

Start()

Start media pushing

public void Start()

Stop()

Stop media pushing and closes the source

public void Stop()

Events

Error

Occurs when an error is encountered during streaming.

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 the remote peer arrives.

public event EventHandler<MessageEventArgs> NewMessage

Event Type

EventHandler<MessageEventArgs>

NewSample

Occurs when a new media 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>

StateChanged

Occurs when the source state changes.

public event EventHandler<MediaState> StateChanged

Event Type

EventHandler<MediaState>