Class MultiscreenVideoView
- Namespace
- VisioForge.Core.UI.WPF
- Assembly
- VisioForge.Core.dll
A WPF UserControl providing high-performance video rendering for multiscreen and multi-stream display scenarios.
This control is optimized for displaying multiple video streams simultaneously in WPF applications, such as surveillance systems, video walls, and multi-camera monitoring interfaces. It renders raw video frames directly to a WPF Image control using WriteableBitmap for efficient software-based video playback.
Key features:
- Software-based RGB24 video frame rendering
- Thread-safe frame processing with background operations
- Automatic UI thread marshaling for safe WPF updates
- Dynamic frame size adaptation without flickering
- Native memory operations for optimal performance
- Minimal overhead for multi-stream scenarios
- Automatic aspect ratio handling
Architecture:
- Uses WriteableBitmap for efficient pixel buffer updates
- Employs native memcpy for high-speed frame data copying
- Implements double-buffering pattern with _rendering flag
- Dispatcher.BeginInvoke for thread-safe UI updates
- Grid-based layout with Image control for display
Performance characteristics:
- Native memory copy operations (memcpy) for maximum speed
- Minimal GC pressure through reusable WriteableBitmap
- Thread-safe frame queueing prevents UI blocking
- Efficient handling of frame dimension changes
- Optimized for multiple concurrent video streams
Common use cases:
- Video surveillance dashboards with multiple camera feeds
- Video conferencing applications with participant grids
- Multi-camera video editing interfaces
- Video wall displays
- Split-screen video playback
- Picture-in-picture implementations
Threading considerations:
- Frame data can be pushed from any thread
- Rendering operations are marshaled to UI thread automatically
- _rendering flag prevents concurrent frame updates
- Safe for high-frequency frame delivery
Memory management:
- WriteableBitmap is reused when possible
- Frame data is copied using unsafe native operations
- Minimal managed allocations per frame
- Automatic cleanup on control disposal
Technical notes:
- Supports only RGB24/BGR24 pixel format
- Handles line stride calculation for proper alignment
- Uses 72 DPI for bitmap creation
- Black background by default
public class MultiscreenVideoView : UserControl, IAnimatable, ISupportInitialize, IFrameworkInputElement, IInputElement, IQueryAmbient, IAddChildInheritance
Implements
Inherited Members
Remarks
This control is designed to handle RGB24 video frames and provides thread-safe frame rendering through the use of background frame processing and UI thread marshalling. It supports dynamic frame size changes and provides methods for clearing the display.
The control uses unsafe memory operations for optimal performance when copying video frame data, making it suitable for high-resolution video playback scenarios.
Constructors
MultiscreenVideoView()
Initializes a new instance of the VisioForge.Core.UI.WPF.MultiscreenVideoView class.
public MultiscreenVideoView()Properties
Context
Gets or sets the base context used for structured logging.
public BaseContext Context { get; set; }Property Value
Methods
Clear()
Clears the video display by removing the current frame and resetting the image source.
public void Clear()Remarks
This method immediately clears the displayed video content and resets the Image control to show a blank (black) background. It's typically called when stopping video playback or when transitioning between video sources.
RenderFrame(VideoFrameBufferEventArgs)
Renders a video frame from a VideoFrameBufferEventArgs event.
public void RenderFrame(VideoFrameBufferEventArgs e)Parameters
eVideoFrameBufferEventArgs-
The VideoFrameBufferEventArgs containing the video frame data and metadata from a video processing event.
Remarks
This method extracts the frame data from the event arguments and delegates to the main RenderFrame method for actual rendering.
RenderFrame(VideoFrame)
Renders a video frame in RGB24 format to the display.
public void RenderFrame(VideoFrame frame)Parameters
frameVideoFrame-
The VideoFrame containing the raw video data, dimensions, and format information to be displayed.
Remarks
This method performs thread-safe frame rendering by:
- Checking if a rendering operation is already in progress
- Copying frame data to an internal buffer if needed
- Marshalling the actual rendering to the UI thread
The method handles dynamic frame size changes by reallocating the internal frame buffer when dimensions change.