Class MediaSink<TIOutput, TIOutputCollection, TIInput, TSink, TFrame, TBuffer, TBufferCollection, TFormat>
A media sink.
Inheritance
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class MediaSink<TIOutput, TIOutputCollection, TIInput, TSink, TFrame, TBuffer, TBufferCollection, TFormat> : MediaSinkBase, IMediaInput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat>, IInput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat>, IMediaElement, IElement where TIOutput : class, IMediaOutput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat> where TIOutputCollection : IMediaOutputCollection<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat, TIOutputCollection> where TIInput : class, IMediaInput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat> where TSink : MediaSink<TIOutput, TIOutputCollection, TIInput, TSink, TFrame, TBuffer, TBufferCollection, TFormat>, TIInput where TFrame : MediaFrame<TBuffer, TBufferCollection, TFormat, TFrame> where TBuffer : MediaBuffer<TFormat, TBuffer> where TBufferCollection : MediaBufferCollection<TBuffer, TBufferCollection, TFormat> where TFormat : MediaFormat<TFormat>
Type Parameters
Name | Description |
---|---|
TIOutput | The type of the output interface. |
TIOutputCollection | The type of the output interface collection. |
TIInput | The type of the input interface. |
TSink | The type of the sink. |
TFrame | The type of the frame. |
TBuffer | The type of the buffer. |
TBufferCollection | The type of the buffer collection. |
TFormat | The type of the format. |
Constructors
MediaSink()
Initializes a new instance of the MediaSink<TIOutput, TIOutputCollection, TIInput, TSink, TFrame, TBuffer, TBufferCollection, TFormat> class.
Declaration
public MediaSink()
MediaSink(TFormat)
Initializes a new instance of the MediaSink<TIOutput, TIOutputCollection, TIInput, TSink, TFrame, TBuffer, TBufferCollection, TFormat> class.
Declaration
public MediaSink(TFormat inputFormat)
Parameters
Type | Name | Description |
---|---|---|
TFormat | inputFormat | The input format. |
Properties
AllowDiagnosticTimer
Gets whether this media sink is allowed to be timed.
Declaration
protected virtual bool AllowDiagnosticTimer { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
AllowInputRateTimer
Gets whether this media pipe input rate is allowed to be timed.
Declaration
protected virtual bool AllowInputRateTimer { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Content
Gets the content descriptor.
Declaration
public virtual string Content { get; }
Property Value
Type | Description |
---|---|
System.String |
Deactivated
Gets or sets a value indicating whether this sink is deactivated. Deactivating a sink disables it until it is activated again. A deactivated sink will not process any frames. Alias for InputDeactivated.
Declaration
public bool Deactivated { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Disabled
Gets or sets a value indicating whether this sink is disabled. A sink is automatically disabled if it is deactivated. A disabled sink will not accept frames raised by its inputs. Setting the value of MediaSink.Disabled is deprecated. Set MediaSink.Deactivated instead.
Declaration
public virtual bool Disabled { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Input
Gets or sets the input.
Declaration
public TIOutput Input { get; set; }
Property Value
Type | Description |
---|---|
TIOutput |
InputDeactivated
Gets or sets whether input is deactivated.
Declaration
public bool InputDeactivated { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
InputFormat
Gets the input format.
Declaration
public TFormat InputFormat { get; }
Property Value
Type | Description |
---|---|
TFormat |
InputMuted
Gets or sets whether input is muted.
Declaration
public bool InputMuted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
InputRtpStreamId
Gets or sets the input RTP stream identifier. If the input RTP stream identifier is null (unset), then getting this property returns the first valid output RTP stream identifier from the array of Inputs, or null if they are all unset.
Declaration
public string InputRtpStreamId { get; set; }
Property Value
Type | Description |
---|---|
System.String |
Inputs
Gets or sets the inputs.
Declaration
public TIOutput[] Inputs { get; set; }
Property Value
Type | Description |
---|---|
TIOutput[] |
InputSynchronizationSource
Gets or sets the input synchronization source. If the input synchronization source is -1 (unset), then getting this property returns the first valid output synchronization source from the array of Inputs, or -1 if they are all unset.
Declaration
public long InputSynchronizationSource { get; set; }
Property Value
Type | Description |
---|---|
System.Int64 |
IsMixer
Gets whether this sink processes media from different sources.
Declaration
protected virtual bool IsMixer { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Label
Gets a label that identifies this class.
Declaration
public abstract string Label { get; }
Property Value
Type | Description |
---|---|
System.String |
MaxInputBitrate
Gets or sets the maximum allowed input bitrate, in kbps. A value of -1 indicates unset (no maximum). Returns -1 by default.
Declaration
public virtual int MaxInputBitrate { get; protected set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MaxInputEncoding
Gets or sets the maximum allowed input encoding.
Declaration
public virtual EncodingInfo MaxInputEncoding { get; protected set; }
Property Value
Type | Description |
---|---|
EncodingInfo |
MinInputBitrate
Gets or sets the minimum allowed input bitrate, in kbps. A value of -1 indicates unset (no minimum). Returns -1 by default.
Declaration
public virtual int MinInputBitrate { get; protected set; }
Property Value
Type | Description |
---|---|
System.Int32 |
MinInputEncoding
Gets or sets the minimum allowed input encoding.
Declaration
public virtual EncodingInfo MinInputEncoding { get; protected set; }
Property Value
Type | Description |
---|---|
EncodingInfo |
Muted
Gets or sets whether input is muted. Alias for InputMuted.
Declaration
public bool Muted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Output
Gets or sets the current output.
Declaration
public virtual SinkOutput Output { get; set; }
Property Value
Type | Description |
---|---|
SinkOutput |
OverConstrained
Gets whether this sink is over-constrained. A sink is over-constrained if it's input is over-constrained.
Declaration
public virtual bool OverConstrained { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
OverConstrainedBitrate
Gets whether the sink bitrate is over-constrained. A sink bitrate is over-constrained if the input bitrate is over-constrained.
Declaration
public virtual bool OverConstrainedBitrate { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
OverConstrainedInput
Gets whether the input is over-contrained. An input is over-constrained if it's input bitrate is over-contrained.
Declaration
public virtual bool OverConstrainedInput { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
OverConstrainedInputBitrate
Gets whether the minimum allowed input bitrate exceeds the maximum allowed input bitrate.
Declaration
public bool OverConstrainedInputBitrate { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Paused
Gets a value indicating whether this sink is paused.
Declaration
public bool Paused { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Persistent
Gets or sets a value indicating whether this instance is persistent.
If true
, this instance will not be destroyed unless
Destroy() is called explicitly on this instance.
It will survive destruction of any parent elements that are
being destroyed.
Declaration
public bool Persistent { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
PipelineJson
Gets the pipeline JSON with this as the central point.
Declaration
public string PipelineJson { get; }
Property Value
Type | Description |
---|---|
System.String |
PipelineJsonFromInput
Gets the pipeline JSON from an input.
Declaration
public string PipelineJsonFromInput { get; }
Property Value
Type | Description |
---|---|
System.String |
ProcessFramePolicy
Gets or sets the ProcessFramePolicy for this media input.
Declaration
public ProcessFramePolicy ProcessFramePolicy { get; set; }
Property Value
Type | Description |
---|---|
ProcessFramePolicy |
State
Gets the state.
Declaration
public MediaSinkState State { get; }
Property Value
Type | Description |
---|---|
MediaSinkState |
SystemDelay
Gets or sets the system delay in ticks.
Declaration
public long SystemDelay { get; protected set; }
Property Value
Type | Description |
---|---|
System.Int64 |
Methods
AddInput(TIOutput)
Adds an input.
Declaration
public void AddInput(TIOutput input)
Parameters
Type | Name | Description |
---|---|---|
TIOutput | input | The input. |
AddInputs(TIOutput[])
Adds some inputs.
Declaration
public void AddInputs(TIOutput[] inputs)
Parameters
Type | Name | Description |
---|---|---|
TIOutput[] | inputs | The inputs. |
ChangeOutput(SinkOutput)
Changes the current output.
Declaration
public virtual Future<object> ChangeOutput(SinkOutput output)
Parameters
Type | Name | Description |
---|---|---|
SinkOutput | output | The output. |
Returns
Type | Description |
---|---|
Future<System.Object> |
CreateOutputCollection(TIInput)
Creates an output collection.
Declaration
protected abstract TIOutputCollection CreateOutputCollection(TIInput input)
Parameters
Type | Name | Description |
---|---|---|
TIInput | input | The input. |
Returns
Type | Description |
---|---|
TIOutputCollection |
Destroy()
Destroys this instance.
Declaration
public bool Destroy()
Returns
Type | Description |
---|---|
System.Boolean |
DoDestroy()
Destroys this instance.
Declaration
protected abstract void DoDestroy()
DoPostProcessFrame(TFrame, TBuffer)
Post-processes a frame.
Declaration
protected virtual void DoPostProcessFrame(TFrame frame, TBuffer inputBuffer)
Parameters
Type | Name | Description |
---|---|---|
TFrame | frame | The frame. |
TBuffer | inputBuffer | The input buffer. |
DoPreProcessFrame(TFrame, TBuffer)
Pre-processes a frame.
Declaration
protected virtual void DoPreProcessFrame(TFrame frame, TBuffer inputBuffer)
Parameters
Type | Name | Description |
---|---|---|
TFrame | frame | The frame. |
TBuffer | inputBuffer | The input buffer. |
DoProcessControlFrameResponses(MediaControlFrame[])
Processes control frame responses.
Declaration
protected virtual void DoProcessControlFrameResponses(MediaControlFrame[] controlFrameResponses)
Parameters
Type | Name | Description |
---|---|---|
MediaControlFrame[] | controlFrameResponses | The control frame responses. |
DoProcessFrame(TFrame, TBuffer)
Processes a frame.
Declaration
protected abstract void DoProcessFrame(TFrame frame, TBuffer inputBuffer)
Parameters
Type | Name | Description |
---|---|---|
TFrame | frame | The frame. |
TBuffer | inputBuffer | The input buffer. |
DoProcessSdpMediaDescription(MediaDescription, Boolean, Boolean)
Processes a remote SDP media description.
Declaration
protected virtual Error DoProcessSdpMediaDescription(MediaDescription mediaDescription, bool isOffer, bool isLocalDescription)
Parameters
Type | Name | Description |
---|---|---|
MediaDescription | mediaDescription | The media description. |
System.Boolean | isOffer | if set to |
System.Boolean | isLocalDescription | if set to |
Returns
Type | Description |
---|---|
Error |
DoProcessSinkStatsFromInput(MediaSinkStats)
Processes sink stats from an input.
Declaration
protected virtual void DoProcessSinkStatsFromInput(MediaSinkStats sinkStats)
Parameters
Type | Name | Description |
---|---|---|
MediaSinkStats | sinkStats | The stats. |
DoProcessTrackStatsFromInput(MediaTrackStats)
Processes track stats from an input.
Declaration
protected virtual void DoProcessTrackStatsFromInput(MediaTrackStats trackStats)
Parameters
Type | Name | Description |
---|---|---|
MediaTrackStats | trackStats | The track stats. |
GetCcmSequenceNumber()
Gets the CCM sequence number.
Declaration
public int GetCcmSequenceNumber()
Returns
Type | Description |
---|---|
System.Int32 |
GetOutputs()
Gets the available outputs.
Declaration
public virtual Future<SinkOutput[]> GetOutputs()
Returns
Type | Description |
---|---|
Future<SinkOutput[]> |
GetPipelineSystemDelay(TFormat)
Gets the total pipeline system delay in ticks for a given output format.
Declaration
public long GetPipelineSystemDelay(TFormat outputFormat)
Parameters
Type | Name | Description |
---|---|---|
TFormat | outputFormat | The output format. |
Returns
Type | Description |
---|---|
System.Int64 | The total pipeline system delay in ticks. |
HasInput(TIOutput)
Determines whether this pipe has the specified input.
Declaration
public bool HasInput(TIOutput input)
Parameters
Type | Name | Description |
---|---|---|
TIOutput | input | The input. |
Returns
Type | Description |
---|---|
System.Boolean |
IncrementCcmSequenceNumber()
Increments the CCM sequence number.
Declaration
public void IncrementCcmSequenceNumber()
InputAdded(TIOutput)
Called when an input is added.
Declaration
protected virtual void InputAdded(TIOutput input)
Parameters
Type | Name | Description |
---|---|---|
TIOutput | input | The input. |
InputRemoved(TIOutput)
Called when an input is removed.
Declaration
protected virtual void InputRemoved(TIOutput input)
Parameters
Type | Name | Description |
---|---|---|
TIOutput | input | The input. |
ProcessControlFrameResponse(MediaControlFrame)
Processes a control frame response.
Declaration
public void ProcessControlFrameResponse(MediaControlFrame controlFrameResponse)
Parameters
Type | Name | Description |
---|---|---|
MediaControlFrame | controlFrameResponse | The control frame response. |
ProcessControlFrameResponses(MediaControlFrame[])
Processes control frame responses.
Declaration
public void ProcessControlFrameResponses(MediaControlFrame[] controlFrameResponses)
Parameters
Type | Name | Description |
---|---|---|
MediaControlFrame[] | controlFrameResponses | The control frame responses. |
ProcessFrame(TFrame)
Processes a frame.
Declaration
public virtual bool ProcessFrame(TFrame frame)
Parameters
Type | Name | Description |
---|---|---|
TFrame | frame | The frame. |
Returns
Type | Description |
---|---|
System.Boolean |
ProcessSdpMediaDescriptionFromInput(MediaDescription, Boolean, Boolean)
Processes a remote SDP media description from an output.
Declaration
public Error ProcessSdpMediaDescriptionFromInput(MediaDescription mediaDescription, bool isOffer, bool isLocalDescription)
Parameters
Type | Name | Description |
---|---|---|
MediaDescription | mediaDescription | The media description. |
System.Boolean | isOffer | if set to |
System.Boolean | isLocalDescription | if set to |
Returns
Type | Description |
---|---|
Error |
ProcessSinkStatsFromInput(MediaSinkStats)
Processes sink stats from an input.
Declaration
public void ProcessSinkStatsFromInput(MediaSinkStats sinkStats)
Parameters
Type | Name | Description |
---|---|---|
MediaSinkStats | sinkStats | The sink stats. |
ProcessTrackStatsFromInput(MediaTrackStats)
Processes track stats from an input.
Declaration
public void ProcessTrackStatsFromInput(MediaTrackStats trackStats)
Parameters
Type | Name | Description |
---|---|---|
MediaTrackStats | trackStats | The track stats. |
RaiseControlFrame(MediaControlFrame)
Raises a control frame.
Declaration
protected void RaiseControlFrame(MediaControlFrame controlFrame)
Parameters
Type | Name | Description |
---|---|---|
MediaControlFrame | controlFrame | The control frame. |
RaiseControlFrame(MediaControlFrame, TIOutput[])
Raises a control frame.
Declaration
protected void RaiseControlFrame(MediaControlFrame controlFrame, TIOutput[] inputs)
Parameters
Type | Name | Description |
---|---|---|
MediaControlFrame | controlFrame | The control frame. |
TIOutput[] | inputs | The inputs. |
RaiseControlFrames(MediaControlFrame[])
Raises control frames.
Declaration
protected void RaiseControlFrames(MediaControlFrame[] controlFrames)
Parameters
Type | Name | Description |
---|---|---|
MediaControlFrame[] | controlFrames | The control frames. |
RaiseControlFrames(MediaControlFrame[], TIOutput[])
Raises control frames.
Declaration
protected void RaiseControlFrames(MediaControlFrame[] controlFrames, TIOutput[] inputs)
Parameters
Type | Name | Description |
---|---|---|
MediaControlFrame[] | controlFrames | The control frames. |
TIOutput[] | inputs | The inputs. |
RaiseDisabledChange()
Raises the OnDisabledChange event.
Declaration
protected void RaiseDisabledChange()
RemoveInput(TIOutput)
Removes an input.
Declaration
public bool RemoveInput(TIOutput input)
Parameters
Type | Name | Description |
---|---|---|
TIOutput | input | The input. |
Returns
Type | Description |
---|---|
System.Boolean |
RemoveInputs()
Removes all inputs.
Declaration
public void RemoveInputs()
RemoveInputs(TIOutput[])
Removes some inputs.
Declaration
public void RemoveInputs(TIOutput[] inputs)
Parameters
Type | Name | Description |
---|---|---|
TIOutput[] | inputs | The inputs. |
ToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String |
TrySetInputFormat(TFrame)
Sets the input format, if not set, using the frame's last buffer format.
Declaration
protected bool TrySetInputFormat(TFrame frame)
Parameters
Type | Name | Description |
---|---|---|
TFrame | frame | The frame. |
Returns
Type | Description |
---|---|
System.Boolean |
|
UpdateDisabled()
Updates the disabled property.
Declaration
protected bool UpdateDisabled()
Returns
Type | Description |
---|---|
System.Boolean |
Events
OnDisabledChange
Raised when the Disabled property changes state.
Declaration
public event Action0 OnDisabledChange
Event Type
Type | Description |
---|---|
Action0 |
OnPausedChange
Raised when the Paused property changes state.
Declaration
public event Action0 OnPausedChange
Event Type
Type | Description |
---|---|
Action0 |
OnProcessControlFrameResponses
Raised when control frame responses are processed.
Declaration
public event Action1<MediaControlFrame[]> OnProcessControlFrameResponses
Event Type
Type | Description |
---|---|
Action1<MediaControlFrame[]> |
OnProcessedControlFrameResponses
Raised when control frame responses have been processed.
Declaration
public event Action1<MediaControlFrame[]> OnProcessedControlFrameResponses
Event Type
Type | Description |
---|---|
Action1<MediaControlFrame[]> |
OnProcessedFrame
Raised when a frame has been processed.
Declaration
public event Action1<TFrame> OnProcessedFrame
Event Type
Type | Description |
---|---|
Action1<TFrame> |
OnProcessFrame
Raised when a frame is being processed.
Declaration
public event Action1<TFrame> OnProcessFrame
Event Type
Type | Description |
---|---|
Action1<TFrame> |
OnProcessFrameException
Raised when an exception is thrown while processing a frame.
Declaration
public event Action2<TFrame, Exception> OnProcessFrameException
Event Type
Type | Description |
---|---|
Action2<TFrame, Exception> |
OnProcessFrameWithCaller
Raised when a frame is being processed.
Declaration
public event Action2<object, TFrame> OnProcessFrameWithCaller
Event Type
Type | Description |
---|---|
Action2<System.Object, TFrame> |
OnRaiseControlFrames
Raised when control frames are raised.
Declaration
public event Action1<MediaControlFrame[]> OnRaiseControlFrames
Event Type
Type | Description |
---|---|
Action1<MediaControlFrame[]> |
OnRaisedControlFrames
Raised when control frames have been raised.
Declaration
public event Action1<MediaControlFrame[]> OnRaisedControlFrames
Event Type
Type | Description |
---|---|
Action1<MediaControlFrame[]> |
OnStateChange
Raised when the state changes.
Declaration
public event Action1<TSink> OnStateChange
Event Type
Type | Description |
---|---|
Action1<TSink> |