Class UniversalTransformBlock
- Namespace
- VisioForge.Core.MediaBlocks.Special
- Assembly
- VisioForge.Core.dll
Universal transform block that allows arbitrary video transformations with configurable caps. Supports 1:N frame transformations through a virtual method that must be overridden.
public abstract class UniversalTransformBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
UniversalTransformBlock(string, string)
Initializes a new instance of the UniversalTransformBlock.
protected UniversalTransformBlock(string inputCaps, string outputCaps)Parameters
inputCapsstring-
GStreamer caps string for input (e.g., "video/x-raw,format=RGB,width=1920,height=1080,framerate=30/1")
outputCapsstring-
GStreamer caps string for output (e.g., "video/x-raw,format=NV12,width=1280,height=720,framerate=60/1")
Properties
Input
Gets the input pad.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the collection of input pads.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output pad.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the collection of output pads.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the media block type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds the media block element.
public override bool Build()Returns
CreateBuffer(byte[], ulong, ulong, ulong)
Helper method to create a buffer with specific data.
protected static Buffer CreateBuffer(byte[] data, ulong pts = 0, ulong dts = 0, ulong duration = 0)Parameters
Returns
- Buffer
Dispose(bool)
Destroys the media block element.
protected override void Dispose(bool disposing)Parameters
disposingbool
GetVideoInfo(Caps, out string, out int, out int, out int, out int)
Helper method to get video format info from caps.
protected static bool GetVideoInfo(Caps caps, out string format, out int width, out int height, out int frameRateNum, out int frameRateDen)Parameters
Returns
OnTransformFrame(Buffer, Caps, Caps)
Abstract method that must be overridden to provide frame transformation logic.
protected abstract List<Buffer> OnTransformFrame(Buffer inputBuffer, Caps inputCaps, Caps outputCaps)Parameters
inputBufferBuffer-
The input buffer to transform
inputCapsCaps-
The negotiated input caps
outputCapsCaps-
The negotiated output caps
Returns
- List<Buffer>
-
A list of output buffers (can be empty, one, or multiple buffers)
IMediaBlockInternals.Build()
Builds the media block by creating and initializing the underlying GStreamer elements.
bool IMediaBlockInternals.Build()Returns
- bool
-
True if the block was successfully built; false if construction failed.
IMediaBlockInternals.CleanUp()
Performs cleanup of resources and resets the transform to uninitialized state.
void IMediaBlockInternals.CleanUp()IMediaBlockInternals.GetCore()
Retrieves the core BaseElement wrapper for this universal transform.
BaseElement IMediaBlockInternals.GetCore()Returns
- BaseElement
-
The base element wrapping the transform, or null if not applicable.
IMediaBlockInternals.GetElement()
Retrieves the primary GStreamer element for this universal transform.
Element IMediaBlockInternals.GetElement()Returns
- Element
-
The GStreamer element performing the transformation.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the media pipeline context for this universal transform block.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent media blocks pipeline that manages this transform.