Class CustomTransformBlock
- Namespace
- VisioForge.Core.MediaBlocks.Special
- Assembly
- VisioForge.Core.dll
A media block that allows custom transformation with independent input/output caps. Users receive input samples via event and can push output samples when ready.
public class CustomTransformBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternalsInheritance
Implements
Inherited Members
Extension Methods
Constructors
CustomTransformBlock(string, string, bool)
Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.CustomTransformBlock class.
public CustomTransformBlock(string inputCaps = null, string outputCaps = null, bool passthroughOnEmpty = false)Parameters
inputCapsstring-
Optional input caps constraint. If null, any caps will be accepted.
outputCapsstring-
Optional output caps constraint. If null, any caps will be produced.
passthroughOnEmptybool-
If true, input will be passed through when no output is available.
Properties
Input
Gets the input.
public override MediaBlockPad Input { get; }Property Value
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
Methods
Build()
Builds the media block.
public override bool Build()Returns
- bool
-
trueif successful,falseotherwise.
CreateSample(Buffer, Caps)
Creates a new sample with the specified buffer and caps. This is a helper method for creating samples to push.
public static Sample CreateSample(Buffer buffer, Caps caps)Parameters
bufferBuffer-
The buffer for the sample.
capsCaps-
The caps for the sample.
Returns
- Sample
-
A new sample instance.
CreateSample(Buffer, string)
Creates a new sample with the specified buffer using the output caps string. This is a helper method for creating samples to push.
public static Sample CreateSample(Buffer buffer, string capsString)Parameters
bufferBuffer-
The buffer for the sample.
capsStringstring-
The caps string for the sample.
Returns
- Sample
-
A new sample instance.
Dispose(bool)
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
protected override void Dispose(bool disposing)Parameters
disposingbool-
True if disposing, false if finalizing.
PushBuffer(Buffer)
Pushes a new buffer to the output with the current output caps.
public void PushBuffer(Buffer buffer)Parameters
bufferBuffer-
The buffer to push to output.
PushSample(Sample)
Pushes a new sample to the output.
public void PushSample(Sample sample)Parameters
sampleSample-
The sample to push to output.
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 custom transform.
BaseElement IMediaBlockInternals.GetCore()Returns
- BaseElement
-
The base element wrapping the custom transform.
IMediaBlockInternals.GetElement()
Retrieves the primary GStreamer element for this custom transform.
Element IMediaBlockInternals.GetElement()Returns
- Element
-
The GStreamer element performing custom transformation.
IMediaBlockInternals.SetContext(MediaBlocksPipeline)
Sets the media pipeline context for this custom transform block.
void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)Parameters
pipelineMediaBlocksPipeline-
The parent media blocks pipeline that manages this transform.
OnSampleReceived
This event occurs when a new sample is received on the input.
public event EventHandler<SampleReceivedEventArgs> OnSampleReceivedEvent Type
- EventHandler<SampleReceivedEventArgs>