Class MediaTrack<TIOutput, TIOutputCollection, TIInput, TIInputCollection, TIElement, TSource, TSink, TPipe, TTrack, TBranch, TFrame, TBuffer, TBufferCollection, TFormat>
A media track.
Inheritance
Inherited Members
Namespace: FM.LiveSwitch
Assembly: FM.LiveSwitch.dll
Syntax
public abstract class MediaTrack<TIOutput, TIOutputCollection, TIInput, TIInputCollection, TIElement, TSource, TSink, TPipe, TTrack, TBranch, TFrame, TBuffer, TBufferCollection, TFormat> : MediaTrackBase, IMediaTrack, IMediaElement, IElement where TIOutput : class, IMediaOutput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat>, TIElement where TIOutputCollection : IMediaOutputCollection<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat, TIOutputCollection> where TIInput : class, IMediaInput<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat>, TIElement where TIInputCollection : IMediaInputCollection<TIOutput, TIInput, TFrame, TBuffer, TBufferCollection, TFormat, TIInputCollection> where TIElement : IMediaElement where TSource : MediaSource<TIOutput, TIInput, TIInputCollection, TSource, TFrame, TBuffer, TBufferCollection, TFormat>, TIOutput where TSink : MediaSink<TIOutput, TIOutputCollection, TIInput, TSink, TFrame, TBuffer, TBufferCollection, TFormat>, TIInput where TPipe : MediaPipe<TIOutput, TIOutputCollection, TIInput, TIInputCollection, TPipe, TFrame, TBuffer, TBufferCollection, TFormat>, TIOutput, TIInput where TTrack : MediaTrack<TIOutput, TIOutputCollection, TIInput, TIInputCollection, TIElement, TSource, TSink, TPipe, TTrack, TBranch, TFrame, TBuffer, TBufferCollection, TFormat> where TBranch : MediaBranch<TIOutput, TIOutputCollection, TIInput, TIInputCollection, TIElement, TSource, TSink, TPipe, TTrack, TBranch, TFrame, TBuffer, TBufferCollection, TFormat>, TIElement 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 source collection. |
TIInput | The type of the input interface. |
TIInputCollection | The type of the sink collection. |
TIElement | The type of the element interface |
TSource | The type of the source. |
TSink | The type of the sink. |
TPipe | The type of the pipe. |
TTrack | The type of the track. |
TBranch | The type of the branch. |
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. |
Properties
ActiveSink
Gets the active sink. This will return Sink
if Sink is not null
and not disabled.
Otherwise, if this track branches, it will iterate recursively
over the active tracks until it finds an ActiveSink.
Otherwise, it will return null
.
Declaration
public TSink ActiveSink { get; }
Property Value
Type | Description |
---|---|
TSink |
Deactivated
Gets or sets a value indicating whether this track is deactivated. A track is deactivated if its first element is deactivated.
Declaration
public bool Deactivated { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Disabled
Gets a value indicating whether this track is disabled. A track is disabled if its first element is disabled.
Declaration
public bool Disabled { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Elements
Gets the elements.
Declaration
public abstract TIElement[] Elements { get; }
Property Value
Type | Description |
---|---|
TIElement[] |
ExternalId
Gets or sets the external identifier.
Declaration
public string ExternalId { get; set; }
Property Value
Type | Description |
---|---|
System.String |
FirstElement
Gets the first element.
Declaration
public TIElement FirstElement { get; }
Property Value
Type | Description |
---|---|
TIElement |
Id
Gets the identifier.
Declaration
public string Id { get; }
Property Value
Type | Description |
---|---|
System.String |
Input
Gets the first input, if this track
has inputs. Otherwise, returns null
.
Declaration
public TIInput Input { get; }
Property Value
Type | Description |
---|---|
TIInput |
InputFormat
Gets the input format.
Declaration
public TFormat InputFormat { get; }
Property Value
Type | Description |
---|---|
TFormat |
Inputs
Gets the track inputs.
Declaration
public TIInput[] Inputs { get; }
Property Value
Type | Description |
---|---|
TIInput[] |
IsBranched
Gets a value indicating whether this track's last element is a branch.
Declaration
public bool IsBranched { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsEmpty
Gets a value indicating whether this instance is empty.
Declaration
public bool IsEmpty { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsTerminated
Gets a value indicating whether this track's last element is a sink.
Declaration
public bool IsTerminated { 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 |
LastElement
Gets the last element.
Declaration
public TIElement LastElement { get; }
Property Value
Type | Description |
---|---|
TIElement |
Muted
Gets or sets a value indicating whether any of the elements in this track are muted. Setting a value will apply to all elements.
Declaration
public override bool Muted { get; set; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
Output
Gets the first output, if this track
has outputs. Otherwise, returns null
.
Declaration
public TIOutput Output { get; }
Property Value
Type | Description |
---|---|
TIOutput |
OutputFormat
Gets the output format.
Declaration
public TFormat OutputFormat { get; }
Property Value
Type | Description |
---|---|
TFormat |
Outputs
Gets the track outputs.
Declaration
public TIOutput[] Outputs { get; }
Property Value
Type | Description |
---|---|
TIOutput[] |
Paused
Gets a value indicating whether this track is paused. A track is paused if its last elements 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 using the first element as a starting point.
Declaration
public string PipelineJson { get; }
Property Value
Type | Description |
---|---|
System.String |
Sink
Gets the sink, if the last element
is a sink. Otherwise, returns null
.
Declaration
public TSink Sink { get; }
Property Value
Type | Description |
---|---|
TSink |
SinkOutput
Gets or sets the current sink output.
Declaration
public override SinkOutput SinkOutput { get; set; }
Property Value
Type | Description |
---|---|
SinkOutput |
Overrides
Sinks
Gets the sinks. This will return Sink
if Sink is not null
.
Otherwise, if this track branches, it will iterate recursively
over the branched tracks.
Declaration
public TSink[] Sinks { get; }
Property Value
Type | Description |
---|---|
TSink[] |
Source
Gets the source, if the first element
is a source. Otherwise, returns null
.
Declaration
public TSource Source { get; }
Property Value
Type | Description |
---|---|
TSource |
SourceInput
Gets or sets the current source input.
Declaration
public override SourceInput SourceInput { get; set; }
Property Value
Type | Description |
---|---|
SourceInput |
Overrides
Methods
AddElement(TIElement)
Adds an element.
Declaration
protected abstract void AddElement(TIElement element)
Parameters
Type | Name | Description |
---|---|---|
TIElement | element |
ArrayFromInputs(List<TIInput>)
Creates an array of inputs from a list of inputs.
Declaration
protected abstract TIInput[] ArrayFromInputs(List<TIInput> inputs)
Parameters
Type | Name | Description |
---|---|---|
List<TIInput> | inputs | The list of inputs. |
Returns
Type | Description |
---|---|
TIInput[] |
ArrayFromOutputs(List<TIOutput>)
Creates an array of outputs from a list of outputs.
Declaration
protected abstract TIOutput[] ArrayFromOutputs(List<TIOutput> outputs)
Parameters
Type | Name | Description |
---|---|---|
List<TIOutput> | outputs | The list of outputs. |
Returns
Type | Description |
---|---|
TIOutput[] |
ArrayFromSinks(List<TSink>)
Creates an array of sinks from a list of sinks.
Declaration
protected abstract TSink[] ArrayFromSinks(List<TSink> sinks)
Parameters
Type | Name | Description |
---|---|---|
List<TSink> | sinks | The list of sinks. |
Returns
Type | Description |
---|---|
TSink[] |
BranchFromTracks(TTrack[])
Creates a branch from an array of tracks.
Declaration
protected abstract TBranch BranchFromTracks(TTrack[] tracks)
Parameters
Type | Name | Description |
---|---|---|
TTrack[] | tracks | The tracks. |
Returns
Type | Description |
---|---|
TBranch |
ChangeSinkOutput(SinkOutput)
Changes the sink output while the media track is active.
Declaration
public override Future<object> ChangeSinkOutput(SinkOutput sinkOutput)
Parameters
Type | Name | Description |
---|---|---|
SinkOutput | sinkOutput | The sink output. |
Returns
Type | Description |
---|---|
Future<System.Object> |
Overrides
ChangeSourceInput(SourceInput)
Changes the source input while the media track is active.
Declaration
public override Future<object> ChangeSourceInput(SourceInput sourceInput)
Parameters
Type | Name | Description |
---|---|---|
SourceInput | sourceInput | The source input. |
Returns
Type | Description |
---|---|
Future<System.Object> |
Overrides
Destroy()
Destroys this media track.
Declaration
public override bool Destroy()
Returns
Type | Description |
---|---|
System.Boolean |
Overrides
FindElement(Function1<TIElement, Boolean>)
Finds an element in the track. This method will recursively call into any branched tracks.
Declaration
public TIElement FindElement(Function1<TIElement, bool> where)
Parameters
Type | Name | Description |
---|---|---|
Function1<TIElement, System.Boolean> | where |
Returns
Type | Description |
---|---|
TIElement | The first element found matching the given 'where' function,
or |
FindElement(Function1<TIElement, Boolean>, Boolean)
Finds an element in this track. If the recurse flag is set, then this method will recursively call into any branched tracks.
Declaration
public TIElement FindElement(Function1<TIElement, bool> where, bool recurse)
Parameters
Type | Name | Description |
---|---|---|
Function1<TIElement, System.Boolean> | where | |
System.Boolean | recurse |
Returns
Type | Description |
---|---|
TIElement | The first element found matching the given 'where' function,
or |
FindElement<T>()
Finds an element in the track. This method will recursively call into any branched tracks.
Declaration
public T FindElement<T>()
where T : TIElement
Returns
Type | Description |
---|---|
T | The first element found matching the given type,
or |
Type Parameters
Name | Description |
---|---|
T |
FindElement<T>(Boolean)
Finds an element in this track. If the recurse flag is set, then this method will recursively call into any branched tracks.
Declaration
public T FindElement<T>(bool recurse)
where T : TIElement
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | recurse |
Returns
Type | Description |
---|---|
T | The first element found matching the given type,
or |
Type Parameters
Name | Description |
---|---|
T |
FindElements(Function1<TIElement, Boolean>)
Finds elements in the track. This method will recursively call into any branched tracks.
Declaration
public List<TIElement> FindElements(Function1<TIElement, bool> where)
Parameters
Type | Name | Description |
---|---|---|
Function1<TIElement, System.Boolean> | where |
Returns
Type | Description |
---|---|
List<TIElement> | A list of elements found matching the given 'where' function,
or |
FindElements(Function1<TIElement, Boolean>, Boolean)
Finds elements in this track. If the recurse flag is set, then this method will recursively call into any branched tracks.
Declaration
public List<TIElement> FindElements(Function1<TIElement, bool> where, bool recurse)
Parameters
Type | Name | Description |
---|---|---|
Function1<TIElement, System.Boolean> | where | |
System.Boolean | recurse |
Returns
Type | Description |
---|---|
List<TIElement> | A list of elements found matching the given 'where' function,
or |
FindElements<T>()
Finds elements in this track. If the recurse flag is set, then this method will recursively call into any branched tracks.
Declaration
public List<T> FindElements<T>()
where T : TIElement
Returns
Type | Description |
---|---|
List<T> | A list of elements found matching the given type,
or |
Type Parameters
Name | Description |
---|---|
T |
FindElements<T>(Boolean)
Finds elements in this track. If the recurse flag is set, then this method will recursively call into any branched tracks.
Declaration
public List<T> FindElements<T>(bool recurse)
where T : TIElement
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | recurse |
Returns
Type | Description |
---|---|
List<T> | A list of elements found matching the given type,
or |
Type Parameters
Name | Description |
---|---|
T |
GetSinkOutputs()
Gets the available sink outputs.
Declaration
public override Future<SinkOutput[]> GetSinkOutputs()
Returns
Type | Description |
---|---|
Future<SinkOutput[]> | A future with an array of sink outputs. |
Overrides
GetSourceInputs()
Gets the available source inputs.
Declaration
public override Future<SourceInput[]> GetSourceInputs()
Returns
Type | Description |
---|---|
Future<SourceInput[]> | A future with an array of source inputs. |
Overrides
IsBranch(TIElement)
Determines whether the specified element is a branch.
Declaration
protected abstract bool IsBranch(TIElement element)
Parameters
Type | Name | Description |
---|---|---|
TIElement | element | The element. |
Returns
Type | Description |
---|---|
System.Boolean |
IsInput(TIElement)
Determines whether the specified element is an input.
Declaration
protected abstract bool IsInput(TIElement element)
Parameters
Type | Name | Description |
---|---|---|
TIElement | element | The element. |
Returns
Type | Description |
---|---|
System.Boolean |
IsOutput(TIElement)
Determines whether the specified element is an output.
Declaration
protected abstract bool IsOutput(TIElement element)
Parameters
Type | Name | Description |
---|---|---|
TIElement | element | The element. |
Returns
Type | Description |
---|---|
System.Boolean |
IsPipe(TIElement)
Determines whether the specified element is a pipe.
Declaration
protected abstract bool IsPipe(TIElement element)
Parameters
Type | Name | Description |
---|---|---|
TIElement | element | The element. |
Returns
Type | Description |
---|---|
System.Boolean |
IsSink(TIElement)
Determines whether the specified element is a sink.
Declaration
protected abstract bool IsSink(TIElement element)
Parameters
Type | Name | Description |
---|---|---|
TIElement | element | The element. |
Returns
Type | Description |
---|---|
System.Boolean |
IsSource(TIElement)
Determines whether the specified element is a source.
Declaration
protected abstract bool IsSource(TIElement element)
Parameters
Type | Name | Description |
---|---|---|
TIElement | element | The element. |
Returns
Type | Description |
---|---|
System.Boolean |
IsStream(TIElement)
Determines whether the specified element is a stream.
Declaration
protected abstract bool IsStream(TIElement element)
Parameters
Type | Name | Description |
---|---|---|
TIElement | element | The element. |
Returns
Type | Description |
---|---|
System.Boolean |
Next(TIInput)
Adds an element to this track.
Declaration
public TTrack Next(TIInput next)
Parameters
Type | Name | Description |
---|---|---|
TIInput | next | The next element. |
Returns
Type | Description |
---|---|
TTrack |
Next(TTrack[])
Branches out to several tracks.
Declaration
public TTrack Next(TTrack[] tracks)
Parameters
Type | Name | Description |
---|---|---|
TTrack[] | tracks | The tracks. |
Returns
Type | Description |
---|---|
TTrack |
Next(TBranch)
Branches out to several tracks.
Declaration
public TTrack Next(TBranch branch)
Parameters
Type | Name | Description |
---|---|---|
TBranch | branch | The tracks. |
Returns
Type | Description |
---|---|
TTrack |
RaiseOnMuted()
Raises the OnMuted event.
Declaration
protected void RaiseOnMuted()
RaiseOnStarted()
Raises the OnStarted event.
Declaration
protected void RaiseOnStarted()
RaiseOnStopped()
Raises the OnStopped event.
Declaration
protected void RaiseOnStopped()
RaiseOnUnmuted()
Raises the OnUnmuted event.
Declaration
protected void RaiseOnUnmuted()
Events
OnDestroyed
Raised when the track is destroyed.
Declaration
public override event Action0 OnDestroyed
Event Type
Type | Description |
---|---|
Action0 |
Overrides
OnMuted
Raised when the track is muted. Only applicable for local media tracks.
Declaration
public override event Action0 OnMuted
Event Type
Type | Description |
---|---|
Action0 |
Overrides
OnStarted
Raised when the track is started. Only applicable for local media tracks.
Declaration
public override event Action0 OnStarted
Event Type
Type | Description |
---|---|
Action0 |
Overrides
OnStopped
Raised when the track is stopped. Only applicable for local media tracks.
Declaration
public override event Action0 OnStopped
Event Type
Type | Description |
---|---|
Action0 |
Overrides
OnUnmuted
Raised when the track is unmuted. Only applicable for local media tracks.
Declaration
public override event Action0 OnUnmuted
Event Type
Type | Description |
---|---|
Action0 |