Table of Contents

Class VideoEffectsWinBlock

Namespace
VisioForge.Core.MediaBlocks.VideoProcessing
Assembly
VisioForge.Core.dll

Video effects processing block for Windows that applies real-time visual effects to video streams. This block leverages Windows Media Foundation (MFP) for high-performance video effect processing, supporting a wide range of effects including image overlays, text rendering, scrolling text, color adjustments, transformations, and custom GPU effects. Effects are applied sequentially in the order they are added, allowing for complex effect chains.

Key features:

  • Hardware-accelerated effect processing using Windows Media Foundation
  • Support for multiple simultaneous effects with minimal performance impact
  • Dynamic effect management (add, remove, update during playback)
  • Frame-accurate effect timing and positioning
  • Thread-safe effect list management for real-time modifications
  • Automatic resource management and disposal

Supported effect types:

  • Image overlays (logos, watermarks, picture-in-picture)
  • Text overlays with rich formatting options
  • Scrolling text effects (tickers, credits)
  • Color correction and grading
  • Geometric transformations (rotate, scale, crop)
  • Custom shader-based effects

Common use cases:

  • Adding branding/watermarks to video streams
  • Real-time text overlay for live streaming (timestamps, titles)
  • Video production with dynamic graphics
  • Security video with timestamp and camera ID overlays
  • Educational content with annotations
  • Broadcasting with lower-thirds and graphics

Performance considerations:

  • Effects are processed on RGB frames for quality
  • GPU acceleration when available through MFP
  • Efficient memory management with frame reuse
  • Optimized for real-time processing at 60+ FPS

Requirements:

  • Windows 7 or later
  • Windows Media Foundation runtime
  • DirectX 9 or later for GPU acceleration

Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class VideoEffectsWinBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

VideoEffectsWinBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.VideoEffectsWinBlock class. Creates a video effects processor ready to apply visual effects using Windows Media Foundation. The processor is initialized with an empty effect list, ready for effects to be added.

public VideoEffectsWinBlock()

Properties

Input

Gets the primary input pad for video streams requiring effect processing. This pad accepts video data that will be processed through the effect chain.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the array of all input pads (single input for effect processing). The effects processor operates on one video stream at a time.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the primary output pad that provides effect-processed video. Outputs video frames with all configured effects applied in sequence.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the array of all output pads (single output for processed video). The processor produces one video stream with effects applied.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the block type identifier for the Windows video effects processor. Used by the pipeline system for block identification and capability queries.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the video effects processor block. Creates the Media Foundation processor, initializes the frame grabber, sets up RGB format conversion, and prepares the effect processing pipeline. The build process ensures optimal configuration for real-time effect application.

public override bool Build()

Returns

bool

true if the effects processor was successfully initialized with all resources allocated; false if initialization failed due to missing Media Foundation support or resource constraints.

CleanUp()

Performs cleanup of video effects processor resources and resets to uninitialized state. Releases the Media Foundation processor, disposes all effects, unsubscribes event handlers, and frees all allocated resources. Essential for preventing memory leaks when reconfiguring the pipeline or switching between different video sources.

public void CleanUp()

Dispose(bool)

Releases unmanaged and - optionally - managed resources used by the video effects processor. Ensures proper cleanup of Media Foundation resources, effect objects, image buffers, and GPU resources. All active effects are disposed to prevent resource leaks.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources including effect objects; false to release only unmanaged Media Foundation resources.

GetCore()

Gets the core video sample grabber element used for frame interception. Provides access to the underlying element for advanced configuration of frame capture and processing parameters.

public BaseElement GetCore()

Returns

BaseElement

The base element wrapping the video sample grabber.

GetElement()

Gets the raw GStreamer element for video frame capture. Provides direct access to the sample grabber for advanced configuration of buffer handling and format negotiation.

public Element GetElement()

Returns

Element

The GStreamer element performing frame capture.

IsAvailable()

Determines whether Windows video effects processing is available on the current system. Checks for Windows Media Foundation support, required runtime components, and system compatibility for video effect processing.

public static bool IsAvailable()

Returns

bool

true if the system supports Windows video effects with Media Foundation; false if running on non-Windows platform or missing required components.

Video_Effects_Add(IVideoEffect)

Adds a new video effect to the processing chain. The effect will be applied to all subsequent frames after the existing effects. Effects are processed in the order they are added, creating a sequential pipeline. Thread-safe operation allows adding effects during active playback.

public void Video_Effects_Add(IVideoEffect effect)

Parameters

effect IVideoEffect

The video effect to add. Must implement IVideoEffect interface. Common effects include ImageLogo, TextLogo, ScrollingTextLogo, and custom effects.

Video_Effects_AddOrUpdate(IVideoEffect)

Adds a new video effect or updates an existing effect with the same name. If an effect with the same name exists, it is replaced with the new effect. This allows dynamic modification of effect parameters without disrupting the effect chain order. Automatically disposes the old effect if replaced.

public void Video_Effects_AddOrUpdate(IVideoEffect effect)

Parameters

effect IVideoEffect

The video effect to add or update. The effect's Name property is used to identify existing effects for replacement. Case-insensitive comparison.

Video_Effects_Clear()

Removes all video effects from the processing chain. Properly disposes each effect to release resources including loaded images, fonts, and GPU resources. After clearing, video passes through unmodified. Thread-safe operation can be called during active playback.

public void Video_Effects_Clear()

Video_Effects_Get(string)

Retrieves a video effect by its name from the active effect chain. Useful for modifying effect parameters during playback or checking effect status. The search is case-insensitive for convenience.

public IVideoEffect Video_Effects_Get(string name)

Parameters

name string

The name of the effect to retrieve, as specified in the effect's Name property.

Returns

IVideoEffect

The IVideoEffect instance if found; null if no effect with the specified name exists. The returned reference can be cast to specific effect types for parameter access.

Video_Effects_Remove(string)

Removes a specific video effect from the processing chain by name. The effect is properly disposed to release all associated resources. Remaining effects continue processing in their original order. Thread-safe operation allows removal during active playback.

public void Video_Effects_Remove(string name)

Parameters

name string

The name of the effect to remove, as specified in the effect's Name property. The search is case-sensitive to ensure precise effect targeting.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the media pipeline context for this video effects block. Establishes connection to the parent pipeline for resource sharing, synchronization, and access to pipeline-wide configuration.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The parent media blocks pipeline managing this effects processor.

See Also