Class LVCInput
- Namespace
- VisioForge.Core.LiveVideoCompositor
- Assembly
- VisioForge.Core.dll
Base class for Live Video Compositor input sources that feed media content into the composition pipeline. Each input runs in its own isolated MediaBlocks pipeline and connects to the main compositor via bridge blocks. This architecture allows for independent control of each input source (start, stop, pause) while maintaining synchronized output from the main composition pipeline. Supports video-only, audio-only, or combined video/audio inputs. Implements the IDisposable.
public class LVCInput : IDisposableInheritance
Derived
Implements
Inherited Members
Examples
// Creating a video input from a camera
var cameraInput = new LVCVideoAudioInput("Camera 1", compositor, cameraSettings);
cameraInput.Rectangle = new Rect(0, 0, 640, 480); // Position in composition
await compositor.Input_AddAsync(cameraInput);
// The input will automatically start with the compositor
await compositor.StartAsync();
Remarks
Input types include:
- Video capture devices (cameras, capture cards)
- Audio capture devices (microphones, audio interfaces)
- Network streams (RTSP, NDI, HTTP)
- File-based sources (video files, image sequences)
- Virtual sources (test patterns, screen capture) Each input maintains its own processing pipeline for isolation and independent lifecycle management.
Constructors
LVCInput(string, LiveVideoCompositor, MediaBlock, LVCMediaType, bool, MediaBlock, bool)
Initializes a new instance of the VisioForge.Core.LiveVideoCompositor.LVCInput class.
protected LVCInput(string name, LiveVideoCompositor compositor, MediaBlock mainBlock, LVCMediaType mediaType, bool autostart, MediaBlock processingBlock = null, bool live = true)Parameters
namestring-
The user-friendly name for this input.
compositorLiveVideoCompositor-
The parent compositor that will manage this input.
mainBlockMediaBlock-
The primary source block that provides media content.
mediaTypeLVCMediaType-
The type of media this input handles (video, audio, or both).
autostartbool-
If set to
true, automatically start with the main compositor pipeline. processingBlockMediaBlock-
Optional processing block for effects or transformations.
livebool-
If set to
true, indicates this is a live/real-time source.
Fields
_bridgeSinkBlock
The bridge sink block that transfers media data from this input pipeline to the main compositor.
protected MediaBlock _bridgeSinkBlockField Value
Remarks
Bridge blocks enable cross-pipeline communication, allowing independent pipeline control while maintaining synchronized media flow.
_context
The execution context providing logging, error handling, and platform-specific services.
protected ContextX _contextField Value
- ContextX
_mainBlock
The primary source block that generates or receives the media content for this input.
protected MediaBlock _mainBlockField Value
Remarks
This can be a camera source, file source, network stream source, or any other MediaBlock that implements IMediaBlockSource interface.
_processingBlock
The optional processing block that can be inserted between the main source block and bridge sink.
protected MediaBlock _processingBlockField Value
Remarks
Used for applying effects, filters, or transformations to the input before it reaches the compositor. Examples include color correction, scaling, deinterlacing, or audio processing.
disposedValue
Tracks whether the object has been disposed to prevent redundant disposal.
protected bool disposedValueField Value
Properties
AutoStart
Gets or sets a value indicating whether this input automatically starts when the main compositor starts.
public bool AutoStart { get; set; }Property Value
Remarks
When false, the input must be started manually using StartAsync() after the compositor starts. Useful for inputs that should be added dynamically during live production.
ID
Gets or sets the numeric identifier assigned by the compositor.
public int ID { get; }Property Value
Remarks
Assigned internally when the input is added to the compositor.
MediaType
Gets the type of media this input handles (video, audio, or both).
public LVCMediaType MediaType { get; }Property Value
Name
Gets the user-friendly name of this input source.
public string Name { get; }Property Value
Pipeline
Gets the MediaBlocks pipeline that manages this input's processing chain.
public MediaBlocksPipeline Pipeline { get; }Property Value
Remarks
Each input has its own pipeline for isolation and independent control.
UniqueName
Gets or sets the unique identifier for the primary bridge connection.
public string UniqueName { get; set; }Property Value
Remarks
This name must be unique across all inputs to ensure proper data routing.
UniqueName2
Gets or sets the unique identifier for the secondary bridge connection (used for dual-stream inputs).
public string UniqueName2 { get; set; }Property Value
Remarks
Only used when an input provides both video and audio through separate bridge connections.
Methods
Build(int, string, int, string)
Builds the input pipeline by creating and connecting the necessary bridge blocks.
public virtual void Build(int id, string uniqueName, int id2 = -1, string uniqueName2 = null)Parameters
idint-
The primary identifier for this input.
uniqueNamestring-
The unique name for the primary bridge connection.
id2int-
The secondary identifier for dual-stream inputs (default: -1).
uniqueName2string-
The unique name for the secondary bridge connection (optional).
Remarks
Derived classes must implement this method to set up their specific pipeline configuration, including bridge connections and any processing blocks.
Exceptions
- NotImplementedException
-
This base implementation must be overridden in derived classes.
Dispose(bool)
Releases the unmanaged resources used by the input and optionally releases the managed resources.
protected virtual void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
Remarks
This method properly disposes of the pipeline, main block, and bridge connections. Derived classes should override this method to dispose of their specific resources.
Dispose()
Releases all resources used by the current instance of the VisioForge.Core.LiveVideoCompositor.LVCInput class.
public void Dispose()Remarks
Call this method when the input is no longer needed to free resources immediately rather than waiting for garbage collection.
~LVCInput()
Finalizes an instance of the VisioForge.Core.LiveVideoCompositor.LVCInput class by releasing unmanaged resources.
protected ~LVCInput()PauseAsync()
Pauses the input source while maintaining its connection to the compositor.
public Task PauseAsync()Returns
- Task
-
A task representing the asynchronous pause operation.
Remarks
Pausing an input stops media flow but keeps the pipeline ready for quick resumption. Not all source types support pausing (e.g., live camera feeds).
ResumeAsync()
Resumes playback of a paused input source.
public Task ResumeAsync()Returns
- Task
-
A task representing the asynchronous resume operation.
Remarks
Only applicable to inputs that were previously paused. Live sources may not support pause/resume.
StartAsync()
Starts the input pipeline and begins media flow to the compositor.
public Task<bool> StartAsync()Returns
Remarks
For certain source types (UniversalSource, Decklink), this method waits for the pipeline to fully initialize before returning. This ensures the source is ready before proceeding.
StopAsync()
Stops the input pipeline and disconnects from the compositor.
public Task<bool> StopAsync()Returns
Remarks
Stopping an input releases its resources and removes it from the composition. The input can be restarted later if needed.