Table of Contents

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, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

UniversalTransformBlock(string, string)

Initializes a new instance of the UniversalTransformBlock.

protected UniversalTransformBlock(string inputCaps, string outputCaps)

Parameters

inputCaps string

GStreamer caps string for input (e.g., "video/x-raw,format=RGB,width=1920,height=1080,framerate=30/1")

outputCaps string

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

MediaBlockPad

Inputs

Gets the collection of input pads.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output pad.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the collection of output pads.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the media block type.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds the media block element.

public override bool Build()

Returns

bool

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

data byte[]
pts ulong
dts ulong
duration ulong

Returns

Buffer

Dispose(bool)

Destroys the media block element.

protected override void Dispose(bool disposing)

Parameters

disposing bool

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

caps Caps
format string
width int
height int
frameRateNum int
frameRateDen int

Returns

bool

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

inputBuffer Buffer

The input buffer to transform

inputCaps Caps

The negotiated input caps

outputCaps Caps

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

pipeline MediaBlocksPipeline

The parent media blocks pipeline that manages this transform.