Class WHEPSourceBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sources
- Assembly
- VisioForge.Core.dll
WHEP (WebRTC-HTTP Egress Protocol) source block: plays a stream a WebRTC server such as MediaMTX publishes over WHEP, with sub-second latency.
public class WHEPSourceBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Remarks
Outputs decoded video and audio. Their formats are the ones the server's streams decode to - read them from the negotiated caps downstream, the block sets none.
A WebRTC session is only described once the server answers, so the outputs are declared up front by VisioForge.Core.Types.X.Sources.WHEPSourceSettings.VideoEnabled and VisioForge.Core.Types.X.Sources.WHEPSourceSettings.AudioEnabled. A stream the server sends with no output for it is dropped; an output whose stream the server does not send carries nothing.
Constructors
WHEPSourceBlock(WHEPSourceSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.WHEPSourceBlock class.
public WHEPSourceBlock(WHEPSourceSettings settings)Parameters
settingsWHEPSourceSettings-
The WHEP source settings.
Exceptions
- ArgumentNullException
-
settingsisnull. - ArgumentException
-
Both VisioForge.Core.Types.X.Sources.WHEPSourceSettings.VideoEnabled and VisioForge.Core.Types.X.Sources.WHEPSourceSettings.AudioEnabled are off, so the block would have no output.
Properties
AudioOutput
Gets the decoded audio output, or null when VisioForge.Core.Types.X.Sources.WHEPSourceSettings.AudioEnabled is off.
public MediaBlockPad AudioOutput { get; }Property Value
Remarks
Left unconnected, this pad is terminated with an internal null sink at build time. To connect it after the
pipeline starts (AddBlockLive + ConnectLive), set OnDemandConnect on it before building.
Input
Gets the input pad. Always null for a source block.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads. Always empty for a source block.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad: the video output, or the audio output when video is off.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the WHEP source settings. The outputs are created from them in the constructor.
public WHEPSourceSettings Settings { get; set; }Property Value
Exceptions
- ArgumentNullException
-
The value is
null.
Type
Gets the media block type identifier.
public override MediaBlockType Type { get; }Property Value
VideoOutput
Gets the decoded video output, or null when VisioForge.Core.Types.X.Sources.WHEPSourceSettings.VideoEnabled is off.
public MediaBlockPad VideoOutput { get; }Property Value
Remarks
Left unconnected, this pad is terminated with an internal null sink at build time. To connect it after the
pipeline starts (AddBlockLive + ConnectLive), set OnDemandConnect on it before building.
Methods
Build()
Builds the block: whepclientsrc and, per enabled output, a raw capsfilter and a queue.
public override bool Build()Returns
- bool
-
trueif successful; otherwise,false.
CleanUp()
Cleans up resources.
public void CleanUp()Dispose(bool)
Releases resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
Whether to release managed resources.
GetCore()
Gets the core element wrapper.
public BaseElement GetCore()Returns
- BaseElement
-
Always null for this composite block.
GetElement()
Gets the native whepclientsrc element.
public Element GetElement()Returns
- Element
-
The underlying Gst.Element.
GetFilenameOrURL()
Gets the WHEP endpoint URL.
public string GetFilenameOrURL()Returns
- string
-
The WHEP endpoint URL.
IsAvailable()
Determines whether the WHEP source is available (the whepclientsrc element of the GStreamer WebRTC plugin).
public static bool IsAvailable()Returns
- bool
-
trueif available; otherwise,false.
SetFilenameOrURL(string)
Sets the WHEP endpoint URL.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The WHEP endpoint URL.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The owning pipeline.