Class MediaBlockPad
- Namespace
- VisioForge.Core.MediaBlocks
- Assembly
- VisioForge.Core.dll
Represents a connection point (pad) on a MediaBlock that enables data flow between blocks in the pipeline. Pads can be input (sink) or output (source) and are typed by media content (video, audio, subtitles, data). This class manages the underlying GStreamer pad, connection state, and provides methods for dynamic linking/unlinking during pipeline execution. Essential for building flexible media processing workflows.
public class MediaBlockPad : IDisposableInheritance
Implements
Inherited Members
Constructors
MediaBlockPad(MediaBlock, MediaBlockPadDirection, MediaBlockPadMediaType, bool)
Initializes a new instance of the VisioForge.Core.MediaBlocks.MediaBlockPad class with the specified parameters. Creates a connection point for the given block with the specified data flow direction and media type.
public MediaBlockPad(MediaBlock block, MediaBlockPadDirection direction, MediaBlockPadMediaType mediaType, bool onDemandConnect = false)Parameters
blockMediaBlock-
The MediaBlock that owns this pad.
directionMediaBlockPadDirection-
The data flow direction (input/sink or output/source).
mediaTypeMediaBlockPadMediaType-
The type of media content this pad will handle (video, audio, subtitles, data).
onDemandConnectbool-
If true, the pad will connect dynamically after pipeline start; if false, connects during pipeline construction.
Properties
Block
Gets the MediaBlock that owns this pad. This provides access to the parent block for logging, context, and lifecycle management.
public MediaBlock Block { get; }Property Value
Direction
Gets the direction of data flow for this pad (input/sink or output/source). Determines whether this pad receives data from other blocks or sends data to them.
public MediaBlockPadDirection Direction { get; }Property Value
MediaType
Gets the type of media content that flows through this pad (video, audio, subtitles, or data). This determines what kind of media streams can be connected to this pad.
public MediaBlockPadMediaType MediaType { get; }Property Value
OnDemandConnect
Gets or sets a value indicating whether this pad will establish its connection dynamically after the pipeline starts. When true, the pad connection is deferred until runtime rather than being established during pipeline construction.
public bool OnDemandConnect { get; set; }Property Value
Tag
Gets or sets a custom tag object that can be used to associate additional data with this pad. This is typically used for internal bookkeeping or storing pad-specific metadata.
public object Tag { get; set; }Property Value
Methods
BlockPadLive()
Blocks data flow through this pad in a running pipeline. This temporarily stops media data from flowing through the pad without disconnecting it.
public bool BlockPadLive()Returns
- bool
-
True if the pad was successfully blocked; false if blocking failed.
Connect(MediaBlockPad)
Establishes a logical connection between this pad and another MediaBlockPad. This creates a high-level connection relationship that will be used for pipeline construction.
public void Connect(MediaBlockPad pad)Parameters
padMediaBlockPad-
The target MediaBlockPad to connect to.
ConnectLive(MediaBlockPad)
Dynamically links this source pad to a sink pad in a running or paused pipeline. This allows for runtime connection changes without stopping the pipeline.
public bool ConnectLive(MediaBlockPad sinkPad)Parameters
sinkPadMediaBlockPad-
The target sink MediaBlockPad to link to.
Returns
- bool
-
True if the pads were successfully linked; false if linking failed.
Disconnect()
Disconnects this pad from its currently connected MediaBlockPad. This performs actual GStreamer pad unlinking and clears the logical connection on both sides.
public void Disconnect()DisconnectLive(MediaBlockPad)
Dynamically unlinks this source pad from a sink pad in a running or paused pipeline. This allows for runtime disconnection without stopping the pipeline.
public bool DisconnectLive(MediaBlockPad sinkPad)Parameters
sinkPadMediaBlockPad-
The sink MediaBlockPad to unlink from.
Returns
- bool
-
True if the pads were successfully unlinked; false if unlinking failed.
Dispose(bool)
Releases unmanaged and - optionally - managed resources.
protected virtual void Dispose(bool disposing)Parameters
disposingbool-
trueto release both managed and unmanaged resources;falseto release only unmanaged resources.
Dispose()
Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.
public void Dispose()~MediaBlockPad()
Finalizes an instance of the VisioForge.Core.MediaBlocks.MediaBlockPad class.
protected ~MediaBlockPad()GetConnectedToPad()
Gets the MediaBlockPad that this pad is currently connected to. Returns the logical connection established through the Connect method.
public MediaBlockPad GetConnectedToPad()Returns
- MediaBlockPad
-
The connected MediaBlockPad, or null if not connected.
GetInternalPad()
Gets the underlying GStreamer pad object associated with this MediaBlockPad. Provides access to the low-level GStreamer pad for advanced operations.
public Pad GetInternalPad()Returns
- Pad
-
The GStreamer Pad object, or null if not yet assigned.
IsActive()
Determines whether the underlying GStreamer pad is in an active state. An active pad is ready to process media data and participate in pipeline operations.
public bool IsActive()Returns
- bool
-
True if the pad is active and ready for media processing; otherwise, false.
IsConnected()
Determines whether this pad has a logical connection to another MediaBlockPad. This checks the high-level connection established through the Connect method.
public bool IsConnected()Returns
- bool
-
True if this pad is connected to another MediaBlockPad; otherwise, false.
IsConnectedLive()
Determines whether the underlying GStreamer pad is actively linked in a running pipeline. This checks the actual GStreamer-level connection status, not just the logical MediaBlocks connection.
public bool IsConnectedLive()Returns
- bool
-
True if the GStreamer pad is actively linked; otherwise, false.
IsInternalPadNull()
Determines whether the underlying GStreamer pad has been assigned to this MediaBlockPad. Used to check if the pad is ready for media operations.
public bool IsInternalPadNull()Returns
- bool
-
True if the internal GStreamer pad is null (not assigned); otherwise, false.
SetInternalPad(Pad)
Associates this MediaBlockPad with the underlying GStreamer pad object. This establishes the connection between the high-level MediaBlocks pad and the low-level GStreamer pad.
public void SetInternalPad(Pad pad)Parameters
padPad-
The GStreamer pad object that will handle the actual media data flow.
ToString()
Returns a String that represents this instance.
public override string ToString()Returns
UnblockPadLive()
Unblocks data flow through this pad in a running pipeline. This resumes media data flow through a previously blocked pad.
public bool UnblockPadLive()Returns
- bool
-
True if the pad was successfully unblocked; false if unblocking failed.
OnEOS
Event that is raised when an End-of-Stream (EOS) event is detected on this pad. This indicates that no more data will flow through the pad. Event handlers should be assigned before starting the pipeline.
public event EventHandler<EventArgs> OnEOS