Class CustomVideoEncoderBlock
- Namespace
- VisioForge.Core.MediaBlocks.Special
- Assembly
- VisioForge.Core.dll
Custom video encoder block for integrating third-party or specialized video encoders into the media pipeline. This block provides a flexible framework for adding GStreamer video encoder elements that are not directly supported by the SDK, enabling integration of proprietary codecs, experimental encoders, or platform-specific encoding solutions. Features automatic color space conversion to I420 format and dynamic property configuration through a key-value interface.
Key features:
- Integration of any GStreamer-compatible video encoder
- Automatic video format conversion to I420
- Dynamic property configuration via dictionary
- Support for hardware and software encoders
- Custom codec parameter tuning
- Plugin-based encoder extensions
Common use cases:
- Proprietary codec integration (custom H.264 variants)
- Hardware-specific encoders (vendor SDKs)
- Experimental codec testing (AV2, VVC)
- Legacy format support (RealVideo, Indeo)
- Specialized compression (lossless, HDR)
- Custom streaming encoders
The block handles the complexity of GStreamer element creation and pipeline integration while providing a simple configuration interface for encoder-specific parameters. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.
public class CustomVideoEncoderBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
CustomVideoEncoderBlock(CustomVideoEncoderSettings)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.CustomVideoEncoderBlock class. Creates a custom video encoder block with the specified GStreamer element name and properties.
public CustomVideoEncoderBlock(CustomVideoEncoderSettings settings)Parameters
settingsCustomVideoEncoderSettings-
The custom encoder settings containing the GStreamer element name and configuration properties.
Properties
Input
Gets the primary input pad for receiving raw video frames.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets all input pads available on this block.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the primary output pad for encoded video stream.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets all output pads available on this block.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the block type identifier for the custom video encoder.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds and initializes the custom video encoder pipeline. Creates the specified GStreamer encoder element, configures it with custom properties, and establishes connections with automatic I420 format conversion.
public override bool Build()Returns
- bool
-
trueif the encoder was successfully built;falseif initialization failed.
CleanUp()
Performs cleanup of all resources associated with the custom encoder. Disposes the encoder element and video converter.
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 GStreamer element. Not applicable for custom encoder blocks.
public BaseElement GetCore()Returns
- BaseElement
-
Always null as custom encoders don't use BaseElement wrappers.
GetElement()
Gets the underlying custom GStreamer encoder element.
public Element GetElement()Returns
- Element
-
The GStreamer element instance representing the custom video encoder.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the media pipeline context for this custom encoder block.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent media pipeline containing this block.