Class BridgeSubtitleSourceBlock
- Namespace
- VisioForge.Core.MediaBlocks.Bridge
- Assembly
- VisioForge.Core.dll
Subtitle source block that bridges subtitle data from other pipelines or applications using a channel-based communication system. This block acts as a source that receives subtitle data from a named channel created by a BridgeSubtitleSinkBlock. It enables inter-pipeline communication for subtitle streams, allowing complex architectures where subtitle processing is distributed across multiple pipelines. The bridge supports various subtitle formats (text, SSA/ASS, WebVTT, etc.) and maintains timing synchronization. Common use cases include receiving subtitles from another pipeline, implementing modular subtitle processing chains, combining subtitles from multiple sources, and creating subtitle distribution systems. The source includes an internal queue for buffering to ensure smooth playback. Pair this source with a BridgeSubtitleSinkBlock using the same channel name to establish a complete subtitle bridge connection. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class BridgeSubtitleSourceBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals, IMediaBlocksBridgeInheritance
Implements
Inherited Members
Extension Methods
Constructors
BridgeSubtitleSourceBlock(BridgeSubtitleSourceSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Bridge.BridgeSubtitleSourceBlock class with specified settings. Creates a bridge subtitle source that will receive subtitle data from the specified channel name.
public BridgeSubtitleSourceBlock(BridgeSubtitleSourceSettings settings)Parameters
settingsBridgeSubtitleSourceSettings-
The bridge settings including channel name and subtitle format configuration.
Properties
Input
Gets the input pad. Bridge sources do not have inputs as they generate data from a channel.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads. Bridge sources have no inputs as they generate data from a channel.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the single subtitle output pad for this source block.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads. This source has a single subtitle output.
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the bridge subtitle source settings, including the channel name and subtitle format configuration. The channel name must match the corresponding BridgeSubtitleSinkBlock for successful connection.
public BridgeSubtitleSourceSettings Settings { get; set; }Property Value
Type
Gets the block type identifier for this bridge subtitle source.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the bridge subtitle source within the pipeline. Creates the bridge element with the specified channel settings, opens the channel connection, establishes a queue for buffering, and sets up pad connections. The source will wait for data from the corresponding sink.
public override bool Build()Returns
- bool
-
trueif the bridge source was successfully built;falseif an error occurred.
CleanUp()
Releases all internal resources and disposes of the bridge subtitle source element and queue. This disconnects from the bridge channel and frees associated resources.
public void CleanUp()Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
GetCore()
Gets the core BaseElement wrapper for the bridge subtitle source. Note: This implementation returns null as the subtitle source uses a different architecture.
public BaseElement GetCore()Returns
- BaseElement
-
Always returns null for subtitle sources.
GetElement()
Gets the underlying GStreamer element for this bridge source.
public Element GetElement()Returns
- Element
-
The GStreamer element that handles subtitle bridging.
IsAvailable()
Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.
public static bool IsAvailable()Returns
- bool
-
trueif this media block is available; otherwise,false.
UpdateChannel(string)
Updates the channel name for this bridge source dynamically. This allows changing the bridge source without rebuilding the pipeline. The new channel must have a corresponding sink providing data.
public bool UpdateChannel(string channel)Parameters
channelstring-
The new channel name to receive subtitles from.
Returns
- bool
-
trueif the channel was successfully updated;falseotherwise.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context for this bridge source, providing access to shared resources. This method is called internally during pipeline construction.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline that owns this bridge source.