Class LVCOutput
- Assembly
- VisioForge.Core.dll
Base class for all Live Video Compositor output destinations.
public class LVCOutput : IDisposableInheritance
Derived
Implements
Inherited Members
Remarks
This class provides the common functionality for all output types in the Live Video Compositor. It manages the output pipeline, bridge connections from the main compositor, and lifecycle operations. Derived classes implement specific output types such as video files, streams, or display outputs. Each output maintains its own pipeline separate from the main compositor for independent control.
Constructors
LVCOutput(string, LiveVideoCompositor, MediaBlock, LVCMediaType, bool)
Initializes a new instance of the VisioForge.Core.LiveVideoCompositorV2.LVCOutput class.
public LVCOutput(string name, LiveVideoCompositor compositor, MediaBlock mainBlock, LVCMediaType mediaType, bool autostart)Parameters
namestring-
A descriptive name for this output.
compositorLiveVideoCompositor-
The compositor this output belongs to.
mainBlockMediaBlock-
The sink block that will receive and process the media stream.
mediaTypeLVCMediaType-
The type of media this output handles (video, audio, or both).
autostartbool-
If
true, starts automatically when the compositor starts.
Remarks
This constructor initializes the output pipeline and configures clock synchronization with the main compositor. The main block typically represents a file sink, stream sink, or display renderer.
Fields
_bridgeSourceBlock
The bridge source block.
protected MediaBlock _bridgeSourceBlockField Value
_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 receives and processes the output media stream.
protected MediaBlock _mainBlockField Value
_mediaType
The type of media (video, audio, or both) handled by this output.
protected LVCMediaType _mediaTypeField Value
disposedValue
The disposed value.
protected bool disposedValueField Value
Properties
AutoStart
Gets or sets a value indicating whether this output starts automatically with the main compositor.
public bool AutoStart { get; set; }Property Value
Remarks
When set to true, this output will begin processing as soon as the compositor starts. When false, the output must be started manually using StartAsync(). This is useful for outputs that should be activated on-demand, such as recording outputs.
ID
Gets the unique identifier for this output.
public Guid ID { get; }Property Value
Remarks
This ID is generated automatically when the output is created and remains constant throughout the output's lifetime. Use this for reliable output identification instead of names.
Name
Gets the descriptive name of this output.
public string Name { get; }Property Value
Pipeline
Gets the media processing pipeline for this output.
public MediaBlocksPipeline Pipeline { get; }Property Value
Remarks
Each output maintains its own pipeline separate from the main compositor pipeline, allowing independent control over recording, streaming, or display operations.
Methods
Build(string, string)
Builds the internal pipeline structure for this output.
public virtual void Build(string uniqueName, string uniqueName2 = null)Parameters
uniqueNamestring-
The unique bridge identifier for the primary stream (video or audio).
uniqueName2string-
The unique bridge identifier for the secondary stream (used for video/audio outputs).
Remarks
This virtual method creates the bridge source blocks that receive data from the main compositor and connects them to the output's main block. It can be overridden by derived classes for custom pipeline configurations. The method handles dynamic input creation for blocks that support it.
Exceptions
- ArgumentOutOfRangeException
-
Thrown when the media type is not recognized.
Dispose(bool)
Releases the unmanaged and optionally managed resources used by this output.
protected virtual void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
Remarks
This method disposes of the main block, pipeline, and bridge source block if they exist. Derived classes should override this method to dispose of their specific resources, ensuring to call the base implementation.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting resources.
public void Dispose()Remarks
Call this method when you are finished using the output. This method ensures proper cleanup of all resources and should be called before removing the output from the compositor.
~LVCOutput()
Finalizes an instance of the VisioForge.Core.LiveVideoCompositorV2.LVCOutput class.
protected ~LVCOutput()Remarks
The finalizer calls Dispose(false) to release unmanaged resources. This ensures resources are cleaned up even if Dispose() is not called explicitly.
GetFilenameOrURL()
Gets the filename or URL associated with this output.
public string GetFilenameOrURL()Returns
- string
-
The filename or URL if the main block implements VisioForge.Core.MediaBlocks.IMediaBlockSink; otherwise,
null.
Remarks
This method delegates to the main block's implementation of IMediaBlockSink. It's typically used for file or stream outputs to retrieve the destination path or URL.
SetAndConnectMainBlock(MediaBlock)
Sets a new main block and connects it to the existing bridge source.
protected bool SetAndConnectMainBlock(MediaBlock mainBlock)Parameters
mainBlockMediaBlock-
The new sink block to use as the main output destination.
Returns
- bool
-
trueif the connection was successful;falseif the block is null or connection failed.
Remarks
This protected method allows derived classes to change the output destination dynamically. The bridge source must already be created before calling this method.
SetFilenameOrURL(string)
Sets the filename or URL for this output.
public void SetFilenameOrURL(string value)Parameters
valuestring-
The filename or URL to set as the output destination.
Remarks
This method delegates to the main block's implementation of IMediaBlockSink. It's typically used for file or stream outputs to set the destination path or URL. The actual behavior depends on the specific sink implementation in the main block.
StartAsync()
Starts this output's pipeline and begins processing media from the compositor.
public Task<bool> StartAsync()Returns
- Task<bool>
-
A Task<TResult> that completes with
trueif the start was successful; otherwise,false.
Remarks
This method should be called after the output has been added to the compositor. If AutoStart is true, this method is called automatically when the compositor starts.
StopAsync(bool)
Stops this output's pipeline and finalizes any pending operations.
public Task<bool> StopAsync(bool force = false)Parameters
forcebool-
If
true, forces immediate pipeline shutdown without waiting for pending data. Iffalse, performs a graceful shutdown using end-of-stream messages. Default isfalse.
Returns
- Task<bool>
-
A Task<TResult> that completes with
trueif the stop was successful; otherwise,false.
Remarks
For file outputs, using force=true may result in incomplete files or corrupted endings. Always use force=false (default) for file outputs to ensure proper finalization. For display or streaming outputs, force=true can be used for immediate shutdown.
See Also
-
IMediaBlockSink