Table of Contents

Class DataSampleGrabberBlock

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

A specialized media block that intercepts and provides access to raw media data frames passing through the pipeline. This block acts as a transparent passthrough while capturing frame data for analysis, processing, or monitoring. Unlike video/audio-specific grabbers, this block can handle any media type including metadata streams.

Key features:

  • Zero-copy frame access with minimal performance impact
  • Support for any media type (video, audio, metadata, subtitles)
  • Passthrough design maintains pipeline flow
  • Event-based notification for each frame
  • Access to raw buffer data and timing information
  • Configurable media type filtering

Common use cases:

  • Capturing metadata streams from specialized sources
  • Monitoring data flow for debugging purposes
  • Extracting timing information from media streams
  • Analyzing proprietary data formats
  • Building custom analytics on media streams
  • Implementing data stream validators

Technical details:

  • Uses GStreamer pad probes for non-invasive data access
  • Provides frame data through event callbacks
  • Maintains original buffer timestamps and metadata
  • Can be configured for specific media types or auto-detect
  • Thread-safe frame delivery via events

Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class DataSampleGrabberBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

DataSampleGrabberBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.DataSampleGrabberBlock class with automatic media type detection. The grabber will accept and pass through any media type.

public DataSampleGrabberBlock()

DataSampleGrabberBlock(MediaBlockPadMediaType)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.DataSampleGrabberBlock class with a specific media type filter.

public DataSampleGrabberBlock(MediaBlockPadMediaType padType)

Parameters

padType MediaBlockPadMediaType

The media type to accept (Video, Audio, Auto, etc.). Only frames of this type will be processed.

Properties

Input

Gets the input pad for receiving media data frames.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the array of input pads. This block has a single input for data interception.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output pad that passes through the intercepted data frames.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the array of output pads. This block has a single passthrough output.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the media block type identifier for this data sample grabber.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the data sample grabber within the media pipeline. Sets up the frame interception mechanism and configures the callback for data delivery. This method is called automatically during pipeline construction.

public override bool Build()

Returns

bool

true if the grabber was successfully initialized; false if setup failed.

CleanUp()

Performs cleanup of the data grabber resources. Releases the GStreamer element and removes frame interception callbacks.

public void CleanUp()

Dispose(bool)

Releases unmanaged and - optionally - managed 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.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement instance wrapping the data grabber element.

GetElement()

Gets the underlying GStreamer element for direct property access.

public Element GetElement()

Returns

Element

The native GStreamer data grabber element.

IsAvailable()

Determines whether the data sample grabber functionality is available in the current environment. This checks if the required GStreamer components for data interception are installed. The appropriate VisioForge SDK redistribution package must be included in your project.

public static bool IsAvailable()

Returns

bool

true if data grabbing functionality is available; otherwise, false.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the media pipeline context for this data grabber block. This internal method establishes the connection to the parent pipeline.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The parent MediaBlocksPipeline that contains this block.

OnDataFrame

Occurs when a new data frame passes through the grabber. The event provides access to the raw frame data, format information, and timing metadata. This event is raised from the streaming thread and handlers should process data quickly.

public event EventHandler<DataFrameEventArgs> OnDataFrame

Event Type

EventHandler<DataFrameEventArgs>

See Also