Class RtspClientSource
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
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
Capabilities
Gets the list of source capabilities
public List<SourceCapability> Capabilities { get; }
Property Value
CurrentStat
Gets current network statistics
public NetworkStat CurrentStat { get; }
Property Value
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
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
EndPoint
Connected end point info
public IPProtoEndPoint EndPoint { get; }
Property Value
IsAdaptiveStreamSwitchSupported
Gets whether adaptive stream switching supported by the source.
public bool IsAdaptiveStreamSwitchSupported { get; }
Property Value
IsDisposed
Can be used to check whether object is already disposed and can't be used anymore
public bool IsDisposed { get; }
Property Value
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
OriginalStreamCount
Gets original stream count of the source
public int OriginalStreamCount { get; }
Property Value
Parameters
Gets or sets source parameters
public SourceParameters Parameters { get; set; }
Property Value
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
ReceivedUri
Source URI when present (depends on the protocol)
public string ReceivedUri { get; set; }
Property Value
RefCount
Gets current reference count of the object
public int RefCount { get; }
Property Value
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
SessionName
Gets the RTSP session name.
public string SessionName { get; }
Property Value
SocketError
Socket error got on disconnection
public ExtendedSocketError SocketError { get; }
Property Value
State
Current source state
public MediaState State { get; }
Property Value
StreamCount
Total stream count of the source
public int StreamCount { get; }
Property Value
UniqueId
Unique source id
public Guid UniqueId { get; set; }
Property Value
Uri
URI to be opened to pull data from
public string Uri { get; set; }
Property Value
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
valuesDictionary<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
streamIndexintStream 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
streamIndexintOriginal 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
messagebyte[]The byte array containing the message data.
offsetintThe offset in the byte array to start reading from.
sizeintThe number of bytes to send.
SendMessage(string)
Sends a text message to the remote peer.
public void SendMessage(string message)
Parameters
messagestringThe text message to send.
SendMessage(VersatileBuffer)
Sends a binary message to the remote peer using a VersatileBuffer.
public void SendMessage(VersatileBuffer buffer)
Parameters
bufferVersatileBufferThe 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
streamIndexintStream index to set desired output media type for
desiredTypeMediaTypeDesired media type
Returns
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
MessagingSupportDetermined
Occurs when it has been determined whether the remote peer supports messaging.
public event EventHandler<bool> MessagingSupportDetermined
Event Type
NewMessage
Occurs when a new message from the remote peer arrives.
public event EventHandler<MessageEventArgs> NewMessage
Event Type
NewSample
Occurs when a new media sample is ready.
public event EventHandler<NewSampleEventArgs> NewSample
Event Type
NewStream
Occurs when a new stream has been created.
public event EventHandler<NewStreamEventArgs> NewStream
Event Type
StateChanged
Occurs when the source state changes.
public event EventHandler<MediaState> StateChanged