Table of Contents

Class CallbackVideoView

Namespace
VisioForge.Core.UI
Assembly
VisioForge.Core.dll

A headless video view implementation that provides frame callbacks without visual rendering.

This class serves as a callback-based video sink that receives video frames and forwards them to event handlers for custom processing, analysis, or forwarding to other systems, without performing any UI rendering operations. It's ideal for scenarios requiring frame access without a visual display component, such as video analytics, streaming to external systems, or custom image processing pipelines.

Key features:

  • Receives video frames in configurable pixel formats (RGB, RGBA, NV12, etc.)
  • Implements VisioForge.Core.Types.IVideoView for standard video view integration
  • Implements VisioForge.Core.Types.IVideoViewPushFrame for receiving frame data
  • Provides OnFrame event for frame processing subscribers
  • Supports both VideoFrame and VideoFrameX frame formats
  • No-op implementations of UI-specific methods (rendering, mouse events, etc.)
  • Platform-independent operation without UI dependencies
  • Minimal overhead for maximum processing performance

Common use cases:

  • Video analytics and computer vision processing without display
  • Frame extraction and image capture operations
  • Video streaming to custom network protocols
  • Integration with third-party processing libraries
  • Headless video recording and transcoding scenarios
  • Multi-stream processing without rendering overhead

Threading considerations:

  • Frame callbacks occur on the media pipeline thread
  • Subscribers should handle frames quickly or queue for background processing
  • No UI thread synchronization overhead

Performance characteristics:

  • Minimal memory allocation per frame
  • No rendering overhead for maximum throughput
  • Configurable pixel format to match processing requirements
  • Zero-copy frame delivery when possible
public class CallbackVideoView : IVideoView, IVideoViewPushFrame

Inheritance

Implements

Inherited Members

Properties

Format

Gets or sets the pixel format for video frames received by this callback view.

This property determines the pixel format that will be used when video frames are delivered to the VisioForge.Core.UI.CallbackVideoView.OnFrame event. The format affects frame data layout, stride calculation, and memory usage. Choose the format that best matches your processing requirements.

Supported formats include:

  • RGB: 24-bit RGB (8 bits per channel, no alpha)
  • RGBA: 32-bit RGBA (8 bits per channel with alpha)
  • BGRA: 32-bit BGRA (8 bits per channel with alpha)
  • NV12: YUV 4:2:0 planar format (efficient for video encoding)
  • I420: YUV 4:2:0 planar format
  • And other formats supported by VideoFormatX enumeration

Performance considerations:

  • RGB/RGBA formats are CPU-intensive but easy to process
  • YUV formats (NV12, I420) are more efficient for encoding pipelines
  • Choose the format matching your target processing to avoid conversions
  • Format conversion happens in the media pipeline before callback delivery

Thread safety: Can be set before starting the media pipeline. Changing during playback may not take effect until restart.

public VideoFormatX Format { get; set; }

Property Value

VideoFormatX

Methods

CallInvoke(Delegate, params object[])

Invokes a delegate method. Not implemented.

public void CallInvoke(Delegate method, params object[] args)

Parameters

method Delegate

The method to invoke.

args object[]

The arguments.

CallRefresh()

Refreshes the view. Not implemented.

public void CallRefresh()

ClearUI()

Clears the UI. Not implemented.

public void ClearUI()

GetBackgroundColor()

Gets the background color.

public SKColor GetBackgroundColor()

Returns

SKColor

Always returns black.

GetHandle()

Gets the window handle.

public nint GetHandle()

Returns

nint

Always returns IntPtr.Zero.

GetInvokeRequired()

Gets whether invoke is required.

public bool GetInvokeRequired()

Returns

bool

Always returns false.

GetIsHandleCreated()

Gets whether the handle is created.

public bool GetIsHandleCreated()

Returns

bool

Always returns false.

GetSize()

Gets the size of the view.

public Size GetSize()

Returns

Size

Always returns Size(0, 0).

GetUIEngine()

Gets the UI engine type.

public VideoViewUIEngine GetUIEngine()

Returns

VideoViewUIEngine

Returns BufferCallback.

InvokeStart()

Invokes start operation. Not implemented.

public void InvokeStart()

InvokeStartComplete()

Invokes start complete operation. Not implemented.

public void InvokeStartComplete()

InvokeStop()

Invokes stop operation. Not implemented.

public void InvokeStop()

InvokeVideoRendererUpdate()

Invokes video renderer update. Not implemented.

public void InvokeVideoRendererUpdate()

LogDialogClear()

Clears the log dialog. Not implemented.

public void LogDialogClear()

LogDialogClose()

Closes the log dialog. Not implemented.

public void LogDialogClose()

LogDialogError(string)

Logs an error message in dialog. Not implemented.

public void LogDialogError(string msg)

Parameters

msg string

The error message.

PushFrame(VideoFrame)

Pushes a video frame to the view for processing and event notification.

This method receives video frames from the media pipeline and converts them to VideoFrameX format before raising the VisioForge.Core.UI.CallbackVideoView.OnFrame event. It's called internally by the media framework to deliver frames to callback subscribers.

