Interface IVideoViewNativeRendering
- Namespace
- VisioForge.Core.Types
- Assembly
- VisioForge.Core.dll
Defines an interface for video view components that support switching to a native rendering backend. This is typically used to improve performance in demanding scenarios, such as playing high-resolution (4K/8K) video or using hardware-accelerated GPU decoding.
public interface IVideoViewNativeRenderingExamples
// Assuming 'videoView' is a control that implements IVideoViewNativeRendering.
public void EnableHighPerformanceRendering(IVideoView videoView)
{
if (videoView is IVideoViewNativeRendering nativeRenderer)
{
// Enable native rendering for better performance with 4K video.
nativeRenderer.SetNativeRendering(true);
}
}
Remarks
When native rendering is enabled, the video is rendered directly by the underlying system's graphics API (e.g., DirectX, OpenGL) instead of through a higher-level UI framework like WPF. This can significantly reduce CPU usage and improve rendering smoothness, especially for high-bitrate or high-resolution content. However, native rendering may have implications for UI integration, such as difficulty in layering UI elements on top of the video, as the video surface may be rendered in a separate composition layer. Native rendering is particularly beneficial when combined with hardware decoding (DXVA, NVDEC, Quick Sync) as it allows for a direct GPU-to-GPU pipeline without CPU involvement. In WPF applications, enabling native rendering typically creates an HWND-based video surface rather than using WPF's composition engine. This mode should be preferred for performance-critical applications or when frame drops are observed with standard WPF rendering.
Methods
SetNativeRendering(bool)
Enables or disables native rendering for the video view.
void SetNativeRendering(bool native)Parameters
nativebool-
Set to
trueto enable native rendering;falseto use the default framework rendering (e.g., WPF).
Remarks
It is recommended to enable this for performance-critical applications, such as those involving GPU-accelerated decoding or ultra-high-definition video.