Interface IVideoSurfaceProvider
- Namespace
- VisioForge.Core.UI.WPF
- Assembly
- VisioForge.Core.dll
Exposed by WPF VideoView when it runs in the
VisioForge.Core.Types.VideoRendererMode.D3D11Composable
mode. The provider owns a single BGRA8 D3D11 shared texture; its handle
(VisioForge.Core.UI.WPF.IVideoSurfaceProvider.SharedTextureHandle) is stable for the lifetime of the
current internal texture and may be reset to Zero
on resize, device-removed / TDR, unsupported pixel format upstream, or
disposal. See VisioForge.Core.UI.WPF.IVideoSurfaceProvider.SharedTextureHandle for the full list.
public interface IVideoSurfaceProviderRemarks
Typical use: subscribe to VisioForge.Core.UI.WPF.IVideoSurfaceProvider.FrameReady, open the shared
handle on your own ID3D11Device, run a compute or pixel shader
that reads from and writes to the texture, then return. The mutated
frame is what WPF presents this compose cycle.
Properties
SharedTextureHandle
DXGI shared handle of the current frame's GPU texture, BGRA8. Stable for the lifetime of the current internal texture and reset to Zero when:
- no frame has been pushed yet,
- the source resolution changed (a new texture is allocated and the published handle is replaced),
- frame upload failed (e.g. device removed / TDR, driver crash, unsupported pixel format) — the pipeline tears down the texture and the next successful upload publishes a new handle,
- the view was disposed.
nint SharedTextureHandle { get; }Property Value
SurfaceHeight
Height of the current shared texture, in pixels.
int SurfaceHeight { get; }Property Value
SurfaceWidth
Width of the current shared texture, in pixels.
int SurfaceWidth { get; }Property Value
FrameReady
Raised after each frame has been uploaded to the shared texture and before WPF presents it. Subscribers may mutate the texture in place (within an Acquire/Release pair on their own ID3D11Device); the modified pixels are what the user will see this compose cycle.
event EventHandler<VideoSurfaceFrameEventArgs> FrameReadyEvent Type
Remarks
Thread affinity: the event is invoked synchronously on the same
thread that called the underlying PushFrame — typically a
DirectShow callback thread, a GStreamer streaming thread, or any
thread the consumer chooses when driving the
VisioForge.Core.UI.WPF.VideoView manually.
Subscribers must NOT assume the WPF dispatcher thread and must NOT
assume the same thread across frames; do not capture
SynchronizationContext.Current or thread-affine D3D
resources inside the handler.
RenderError
Raised when the underlying D3D11 render pipeline encounters a non-fatal error: shared-texture upload failure, device-removed / TDR, D3DImage bridge construction failure, dispatcher rejection during teardown, or a consumer-supplied VisioForge.Core.UI.WPF.IVideoSurfaceProvider.FrameReady handler throwing. Subscribers can log, surface a UI banner, or reset their own state without attaching a debugger. Consumer exceptions thrown from this handler are swallowed so a misbehaving subscriber cannot break the pipeline.
event EventHandler<Exception> RenderErrorEvent Type
Remarks
Thread affinity: the event is invoked synchronously on the thread where the error was raised — typically a streaming thread, the WPF dispatcher, or a finalizer/teardown thread. Subscribers must NOT assume any particular thread, must NOT block, and must NOT re-enter VisioForge.Core.UI.WPF.IVideoSurfaceProvider members synchronously (handlers that read VisioForge.Core.UI.WPF.IVideoSurfaceProvider.SharedTextureHandle / VisioForge.Core.UI.WPF.IVideoSurfaceProvider.SurfaceWidth / VisioForge.Core.UI.WPF.IVideoSurfaceProvider.SurfaceHeight from a foreign thread can race with the disposing render path).