Frame conversion process:

  • Converts legacy VideoFrame format to modern VideoFrameX format
  • Preserves frame data, dimensions, and timing information
  • Applies format conversions based on the VisioForge.Core.UI.CallbackVideoView.Format property
  • Raises OnFrame event with converted frame data

The conversion parameter (false) indicates whether to copy frame data. In this context, no copying occurs to maximize performance.

Threading: Called on the media pipeline thread. Synchronous operation - blocks until OnFrame handlers complete.

Performance: Minimal overhead conversion with direct frame forwarding.

public void PushFrame(VideoFrame frame)

Parameters

frame VideoFrame

The video frame to process in legacy VideoFrame format.

PushFrame(VideoFrameX)

Pushes a video frame to the view for processing and event notification.

This method receives video frames in VideoFrameX format and directly raises the VisioForge.Core.UI.CallbackVideoView.OnFrame event for subscribers. This is the preferred method for modern media pipelines using VideoFrameX format.

Frame delivery:

  • Direct event notification without format conversion
  • Zero-copy operation for maximum performance
  • Frame data pointer remains valid only during event handler execution
  • Subscribers must copy data if processing will occur asynchronously

Threading: Called on the media pipeline thread. Synchronous operation - blocks until OnFrame handlers complete.

Performance: Most efficient frame delivery path with no conversions.

public void PushFrame(VideoFrameX frame)

Parameters

frame VideoFrameX

The video frame to process in VideoFrameX format.

PushMouseButtonDown(int, int, MouseButton)

Pushes a mouse button down event. Not implemented.

public void PushMouseButtonDown(int x, int y, MouseButton button)

Parameters

x int

The x coordinate.

y int

The y coordinate.

button MouseButton

The mouse button.

PushMouseButtonUp(int, int, MouseButton)

Pushes a mouse button up event. Not implemented.

public void PushMouseButtonUp(int x, int y, MouseButton button)

Parameters

x int

The x coordinate.

y int

The y coordinate.

button MouseButton

The mouse button.

PushMouseMove(int, int)

Pushes a mouse move event. Not implemented.

public void PushMouseMove(int x, int y)

Parameters

x int

The x coordinate.

y int

The y coordinate.

ResizeRoundTo(int)

Resizes the view rounded to specified value. Not implemented.

public void ResizeRoundTo(int round)

Parameters

round int

The rounding value.

SetHandle(nint)

Sets the window handle. Not implemented.

public void SetHandle(nint handle)

Parameters

handle nint

The window handle.

ShowMessage(string)

Shows a message box. Not implemented.

public MessageBoxResult ShowMessage(string message)

Parameters

message string

The message to display.

Returns

MessageBoxResult

Always returns None.

OnFrame

Occurs when a new video frame is available for processing.

This event is the primary mechanism for receiving video frames in CallbackVideoView. Subscribers receive VideoFrameX objects containing frame data, dimensions, format, and timing information. The event is raised on the media pipeline thread.

Event handling guidelines:

  • Process frames quickly or queue for background processing to avoid blocking the pipeline
  • Frame data pointers are valid only during the event handler execution
  • Copy frame data if processing will occur asynchronously
  • Do not perform heavy processing directly in the event handler
  • Consider using a producer-consumer pattern for complex frame processing

The VideoFrameX parameter provides:

  • Frame data pointer and size
  • Frame dimensions (width, height, stride)
  • Pixel format information
  • Timestamp and frame number
  • Additional metadata depending on source

Thread safety: Event is raised on media pipeline thread, not UI thread. Subscribers must handle thread synchronization if updating UI components.

Performance: Minimize processing time in handlers to maintain real-time performance. For 30fps video, each frame handler should complete within ~33ms.

public event EventHandler<VideoFrameX> OnFrame

Event Type

EventHandler<VideoFrameX>

OnMouseButtonDown

Occurs when a mouse button is pressed down on the video view.

Note: This event is never raised in CallbackVideoView as it has no visual representation. It exists for interface compliance with VisioForge.Core.Types.IVideoView. Mouse events are only functional in platform-specific video views with UI rendering.

public event EventHandler<MouseButtonEventArgs> OnMouseButtonDown

Event Type

EventHandler<MouseButtonEventArgs>

OnMouseButtonUp

Occurs when a mouse button is released on the video view.

Note: This event is never raised in CallbackVideoView as it has no visual representation. It exists for interface compliance with VisioForge.Core.Types.IVideoView. Mouse events are only functional in platform-specific video views with UI rendering.

public event EventHandler<MouseButtonEventArgs> OnMouseButtonUp

Event Type

EventHandler<MouseButtonEventArgs>

OnMouseMoved

Occurs when the mouse cursor is moved over the video view.

Note: This event is never raised in CallbackVideoView as it has no visual representation. It exists for interface compliance with VisioForge.Core.Types.IVideoView. Mouse events are only functional in platform-specific video views with UI rendering.

public event EventHandler<MouseMoveEventArgs> OnMouseMoved

Event Type

EventHandler<MouseMoveEventArgs>