Class MediaFrame<TBuffer, TBufferCollection, TFormat, TFrame>
A media frame.
Inheritance
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class MediaFrame<TBuffer, TBufferCollection, TFormat, TFrame> : Dynamic, IEquatable<NSObject>, INSObjectProtocol, INativeObject, IDisposable where TBuffer : MediaBuffer<TFormat, TBuffer> where TBufferCollection : MediaBufferCollection<TBuffer, TBufferCollection, TFormat> where TFormat : MediaFormat<TFormat> where TFrame : MediaFrame<TBuffer, TBufferCollection, TFormat, TFrame>
Type Parameters
| Name | Description |
|---|---|
| TBuffer | The type of the buffer. |
| TBufferCollection | The type of the buffer collection. |
| TFormat | The type of the format. |
| TFrame | The type of the frame. |
Constructors
MediaFrame()
Initializes a new instance of the MediaFrame<TBuffer, TBufferCollection, TFormat, TFrame> class.
Declaration
public MediaFrame()
MediaFrame(TBuffer)
Initializes a new instance of the MediaFrame<TBuffer, TBufferCollection, TFormat, TFrame> class.
Declaration
public MediaFrame(TBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| TBuffer | buffer | The buffer. |
MediaFrame(TBuffer[])
Initializes a new instance of the MediaFrame<TBuffer, TBufferCollection, TFormat, TFrame> class.
Declaration
public MediaFrame(TBuffer[] buffers)
Parameters
| Type | Name | Description |
|---|---|---|
| TBuffer[] | buffers | The buffers. |
Properties
Buffer
Gets or sets the buffer.
Declaration
public TBuffer Buffer { get; set; }
Property Value
| Type | Description |
|---|---|
| TBuffer |
Buffers
Gets or sets the buffers.
Declaration
public TBuffer[] Buffers { get; set; }
Property Value
| Type | Description |
|---|---|
| TBuffer[] |
ContributingSources
Gets or sets the contributing sources.
Declaration
public long[] ContributingSources { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64[] |
Discard
Gets or sets whether this frame should be discarded.
Declaration
public bool Discard { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Footprint
Gets the approximate footprint of this media frame by returning the sum of its media buffer footprints.
Declaration
public int Footprint { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
LastBuffer
Gets the most recent buffer.
Declaration
public TBuffer LastBuffer { get; }
Property Value
| Type | Description |
|---|---|
| TBuffer |
Mid
Gets or sets the MID.
Declaration
public string Mid { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
NetworkSystemTimestamp
Gets or sets the network system timestamp. For inbound media, this value is calculated in the network layer as soon as the packet payload is determined to contain media.
Declaration
public long NetworkSystemTimestamp { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
NtpTimestampTicks
Gets or sets the NTP timestamp ticks matching Timestamp, set by RTP receivers for synchronization of inbound media streams.
Declaration
[Obsolete("Use SystemTimestamp instead.")]
public long NtpTimestampTicks { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
RepairedRtpStreamId
Gets or sets the repaired RTP stream identifier.
Declaration
public string RepairedRtpStreamId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
RtpSequenceNumber
Gets or sets the RTP sequence number.
Declaration
public int RtpSequenceNumber { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
RtpStreamId
Gets or sets the RTP stream identifier.
Declaration
public string RtpStreamId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
RtpTimestamp
Gets or sets the RTP timestamp.
Declaration
public long RtpTimestamp { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
SequenceNumber
Gets or sets the sequence number.
Declaration
public long SequenceNumber { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
SynchronizationSource
Gets or sets the synchronization source.
Declaration
public long SynchronizationSource { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
Synchronized
Gets or sets whether this frame has a SystemTimestamp that is actively synchronized with other streams.
Declaration
public bool Synchronized { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
SystemTimestamp
Gets or sets the system timestamp matching Timestamp but measured in system ticks. For local frames, this value uses the same clock as ManagedStopwatch. For remote frames, this value uses a clock known only to the remote sender.
Declaration
public long SystemTimestamp { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
Timestamp
Gets or sets the timestamp, measured according to the last buffer format's clock rate.
Declaration
public long Timestamp { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
TransportSystemTimestamp
Gets or sets the transport system timestamp. For inbound media, this value is calculated after the network layer in the transport layer when the packet payload is picked up for processing (decryption, dejitter, track routing, etc.).
Declaration
public long TransportSystemTimestamp { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
Methods
AddBuffer(TBuffer)
Adds a buffer.
Declaration
public void AddBuffer(TBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| TBuffer | buffer | The buffer. |
AddBuffers(TBuffer[])
Adds some buffers.
Declaration
public void AddBuffers(TBuffer[] buffers)
Parameters
| Type | Name | Description |
|---|---|---|
| TBuffer[] | buffers | The buffers. |
CalculateSystemTimestamp(Int64, Int64, Int32, Int64)
Calculates a system timestamp given a base system timestamp, the current timestamp, a clock rate, and a base timestamp.
Declaration
public static long CalculateSystemTimestamp(long baseSystemTimestamp, long timestamp, int clockRate, long baseTimestamp)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | baseSystemTimestamp | The base system timestamp (offset). |
| System.Int64 | timestamp | The current timestamp. |
| System.Int32 | clockRate | The clock rate of the media. |
| System.Int64 | baseTimestamp | The base timestamp (offset). |
Returns
| Type | Description |
|---|---|
| System.Int64 |
CalculateTimestamp(Int64, Int64, Int32)
Calculates a timestamp given a base system timestamp, the current system timestamp, and a clock rate. This method assumes the base timestamp is zero.
Declaration
public static long CalculateTimestamp(long baseSystemTimestamp, long systemTimestamp, int clockRate)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | baseSystemTimestamp | The base system timestamp (offset). |
| System.Int64 | systemTimestamp | The current system timestamp. |
| System.Int32 | clockRate | The clock rate of the media. |
Returns
| Type | Description |
|---|---|
| System.Int64 |
CalculateTimestamp(Int64, Int64, Int32, Int64)
Calculates a timestamp given a base system timestamp, the current system timestamp, a clock rate, and a base timestamp.
Declaration
public static long CalculateTimestamp(long baseSystemTimestamp, long systemTimestamp, int clockRate, long baseTimestamp)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | baseSystemTimestamp | The base system timestamp (offset). |
| System.Int64 | systemTimestamp | The current system timestamp. |
| System.Int32 | clockRate | The clock rate of the media. |
| System.Int64 | baseTimestamp | The base timestamp (offset). |
Returns
| Type | Description |
|---|---|
| System.Int64 |
Clone()
Clones this instance.
Declaration
public virtual TFrame Clone()
Returns
| Type | Description |
|---|---|
| TFrame |
CreateInstance()
Creates a new instance.
Declaration
public abstract TFrame CreateInstance()
Returns
| Type | Description |
|---|---|
| TFrame |
CreateMediaBufferCollection()
Creates a media buffer collection.
Declaration
protected abstract TBufferCollection CreateMediaBufferCollection()
Returns
| Type | Description |
|---|---|
| TBufferCollection |
Free()
Frees the buffers referenced by this instance.
Declaration
public TFrame Free()
Returns
| Type | Description |
|---|---|
| TFrame | This instance. |
GetBuffer(TFormat)
Gets the last buffer whose format is compatible with the specified format.
Declaration
public TBuffer GetBuffer(TFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| TFormat | format | The format. |
Returns
| Type | Description |
|---|---|
| TBuffer |
GetBuffer(TFormat, String)
Gets the last buffer whose format is compatible with the specified format and whose source ID matches the specified source ID.
Declaration
public TBuffer GetBuffer(TFormat format, string sourceId)
Parameters
| Type | Name | Description |
|---|---|---|
| TFormat | format | The format. |
| System.String | sourceId | The source identifier. |
Returns
| Type | Description |
|---|---|
| TBuffer |
GetBuffer(Boolean)
Gets the last buffer whose format packetization flag matches the specified flag.
Declaration
public TBuffer GetBuffer(bool isPacketized)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | isPacketized | Whether the buffer is packetized. |
Returns
| Type | Description |
|---|---|
| TBuffer |
GetBuffer(Boolean, Boolean)
Gets the last buffer whose format packetization and encryption flags matches the specified flags.
Declaration
public TBuffer GetBuffer(bool isPacketized, bool isEncrypted)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | isPacketized | Whether the buffer is packetized. |
| System.Boolean | isEncrypted | Whether the buffer is encrypted. |
Returns
| Type | Description |
|---|---|
| TBuffer |
GetBuffer(String)
Gets the last buffer whose format name matches the specified format name.
Declaration
public TBuffer GetBuffer(string formatName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | formatName | The format name. |
Returns
| Type | Description |
|---|---|
| TBuffer |
HasBuffer(TFormat)
Checks if a buffer exists with format equivalence.
Declaration
public bool HasBuffer(TFormat format)
Parameters
| Type | Name | Description |
|---|---|---|
| TFormat | format | The format. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
HasBuffer(TFormat, String)
Checks if a buffer exists with format equivalence and source ID.
Declaration
public bool HasBuffer(TFormat format, string sourceId)
Parameters
| Type | Name | Description |
|---|---|---|
| TFormat | format | The format. |
| System.String | sourceId | The source identifier. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
|
Keep()
Keeps the buffers referenced by this instance.
Declaration
public TFrame Keep()
Returns
| Type | Description |
|---|---|
| TFrame | This instance. |
RemoveBuffer(TBuffer)
Removes a buffer.
Declaration
public void RemoveBuffer(TBuffer buffer)
Parameters
| Type | Name | Description |
|---|---|---|
| TBuffer | buffer | The buffer. |
RemoveBuffers()
Removes all buffers.
Declaration
public void RemoveBuffers()
RemoveBuffers(TBuffer[])
Removes some buffers.
Declaration
public void RemoveBuffers(TBuffer[] buffers)
Parameters
| Type | Name | Description |
|---|---|---|
| TBuffer[] | buffers | The buffers. |
UpdateTimestamp(Int64, Int64, Int32, Int32)
Updates the timestamp to match resampling.
Declaration
public void UpdateTimestamp(long baseTimestamp, long baseRtpTimestamp, int inputClockRate, int outputClockRate)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int64 | baseTimestamp | The base timestamp, captured once for the first frame. |
| System.Int64 | baseRtpTimestamp | The base RTP timestamp, captured once for the first frame. |
| System.Int32 | inputClockRate | The input clock rate. |
| System.Int32 | outputClockRate | The output clock rate. |