Class SubtitleSourceBlock
- Namespace
- VisioForge.Core.MediaBlocks.Sources
- Assembly
- VisioForge.Core.dll
Subtitle source block for text overlay and caption display from external subtitle files. Provides subtitle text stream generation from SRT, VTT, ASS, and other subtitle formats for video overlay, accessibility compliance, and multilingual content support in media playback and streaming applications. Implements the VisioForge.Core.MediaBlocks.Sources.SourceMediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class SubtitleSourceBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
SubtitleSourceBlock(SubtitleSourceSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.SubtitleSourceBlock class with custom subtitle settings. Configures the subtitle source for text overlay with specified file path and formatting parameters.
public SubtitleSourceBlock(SubtitleSourceSettings settings)Parameters
settingsSubtitleSourceSettings-
The subtitle settings controlling file path, format, encoding, and text processing parameters.
Properties
Input
Gets the primary input pad (none for source blocks that read subtitle files).
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads available on this block (none for source blocks).
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary subtitle output pad for the parsed subtitle stream.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads available on this block (single subtitle output).
public override MediaBlockPad[] Outputs { get; }Property Value
Settings
Gets or sets the subtitle configuration settings that control file parsing and text processing options.
public SubtitleSourceSettings Settings { get; set; }Property Value
Type
Gets the media block type identifier for subtitle source operations.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the subtitle source within the pipeline context. Opens subtitle file, configures text parsing, and establishes subtitle output for downstream overlay processing.
public override bool Build()Returns
- bool
-
trueif the subtitle source was successfully built and configured; otherwise,false.
CleanUp()
Cleans up all resources associated with the subtitle operations, including file handles and text buffers.
public void CleanUp()Dispose(bool)
Releases unmanaged and managed resources used by the subtitle source. Properly closes subtitle file and disposes of GStreamer elements and text processing 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 GStreamer element wrapper for advanced configuration and monitoring.
public BaseElement GetCore()Returns
- BaseElement
-
Always null for composite source blocks with multiple internal elements.
GetElement()
Gets the native GStreamer element for direct GStreamer pipeline integration.
public Element GetElement()Returns
- Element
-
The subtitle source GStreamer element.
IsAvailable(SubtitleSourceSettings)
Determines whether subtitle support is available for the specified subtitle format. Requires GStreamer subtitle parsing plugins for the target subtitle format to be installed and functional.
public static bool IsAvailable(SubtitleSourceSettings settings)Parameters
settingsSubtitleSourceSettings-
The subtitle settings containing the subtitle file to be analyzed for format compatibility.
Returns
- bool
-
trueif subtitle support is available for the specified format; otherwise,false.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the pipeline context for this subtitle source, providing access to the parent pipeline and logging context.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent MediaBlocks pipeline containing this subtitle source.