Table of Contents

Class StreamSourceBlock

Namespace
VisioForge.Core.MediaBlocks.Sources
Assembly
VisioForge.Core.dll

Stream source block for reading media data from .NET Stream objects. Provides flexible media playback from memory streams, file streams, or network streams without integrated decoders, enabling custom data sources, in-memory media processing, and streaming from non-standard sources for advanced pipeline scenarios. Implements the VisioForge.Core.MediaBlocks.Sources.SourceMediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class StreamSourceBlock : SourceMediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

StreamSourceBlock(Stream)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.StreamSourceBlock class with an existing stream. Configures the stream source to read media data from any .NET Stream implementation.

public StreamSourceBlock(Stream stream)

Parameters

stream Stream

The .NET Stream object containing media data to be read and processed.

StreamSourceBlock(string)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.StreamSourceBlock class from a file path. Opens the specified file as a stream and takes ownership of the stream for disposal.

public StreamSourceBlock(string filename)

Parameters

filename string

The path to the media file to open as a stream for reading.

Properties

Input

Gets the primary input pad (none for source blocks that read from streams).

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets all input pads available on this block (none for source blocks).

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the primary output pad for the raw stream data.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets all output pads available on this block (single raw data output).

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the media block type identifier for stream source operations.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the stream source within the pipeline context. Creates the stream reader and buffering queue for raw data streaming from .NET Stream objects.

public override bool Build()

Returns

bool

true if the stream source was successfully built and configured; otherwise, false.

CleanUp()

Cleans up all resources associated with the stream source operations, including the stream and data buffers.

public void CleanUp()

Dispose(bool)

Releases unmanaged and managed resources used by the stream source. Properly closes the stream (if owned) and disposes of GStreamer elements and buffering resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

true to release both managed and unmanaged resources; false to release only unmanaged resources.

GetCore()

Gets the core GStreamer element wrapper for advanced configuration and monitoring.

public BaseElement GetCore()

Returns

BaseElement

Always null for composite source blocks with multiple internal elements.

GetElement()

Gets the native GStreamer element for direct GStreamer pipeline integration.

public Element GetElement()

Returns

Element

The stream source GStreamer element.

IsAvailable()

Determines whether stream source support is available on the current system. Requires GStreamer appsrc plugin to be installed for stream data injection.

public static bool IsAvailable()

Returns

bool

true if stream source support is available; otherwise, false.

SendEOS()

Sends an End-of-Stream (EOS) signal to indicate that all data has been read from the stream.

public bool SendEOS()

Returns

bool

true if the EOS signal was successfully sent; otherwise, false.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the pipeline context for this stream source, providing access to the parent pipeline and logging context.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The parent MediaBlocks pipeline containing this stream source.

See Also