Class MediaSource<TIOutput, TIInput, TIInputCollection, TSource, TFrame, TBuffer, TBufferCollection, TFormat>
A media source.
Inheritance
Implements
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class MediaSource<TIOutput, TIInput, TIInputCollection, TSource, TFrame, TBuffer, TBufferCollection, TFormat> : MediaSourceBase, IEquatable<NSObject>, INSObjectProtocol, INativeObject, IDisposable, IMediaOutput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat>, IOutput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat>, IMediaElement, IElement where TIOutput : class, IMediaOutput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat> where TIInput : class, IMediaInput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat> where TIInputCollection : IMediaInputCollection<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat, TIInputCollection> where TSource : MediaSource<TIOutput, TIInput, TIInputCollection, TSource, TFrame, TBuffer, TBufferCollection, TFormat>, TIOutput 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. |
| TIInput | The type of the input interface. |
| TIInputCollection | The type of the input interface collection. |
| TSource | The type of the source. |
| 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
MediaSource(TFormat)
Initializes a new instance of the MediaSource<TIOutput, TIInput, TIInputCollection, TSource, TFrame, TBuffer, TBufferCollection, TFormat> class.
Declaration
public MediaSource(TFormat outputFormat)
Parameters
| Type | Name | Description |
|---|---|---|
| TFormat | outputFormat | The output format. |
Properties
AllowDiagnosticTimer
Gets whether this media pipe is allowed to be timed.
Declaration
protected virtual bool AllowDiagnosticTimer { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
AllowOutputRateTimer
Gets whether this media pipe output rate is allowed to be timed.
Declaration
protected virtual bool AllowOutputRateTimer { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
CanChangeBitrate
Gets whether this source can change the output bitrate.
Declaration
protected virtual bool CanChangeBitrate { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
CanPauseBitrate
Gets whether this source can pause the output bitrate.
Declaration
protected virtual bool CanPauseBitrate { 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 source is deactivated. Deactivating a source disables it until it is activated again. Upon reactivation, a pipe may remain disabled if its outputs are disabled. A deactivated source will not raise any frames. Alias for OutputDeactivated.
Declaration
public bool Deactivated { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DeactivatedByApplication
Gets or sets whether this source is deactivated because the application has requested it.
Declaration
public bool DeactivatedByApplication { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
DeactivatedByServer
Gets or sets whether this source is deactivated because the server has requested it.
Declaration
public bool DeactivatedByServer { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Disabled
Gets a value indicating whether this source is disabled. A source is automatically disabled if it is deactivated or if all of its outputs are disabled.
Declaration
public virtual bool Disabled { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Input
Gets or sets the current input.
Declaration
public virtual SourceInput Input { get; set; }
Property Value
| Type | Description |
|---|---|
| SourceInput |
IsDestroyed
Gets whether the current state is Destroyed.
Declaration
public bool IsDestroyed { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsStarted
Gets whether the current state is Started.
Declaration
public bool IsStarted { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
IsStopped
Gets whether the current state is Stopped.
Declaration
public bool IsStopped { 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 |
MaxOutputBitrate
Gets or sets the maximum allowed output bitrate, in kbps. A value of -1 indicates unset (no maximum).
Declaration
public virtual int MaxOutputBitrate { get; protected set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
MaxOutputEncoding
Gets or sets the maximum allowed output encoding.
Declaration
public virtual EncodingInfo MaxOutputEncoding { get; protected set; }
Property Value
| Type | Description |
|---|---|
| EncodingInfo |
MinOutputBitrate
Gets or sets the minimum allowed output bitrate, in kbps. A value of -1 indicates unset (no minimum).
Declaration
public virtual int MinOutputBitrate { get; protected set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
MinOutputEncoding
Gets or sets the minimum allowed output encoding.
Declaration
public virtual EncodingInfo MinOutputEncoding { get; protected set; }
Property Value
| Type | Description |
|---|---|
| EncodingInfo |
Muted
Gets or sets whether output is muted. Alias for OutputMuted.
Declaration
public bool Muted { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Output
Gets or sets the output.
Declaration
public TIInput Output { get; set; }
Property Value
| Type | Description |
|---|---|
| TIInput |
OutputDeactivated
Gets or sets whether output is deactivated.
Declaration
public bool OutputDeactivated { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
OutputFormat
Gets the output format.
Declaration
public TFormat OutputFormat { get; }
Property Value
| Type | Description |
|---|---|
| TFormat |
OutputMuted
Gets or sets whether output is muted.
Declaration
public bool OutputMuted { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
OutputRtpStreamId
Gets or sets the output RTP stream identifier.
Declaration
public string OutputRtpStreamId { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Outputs
Gets or sets the outputs.
Declaration
public TIInput[] Outputs { get; set; }
Property Value
| Type | Description |
|---|---|
| TIInput[] |
OutputSynchronizable
Gets or sets whether output is synchronizable.
Declaration
public bool OutputSynchronizable { get; protected set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
OutputSynchronizationSource
Gets or sets the output synchronization source.
Declaration
public long OutputSynchronizationSource { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
OverConstrained
Gets whether this source is over-constrained. A source is over-constrained if it's output is over-constrained.
Declaration
public virtual bool OverConstrained { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
OverConstrainedBitrate
Gets whether the source bitrate is over-constrained. A source bitrate is over-constrained if the output bitrate is over-constrained.
Declaration
public virtual bool OverConstrainedBitrate { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
OverConstrainedOutput
Gets whether the output is over-constrained. An output is over-constrained if it's output bitrate is over-contrained.
Declaration
public virtual bool OverConstrainedOutput { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
OverConstrainedOutputBitrate
Gets whether the minimum allowed output bitrate exceeds the maximum allowed output bitrate.
Declaration
public bool OverConstrainedOutputBitrate { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
Paused
Gets a value indicating whether this source 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 |
PipelineJsonFromOutput
Gets the pipeline JSON from an output.
Declaration
public string PipelineJsonFromOutput { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
State
Gets the state.
Declaration
public MediaSourceState State { get; }
Property Value
| Type | Description |
|---|---|
| MediaSourceState |
SynchronizationSource
Gets or sets the output synchronization source. Alias for OutputSynchronizationSource.
Declaration
public long SynchronizationSource { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
SystemDelay
Gets or sets the system delay in ticks.
Declaration
public long SystemDelay { get; protected set; }
Property Value
| Type | Description |
|---|---|
| System.Int64 |
TargetOutputBitrate
Gets or sets the target output bitrate, in kbps. A value of -1 indicates unset (no target).
Declaration
public virtual int TargetOutputBitrate { get; protected set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
TargetOutputEncoding
Gets or sets the target output encoding.
Declaration
public virtual EncodingInfo TargetOutputEncoding { get; protected set; }
Property Value
| Type | Description |
|---|---|
| EncodingInfo |
Methods
AddOutput(TIInput)
Adds an output.
Declaration
public void AddOutput(TIInput output)
Parameters
| Type | Name | Description |
|---|---|---|
| TIInput | output | The output. |
AddOutputs(TIInput[])
Adds some outputs.
Declaration
public void AddOutputs(TIInput[] outputs)
Parameters
| Type | Name | Description |
|---|---|---|
| TIInput[] | outputs | The outputs. |
ChangeInput(SourceInput)
Changes the current input.
Declaration
public virtual Future<object> ChangeInput(SourceInput input)
Parameters
| Type | Name | Description |
|---|---|---|
| SourceInput | input | The input. |
Returns
| Type | Description |
|---|---|
| Future<System.Object> |
CreateInputCollection(TIOutput)
Creates an input collection.
Declaration
protected abstract TIInputCollection CreateInputCollection(TIOutput output)
Parameters
| Type | Name | Description |
|---|---|---|
| TIOutput | output | The output. |
Returns
| Type | Description |
|---|---|
| TIInputCollection |
Destroy()
Destroys this instance.
Declaration
public bool Destroy()
Returns
| Type | Description |
|---|---|
| System.Boolean |
DoDestroy()
Destroys this instance.
Declaration
protected virtual void DoDestroy()
DoProcessControlFrames(MediaControlFrame[])
Processes control frames.
Declaration
protected virtual void DoProcessControlFrames(MediaControlFrame[] controlFrames)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaControlFrame[] | controlFrames | The control frames. |
DoProcessSdpMediaDescription(MediaDescription, Boolean, Boolean)
Processes a local 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 |
DoProcessSourceStatsFromOutput(MediaSourceStats)
Processes source stats from an output.
Declaration
protected virtual void DoProcessSourceStatsFromOutput(MediaSourceStats sourceStats)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaSourceStats | sourceStats | The source stats. |
DoProcessTrackStatsFromOutput(MediaTrackStats)
Processes track stats from an output.
Declaration
protected virtual void DoProcessTrackStatsFromOutput(MediaTrackStats trackStats)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaTrackStats | trackStats | The track stats. |
DoStart()
Starts this instance.
Declaration
protected abstract Future<object> DoStart()
Returns
| Type | Description |
|---|---|
| Future<System.Object> |
DoStop()
Stops this instance.
Declaration
protected abstract Future<object> DoStop()
Returns
| Type | Description |
|---|---|
| Future<System.Object> |
GetCcmSequenceNumber()
Gets the CCM sequence number.
Declaration
public int GetCcmSequenceNumber()
Returns
| Type | Description |
|---|---|
| System.Int32 |
GetInputs()
Gets the available inputs.
Declaration
public virtual Future<SourceInput[]> GetInputs()
Returns
| Type | Description |
|---|---|
| Future<SourceInput[]> |
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. |
HasOutput(TIInput)
Determines whether this source has the specified output.
Declaration
public bool HasOutput(TIInput output)
Parameters
| Type | Name | Description |
|---|---|---|
| TIInput | output | The output. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
IncrementCcmSequenceNumber()
Increments the CCM sequence number.
Declaration
public void IncrementCcmSequenceNumber()
OutputAdded(TIInput)
Called when an output is added.
Declaration
protected virtual void OutputAdded(TIInput output)
Parameters
| Type | Name | Description |
|---|---|---|
| TIInput | output | The output. |
OutputCanProcessFrame(TIInput)
Determines whether an output can process a frame from this pipe.
Declaration
protected virtual bool OutputCanProcessFrame(TIInput output)
Parameters
| Type | Name | Description |
|---|---|---|
| TIInput | output | The output. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
OutputRemoved(TIInput)
Called when an output is removed.
Declaration
protected virtual void OutputRemoved(TIInput output)
Parameters
| Type | Name | Description |
|---|---|---|
| TIInput | output | The output. |
ProcessControlFrame(MediaControlFrame)
Processes a control frame.
Declaration
public void ProcessControlFrame(MediaControlFrame controlFrame)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaControlFrame | controlFrame | The control frame. |
ProcessControlFrames(MediaControlFrame[])
Processes control frames.
Declaration
public void ProcessControlFrames(MediaControlFrame[] controlFrames)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaControlFrame[] | controlFrames | The control frames. |
ProcessSdpMediaDescriptionFromOutput(MediaDescription, Boolean, Boolean)
Processes a local SDP media description from an output.
Declaration
public Error ProcessSdpMediaDescriptionFromOutput(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 |
ProcessSourceStatsFromOutput(MediaSourceStats)
Processes source stats from an output.
Declaration
public void ProcessSourceStatsFromOutput(MediaSourceStats sourceStats)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaSourceStats | sourceStats | The source stats. |
ProcessTrackStatsFromOutput(MediaTrackStats)
Processes track stats from an output.
Declaration
public void ProcessTrackStatsFromOutput(MediaTrackStats trackStats)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaTrackStats | trackStats | The track stats. |
RaiseControlFrameResponse(MediaControlFrame)
Raises a control frame response.
Declaration
protected void RaiseControlFrameResponse(MediaControlFrame controlFrameResponse)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaControlFrame | controlFrameResponse | The control frame response. |
RaiseControlFrameResponse(MediaControlFrame, TIInput[])
Raises a control frame response.
Declaration
protected void RaiseControlFrameResponse(MediaControlFrame controlFrameResponse, TIInput[] outputs)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaControlFrame | controlFrameResponse | The control frame response. |
| TIInput[] | outputs | The outputs. |
RaiseControlFrameResponses(MediaControlFrame[])
Raises control frame responses.
Declaration
protected void RaiseControlFrameResponses(MediaControlFrame[] controlFrameResponses)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaControlFrame[] | controlFrameResponses | The control frame responses. |
RaiseControlFrameResponses(MediaControlFrame[], TIInput[])
Raises control frame responses.
Declaration
protected void RaiseControlFrameResponses(MediaControlFrame[] controlFrameResponses, TIInput[] outputs)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaControlFrame[] | controlFrameResponses | The control frame responses. |
| TIInput[] | outputs | The outputs. |
RaiseDisabledChange()
Raises the OnDisabledChange event.
Declaration
protected void RaiseDisabledChange()
RaiseFrame(TFrame)
Raises a frame.
Declaration
protected virtual void RaiseFrame(TFrame frame)
Parameters
| Type | Name | Description |
|---|---|---|
| TFrame | frame | The frame. |
RemoveOutput(TIInput)
Removes an output.
Declaration
public bool RemoveOutput(TIInput output)
Parameters
| Type | Name | Description |
|---|---|---|
| TIInput | output | The output. |
Returns
| Type | Description |
|---|---|
| System.Boolean |
RemoveOutputs()
Removes all outputs.
Declaration
public void RemoveOutputs()
RemoveOutputs(TIInput[])
Removes some outputs.
Declaration
public void RemoveOutputs(TIInput[] outputs)
Parameters
| Type | Name | Description |
|---|---|---|
| TIInput[] | outputs | The outputs. |
Start()
Starts this instance.
Declaration
public override Future<object> Start()
Returns
| Type | Description |
|---|---|
| Future<System.Object> |
Overrides
Stop()
Stops this instance.
Declaration
public override Future<object> Stop()
Returns
| Type | Description |
|---|---|
| Future<System.Object> |
Overrides
ToString()
Returns a string that represents this instance.
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String |
Overrides
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 |
OnDisabledChangeWithCaller
Raised when the Disabled property changes state.
Declaration
public event Action1<object> OnDisabledChangeWithCaller
Event Type
| Type | Description |
|---|---|
| Action1<System.Object> |
OnMuted
Raised when the source is muted.
Declaration
public event Action0 OnMuted
Event Type
| Type | Description |
|---|---|
| Action0 |
OnPausedChange
Raised when the Paused property changes state.
Declaration
public event Action0 OnPausedChange
Event Type
| Type | Description |
|---|---|
| Action0 |
OnProcessControlFrames
Raised when control frames are processed.
Declaration
public event Action1<MediaControlFrame[]> OnProcessControlFrames
Event Type
| Type | Description |
|---|---|
| Action1<MediaControlFrame[]> |
OnProcessedControlFrames
Raised when control frames have been processed.
Declaration
public event Action1<MediaControlFrame[]> OnProcessedControlFrames
Event Type
| Type | Description |
|---|---|
| Action1<MediaControlFrame[]> |
OnRaiseControlFrameResponses
Raised when control frame responses are raised.
Declaration
public event Action1<MediaControlFrame[]> OnRaiseControlFrameResponses
Event Type
| Type | Description |
|---|---|
| Action1<MediaControlFrame[]> |
OnRaisedControlFrameResponses
Raised when control frame responses have been raised.
Declaration
public event Action1<MediaControlFrame[]> OnRaisedControlFrameResponses
Event Type
| Type | Description |
|---|---|
| Action1<MediaControlFrame[]> |
OnRaisedFrame
Raised when a frame has been raised.
Declaration
public event Action1<TFrame> OnRaisedFrame
Event Type
| Type | Description |
|---|---|
| Action1<TFrame> |
OnRaiseFrame
Raised when a frame is being raised.
Declaration
public event Action1<TFrame> OnRaiseFrame
Event Type
| Type | Description |
|---|---|
| Action1<TFrame> |
OnStateChange
Raised when the state changes.
Declaration
public event Action1<TSource> OnStateChange
Event Type
| Type | Description |
|---|---|
| Action1<TSource> |
OnUnmuted
Raised when the source is unmuted.
Declaration
public event Action0 OnUnmuted
Event Type
| Type | Description |
|---|---|
| Action0 |