Class VirtualCameraCustomStreamer
- Namespace
- VisioForge.Core
- Assembly
- VisioForge.Core.dll
Provides functionality to stream custom video frames to a VisioForge virtual camera device. This class creates a DirectShow filter graph that captures frames from a queue and outputs them to a virtual camera sink.
public class VirtualCameraCustomStreamer : IDisposableInheritance
Implements
Inherited Members
Remarks
The streamer uses a fake screen capture source combined with a sample grabber to intercept and replace frames with custom video data provided through VisioForge.Core.VirtualCameraCustomStreamer.WriteVideoFrame(VisioForge.Core.Types.VideoFrame). Frames are automatically resized and color space converted as needed.
Constructors
VirtualCameraCustomStreamer(DSContext, int, int, VideoFrameRate, RAWVideoColorSpace)
Initializes a new instance of the VisioForge.Core.VirtualCameraCustomStreamer class. Creates and configures a DirectShow filter graph for streaming custom video frames to a virtual camera.
public VirtualCameraCustomStreamer(DSContext context, int width, int height, VideoFrameRate fps, RAWVideoColorSpace colorspace = RAWVideoColorSpace.RGB)Parameters
contextDSContext-
The DirectShow context for logging and error handling. If null, a new context is created.
widthint-
The width of the video frames in pixels.
heightint-
The height of the video frames in pixels.
fpsVideoFrameRate-
The frame rate for the video stream.
colorspaceRAWVideoColorSpace-
The color space of the input video frames. Default is RGB.
Methods
Dispose(bool)
Releases the unmanaged resources used by the VisioForge.Core.VirtualCameraCustomStreamer and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)Parameters
disposingbool-
Always
true- this class has no finalizer. It never needed one: the frame buffers freed below are filled only by the sample grabber callback, and while that callback is registered the native filter's CCW roots this object, so a finalizer could only ever have run with nothing left to free - after freeing them without first clearing the callback (GitHub issue #1545). Kept so COM and managed objects stay out of a finalizer if one is ever added.
Dispose()
Releases all resources used by the VisioForge.Core.VirtualCameraCustomStreamer.
public void Dispose()WriteVideoFrame(VideoFrame)
Writes a video frame to the virtual camera stream. The frame is added to an internal queue and will be processed on the next sample grabber callback.
public void WriteVideoFrame(VideoFrame frame)Parameters
frameVideoFrame-
The video frame to stream. The frame is cloned internally, so the caller retains ownership of the original.
Remarks
The queue is limited to 5 frames. If the queue is full, the oldest frame is automatically discarded. Frames are automatically resized and color-converted to match the output format if needed.