Table of Contents

Class GPUVideoEffect

Namespace
VisioForge.Core.Types.VideoEffects
Assembly
VisioForge.Core.dll

Base abstract class for GPU-accelerated video effects.

public abstract class GPUVideoEffect : IGPUVideoEffect

Inheritance

Derived

Implements

Inherited Members

Examples

// Create a brightness effect
var brightnessEffect = new GPUVideoEffectBrightness(
    enabled: true,
    value: 150,
    name: "MyBrightness",
    startTime: TimeSpan.FromSeconds(5),
    stopTime: TimeSpan.FromSeconds(10)
);

// Apply to video processor
videoProcessor.AddEffect(brightnessEffect);

// Update effect value during playback
brightnessEffect.Value = 200;
brightnessEffect.Update();

Remarks

This class serves as the foundation for all GPU-based video effects in the VisioForge framework. GPU effects leverage hardware acceleration to provide high-performance video processing with minimal CPU usage.

Derived classes must implement the VisioForge.Core.Types.VideoEffects.IGPUVideoEffect interface and override the VisioForge.Core.Types.VideoEffects.GPUVideoEffect.GetEffectType method to specify the concrete effect type.

Effects can be configured to apply during specific time ranges using VisioForge.Core.Types.VideoEffects.GPUVideoEffect.StartTime and VisioForge.Core.Types.VideoEffects.GPUVideoEffect.StopTime properties. Setting both to zero (default) applies the effect for the entire duration.

Constructors

GPUVideoEffect()

Initializes a new instance of the VisioForge.Core.Types.VideoEffects.GPUVideoEffect class.

protected GPUVideoEffect()

Remarks

This constructor sets default values:

  • VisioForge.Core.Types.VideoEffects.GPUVideoEffect.Stream is set to VisioForge.Core.Types.VideoStreamType.Main
  • VisioForge.Core.Types.VideoEffects.GPUVideoEffect.UpdateRequired is set to true to ensure initial application
  • VisioForge.Core.Types.VideoEffects.GPUVideoEffect.StartTime and VisioForge.Core.Types.VideoEffects.GPUVideoEffect.StopTime default to Zero
  • VisioForge.Core.Types.VideoEffects.GPUVideoEffect.Enabled defaults to false

Properties

Enabled

Gets or sets a value indicating whether the video effect is currently enabled.

public bool Enabled { get; set; }

Property Value

bool

Remarks

When disabled, the effect is bypassed in the processing pipeline without being removed. This allows for toggling effects on/off without the overhead of adding/removing them.

Name

Gets or sets the unique name identifier for this effect instance.

public string Name { get; set; }

Property Value

string

Remarks

The name can be used to retrieve a specific effect instance from a collection of effects for runtime manipulation. It's recommended to use descriptive names when multiple effects of the same type are applied.

StartTime

Gets or sets the time when the effect should start being applied.

public TimeSpan StartTime { get; set; }

Property Value

TimeSpan

Remarks

Set to Zero (default) to apply the effect from the beginning. The effect will not be rendered before this time position is reached in the video stream.

StopTime

Gets or sets the time when the effect should stop being applied.

public TimeSpan StopTime { get; set; }

Property Value

TimeSpan

Remarks

Set to Zero (default) to apply the effect until the end. The effect will not be rendered after this time position is passed in the video stream. If both VisioForge.Core.Types.VideoEffects.GPUVideoEffect.StartTime and VisioForge.Core.Types.VideoEffects.GPUVideoEffect.StopTime are zero, the effect is applied for the entire duration.

Stream

Gets or sets the video stream type to which this effect should be applied.

public VideoStreamType Stream { get; set; }

Property Value

VideoStreamType

Remarks

In multi-stream scenarios (e.g., picture-in-picture), this property determines which video stream receives the effect. The default value is VisioForge.Core.Types.VideoStreamType.Main.

UpdateRequired

Gets or sets a value indicating whether the effect settings have changed and need to be applied.

public bool UpdateRequired { get; set; }

Property Value

bool

Remarks

This flag is automatically set to true when VisioForge.Core.Types.VideoEffects.GPUVideoEffect.Update is called. The video processing pipeline checks this flag to determine if GPU shader parameters need updating. After the effect is applied, the pipeline resets this flag to false.

Methods

GetEffectType()

Gets the specific type of GPU video effect.

public GPUVideoEffectType GetEffectType()

Returns

GPUVideoEffectType

A VisioForge.Core.Types.VideoEffects.GPUVideoEffectType enumeration value indicating the concrete effect type.

Remarks

This method must be overridden in derived classes to return the appropriate effect type. The effect type is used by the video processing pipeline to select the correct GPU shader.

Exceptions

Exception

Thrown when called on the base class. Derived classes must override this method.

Update()

Marks the effect as requiring an update in the video processing pipeline.

public void Update()

Examples

// Modify effect parameters
brightnessEffect.Value = 180;

// Signal that update is needed
brightnessEffect.Update();

Remarks

Call this method after modifying any effect parameters to ensure the changes are applied. This sets the VisioForge.Core.Types.VideoEffects.GPUVideoEffect.UpdateRequired flag to true, signaling the pipeline to update the GPU shader parameters on the next frame.