Table of Contents

Interface IMediaBlockAsyncPrepare

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

Optional interface for blocks whose synchronous Build() needs data that only an asynchronous probe of a live source can supply - the RTSP RAW and NDI sources pick their GStreamer elements from the probed stream layout, so they cannot be built blind the way RTSPSourceBlock can with its compatibility mode. VisioForge.Core.MediaBlocks.MediaBlocksPipeline.StartAsync(System.Boolean) probes for this interface with as and awaits VisioForge.Core.MediaBlocks.IMediaBlockAsyncPrepare.PrepareAsync(VisioForge.Core.GStreamer.ContextX,System.Threading.CancellationToken) on every block that implements it, once, before the pipeline is built. A settings object that was configured by hand or restored from a pipeline document therefore gets its media information without any blocking call on the build path.

public interface IMediaBlockAsyncPrepare

Remarks

Implementations MUST be idempotent (a second call with the information already cached is a no-op), MUST NOT throw - a cancelled probe returns false rather than raising - and MUST tolerate a null context. The synchronous VisioForge.Core.MediaBlocks.MediaBlocksPipeline.Start(System.Boolean) and AddBlockLive paths have no place to await and do not call this - the block's own Build() guard still reports the missing information there.

Methods

PrepareAsync(ContextX, CancellationToken)

Probes whatever the block needs before Build() can run.

Task<bool> PrepareAsync(ContextX context, CancellationToken cancellationToken)

Parameters

context ContextX

The pipeline context used for logging. May be null.

cancellationToken CancellationToken

Cancelled when a stop or a dispose arrives while the pass is running. Honour it where the underlying probe accepts one; where it does not, the probe's own timeout is the ceiling and the pipeline still abandons the start at the next block.

Returns

Task<bool>

true when the block is ready to be built; false when the source could not be probed and starting the pipeline should be abandoned.