Table of Contents

Class SqueezebackBlockV2

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

Simple squeezeback effect block with one video input and one background image. This Windows-specific block uses VideoMixerBlock to create a picture-in-picture effect with a background image and a video overlay. The video can be positioned, resized, and have its opacity adjusted. Supports z-order swapping between video and image. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class SqueezebackBlockV2 : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

SqueezebackBlockV2(MediaBlocksPipeline, VideoFrameInfoX, string, Rect, Rect, bool)

Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoProcessing.SqueezebackBlockV2 class with specified pipeline, video information, background image with custom position, and video position.

public SqueezebackBlockV2(MediaBlocksPipeline pipeline, VideoFrameInfoX videoInfo, string backgroundImageFile, Rect imageRect, Rect videoRect, bool videoOnTop = true)

Parameters

pipeline MediaBlocksPipeline

The media blocks pipeline that will contain this block.

videoInfo VideoFrameInfoX

The video frame information including dimensions and format.

backgroundImageFile string

Path to the background image file.

imageRect Rect

Rectangle defining the image position and size.

videoRect Rect

Rectangle defining the video overlay position and size.

videoOnTop bool

If true, video is on top of image; if false, image is on top.

Properties

Input

Gets the video input pad.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads (just the video input).

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the outputs.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the type.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

AnimateImage(Rect, TimeSpan, double?, double?)

Animates the image layer's position and opacity.

public void AnimateImage(Rect rect, TimeSpan duration, double? startAlpha = null, double? endAlpha = null)

Parameters

rect Rect

The target rectangle for the image.

duration TimeSpan

The duration of the animation.

startAlpha double?

Optional starting opacity value (0.0-1.0).

endAlpha double?

Optional ending opacity value (0.0-1.0).

AnimateVideo(Rect, TimeSpan, double?, double?)

Animates the video layer's position and opacity.

public void AnimateVideo(Rect rect, TimeSpan duration, double? startAlpha = null, double? endAlpha = null)

Parameters

rect Rect

The target rectangle for the video.

duration TimeSpan

The duration of the animation.

startAlpha double?

Optional starting opacity value (0.0-1.0).

endAlpha double?

Optional ending opacity value (0.0-1.0).

Build()

Constructs and initializes the squeezeback effect components.

public override bool Build()

Returns

bool

Returns true if successful.

CleanUp()

Resets this squeezeback block to a re-buildable state after the pipeline is stopped.

public void CleanUp()

Dispose(bool)

Releases unmanaged and - optionally - managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetCore()

Gets the core BaseElement wrapper. Returns null as this is a composite block.

public BaseElement GetCore()

Returns

BaseElement

Always returns null for this composite block.

GetElement()

Gets the underlying GStreamer element. Returns null as this is a composite block.

public Element GetElement()

Returns

Element

Always returns null for this composite block.

Input_Move(Rect, TimeSpan, double?, double?)

Animates the video position and opacity within the squeezeback layout. This method provides compatibility with the original SqueezebackBlock API.

public void Input_Move(Rect rect, TimeSpan duration, double? startAlpha, double? endAlpha)

Parameters

rect Rect

The target rectangle for the video position and size.

duration TimeSpan

The duration of the animation.

startAlpha double?

Optional starting opacity value (0.0-1.0).

endAlpha double?

Optional ending opacity value (0.0-1.0).

IsAvailable()

Determines whether this media block is available. Correct NuGet SDK redist should be included into your project.

public static bool IsAvailable()

Returns

bool

true if this media block is available; otherwise, false.

IsVideoOnTop()

Gets the current z-order status.

public bool IsVideoOnTop()

Returns

bool

True if video is on top, false if image is on top.

SetImageOnTop()

Sets the image layer on top.

public void SetImageOnTop()

SetVideoOnTop()

Sets the video layer on top.

public void SetVideoOnTop()

StartFadeIn(TimeSpan)

Starts a fade-in animation on the background image overlay. This method provides compatibility with the original SqueezebackBlock API.

public void StartFadeIn(TimeSpan duration)

Parameters

duration TimeSpan

The duration of the fade-in effect.

StartFadeOut(TimeSpan)

Starts a fade-out animation on the background image overlay. This method provides compatibility with the original SqueezebackBlock API.

public void StartFadeOut(TimeSpan duration)

Parameters

duration TimeSpan

The duration of the fade-out effect.

StartVideoFadeIn(TimeSpan)

Starts a fade-in animation for the video layer.

public void StartVideoFadeIn(TimeSpan duration)

Parameters

duration TimeSpan

The duration of the fade-in effect.

StartVideoFadeOut(TimeSpan)

Starts a fade-out animation for the video layer.

public void StartVideoFadeOut(TimeSpan duration)

Parameters

duration TimeSpan

The duration of the fade-out effect.

SwapLayers()

Swaps the z-order of video and image layers.

public void SwapLayers()

Update()

Updates the image overlay settings and refreshes the visual composition. Call this method after modifying image settings to apply changes. This method provides compatibility with the original SqueezebackBlock API.

public void Update()

UpdateImageAlpha(double)

Updates the opacity of the background image overlay. This method provides compatibility with the original SqueezebackBlock API.

public void UpdateImageAlpha(double alpha)

Parameters

alpha double

The new alpha value (0.0-1.0) for the background image.

UpdateImageAsync(string, Rect)

Updates the background image with a new file and video rectangle. This method provides compatibility with the original SqueezebackBlock API.

public Task UpdateImageAsync(string filename, Rect videoRect)

Parameters

filename string

The new background image filename.

videoRect Rect

The new video rectangle position.

Returns

Task

UpdateImageAsync(string, Rect?, Rect?)

Updates the background image with a new file, image position, and video rectangle asynchronously.

public Task UpdateImageAsync(string filename, Rect? imageRect, Rect? videoRect)

Parameters

filename string

The new background image filename.

imageRect Rect?

The new image rectangle position (null to keep current position).

videoRect Rect?

The new video rectangle position (null to keep current position).

Returns

Task

UpdateImageFile(string)

Updates the background image filename while keeping the current position.

public void UpdateImageFile(string filename)

Parameters

filename string

The new background image filename.

UpdateImagePosition(Rect)

Updates the image position and size.

public void UpdateImagePosition(Rect rect)

Parameters

rect Rect

The new rectangle for the image.

UpdateVideoAlpha(double)

Updates the video opacity.

public void UpdateVideoAlpha(double alpha)

Parameters

alpha double

The new alpha value (0.0-1.0).

UpdateVideoPosition(Rect)

Updates the video position and size.

public void UpdateVideoPosition(Rect rect)

Parameters

rect Rect

The new rectangle for the video overlay.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Associates this squeezeback block with a pipeline and initializes its internal context. This method is called internally when the block is added to a pipeline.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The MediaBlocksPipeline instance that will manage this block.

See Also