Class LVCOutput
- Namespace
- VisioForge.Core.LiveVideoCompositor
- Assembly
- VisioForge.Core.dll
Base class for Live Video Compositor output destinations that receive composed media content from the main composition pipeline. Each output runs in its own isolated MediaBlocks pipeline and connects to the main compositor via bridge blocks. This architecture allows for independent control of each output destination (start, stop, pause) while receiving synchronized content from the main composition pipeline. Supports video-only, audio-only, or combined video/audio outputs. Implements the IDisposable.
public class LVCOutput : IDisposableInheritance
Derived
Implements
Inherited Members
Examples
// Creating a file output for recording
var fileOutput = new LVCVideoAudioOutput("Recording", compositor, fileEncoderBlock);
fileOutput.SetFilenameOrURL("output.mp4");
await compositor.Output_AddAsync(fileOutput);
// The output will automatically start with the compositor
await compositor.StartAsync();
Remarks
Output types include:
- File encoders (MP4, AVI, MOV recordings)
- Streaming encoders (RTMP, SRT, UDP streaming)
- Network outputs (NDI, RTP)
- Display outputs (preview windows, fullscreen)
- Hardware outputs (DeckLink, NDI hardware) Each output maintains its own processing pipeline for isolation and independent lifecycle management.
Constructors
LVCOutput(string, LiveVideoCompositor, MediaBlock, LVCMediaType, bool)
Initializes a new instance of the VisioForge.Core.LiveVideoCompositor.LVCOutput class.
public LVCOutput(string name, LiveVideoCompositor compositor, MediaBlock mainBlock, LVCMediaType mediaType, bool autostart)Parameters
namestring-
The user-friendly name for this output.
compositorLiveVideoCompositor-
The parent compositor that will manage this output.
mainBlockMediaBlock-
The primary sink block that consumes media content.
mediaTypeLVCMediaType-
The type of media this output handles (video, audio, or both).
autostartbool-
If set to
true, automatically start with the main compositor pipeline.
Fields
_bridgeSourceBlock
The bridge source block that receives media data from the main compositor pipeline.
protected MediaBlock _bridgeSourceBlockField Value
Remarks
Bridge blocks enable cross-pipeline communication, allowing independent pipeline control while maintaining synchronized media flow from the compositor.
_compositor
Reference to the parent Live Video Compositor that manages this output.
protected LiveVideoCompositor _compositorField Value
_context
The execution context providing logging, error handling, and platform-specific services.
protected ContextX _contextField Value
- ContextX
_mainBlock
The primary sink block that consumes the composed media content.
protected MediaBlock _mainBlockField Value
Remarks
This can be a file writer, streaming encoder, display renderer, or any other MediaBlock that implements IMediaBlockSink interface.
_mediaType
The type of media this output handles (video, audio, or both).
protected LVCMediaType _mediaTypeField Value
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 output automatically starts when the main compositor starts.
public bool AutoStart { get; set; }Property Value
Remarks
When false, the output must be started manually using StartAsync() after the compositor starts. Useful for outputs that should be activated on-demand during live production.
Channel
Gets or sets the video channel index from which this output receives content.
public int Channel { get; set; }Property Value
Remarks
When the compositor has multiple video channels, this property determines which channel's output is sent to this destination.
Name
Gets the user-friendly name of this output destination.
public string Name { get; }Property Value
Pipeline
Gets the MediaBlocks pipeline that manages this output's processing chain.
public MediaBlocksPipeline Pipeline { get; }Property Value
Remarks
Each output has its own pipeline for isolation and independent control.
Methods
Build(string, string)
Builds the output pipeline by creating bridge source blocks and connecting to the main sink.
public virtual void Build(string uniqueName, string uniqueName2 = null)Parameters
uniqueNamestring-
The unique name for the primary bridge connection.
uniqueName2string-
The unique name for the secondary bridge connection (optional, for dual-stream outputs).
Remarks
This method creates the appropriate bridge source block based on the media type and connects it to the main sink block. For blocks supporting dynamic inputs, new input pads are created as needed.
Exceptions
- ArgumentOutOfRangeException
-
Thrown when _mediaType is not a valid LVCMediaType value.
Dispose(bool)
Releases the unmanaged resources used by the output 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.LVCOutput class.
public void Dispose()Remarks
Call this method when the output is no longer needed to free resources immediately rather than waiting for garbage collection.
~LVCOutput()
Finalizes an instance of the VisioForge.Core.LiveVideoCompositor.LVCOutput class by releasing unmanaged resources.
protected ~LVCOutput()GetFilenameOrURL()
Gets the output filename or URL from the main sink block.
public string GetFilenameOrURL()Returns
- string
-
The filename for file outputs or URL for streaming outputs;
nullif not applicable.
Remarks
This method is only valid for outputs that write to files or stream to network destinations. Display outputs or hardware outputs will return null.
SetAndConnectMainBlock(MediaBlock)
Sets a new main sink block and connects it to the existing bridge source.
protected bool SetAndConnectMainBlock(MediaBlock mainBlock)Parameters
mainBlockMediaBlock-
The new main sink block to connect.
Returns
- bool
-
trueif the block was successfully set and connected;falseif the operation failed.
Remarks
This method allows changing the output destination dynamically after the pipeline is built. The bridge source must already exist before calling this method.
SetFilenameOrURL(string)
Sets the output filename or URL for the main sink block.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The filename for file outputs or URL for streaming outputs.
Remarks
For file outputs, provide a local file path. For streaming outputs, provide the destination URL (e.g., rtmp://server/app/stream). This method only affects blocks that implement IMediaBlockSink.
StartAsync()
Starts the output pipeline and begins receiving composed media from the compositor.
public Task<bool> StartAsync()Returns
Remarks
The output will begin processing media as soon as the compositor provides it through the bridge connection. Ensure the compositor is running before starting outputs to receive media.
StopAsync(bool)
Stops the output pipeline and finalizes any pending operations.
public Task<bool> StopAsync(bool force = false)Parameters
forcebool-
If set to
true, the pipeline will be stopped immediately without waiting for proper finalization. Iffalse(default), the pipeline performs a graceful shutdown using end-of-stream messages.
Returns
Remarks
For file outputs, using force=true may result in corrupted files or missing frames. Always use force=false when recording to ensure proper file finalization.