Table of Contents

Class BarcodeDetectorBlock

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

A specialized media block that detects and decodes barcodes from video frames in real-time. This block analyzes incoming video frames for various barcode formats including QR codes, DataMatrix, Code128, Code39, EAN-13, and other standard 1D/2D barcodes.

Key features:

  • Real-time barcode detection and decoding from video streams
  • Support for multiple simultaneous barcode detection
  • Configurable operating modes (passthrough or sink)
  • Event-based notification when barcodes are detected
  • Minimal performance impact on video pipeline

Common use cases:

  • QR code scanning in mobile applications
  • Inventory management systems with barcode scanning
  • Document processing with embedded barcodes
  • Access control systems using QR codes
  • Product tracking in retail/warehouse environments

Technical details:

  • Processes video frames using computer vision algorithms
  • Can operate in InputOutput mode (passthrough) or Input mode (sink)
  • Raises events with decoded barcode data and metadata
  • Requires appropriate barcode detection libraries in the GStreamer plugin set

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

public class BarcodeDetectorBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

BarcodeDetectorBlock(BarcodeDetectorMode)

Initializes a new instance of the VisioForge.Core.MediaBlocks.Special.BarcodeDetectorBlock class with the specified operating mode.

public BarcodeDetectorBlock(BarcodeDetectorMode mode)

Parameters

mode BarcodeDetectorMode

The detection mode determining whether to pass through video (InputOutput) or act as a sink (Input).

Properties

Input

Gets the primary input pad for receiving video frames to analyze for barcodes.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the array of input pads. This block has a single video input.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

IsSync

Gets or sets a value indicating whether to synchronize the video stream timing. When true, maintains proper playback timing for real-time applications. When false, processes frames as fast as possible for offline analysis. Usually set to true for live playback/capture and false for batch processing.

public bool IsSync { get; set; }

Property Value

bool

Mode

Gets or sets the operating mode of the barcode detector. InputOutput mode passes video through while detecting barcodes. Input mode acts as a sink and only processes barcodes without outputting video.

public BarcodeDetectorMode Mode { get; set; }

Property Value

BarcodeDetectorMode

Output

Gets the primary output pad that passes through video frames after barcode detection.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the array of output pads. Contains one pad in InputOutput mode, empty in Input mode.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the media block type identifier for this barcode detector block.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds and initializes the barcode detector block within the media pipeline. Creates the GStreamer elements, configures detection parameters, and establishes pad connections. This method is called automatically when the pipeline is being constructed.

public override bool Build()

Returns

bool

true if the block was successfully built and configured; false if initialization failed.

CallBarcodeDetected(BarcodeDetectorEventArgs)

Raises the OnBarcodeDetected event with the specified barcode detection results. This method is called internally when the detector identifies barcodes in a frame.

public void CallBarcodeDetected(BarcodeDetectorEventArgs args)

Parameters

args BarcodeDetectorEventArgs

The VisioForge.Core.Types.X.BarcodeDetectorEventArgs instance containing the decoded barcode data, type, and metadata.

CleanUp()

Performs cleanup of internal resources and GStreamer elements. Releases the barcode detector element and resets the build state.

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 barcode detector element.

GetElement()

Gets the underlying GStreamer element for direct access to native properties.

public Element GetElement()

Returns

Element

The native GStreamer barcode detector element.

IsAvailable()

Determines whether the barcode detector functionality is available in the current environment. This checks if the required GStreamer barcode detection plugins are installed and accessible. The appropriate VisioForge SDK redistribution package must be included in your project.

public static bool IsAvailable()

Returns

bool

true if barcode detection plugins are available; otherwise, false.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the media pipeline context for this block. This internal method establishes the connection to the parent pipeline and provides access to shared resources.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The parent MediaBlocksPipeline that contains this block.

OnBarcodeDetected

Occurs when one or more barcodes are detected in a video frame. The event provides decoded barcode data, type, position, and confidence information. This event is raised asynchronously as barcodes are detected in the video stream.

public event EventHandler<BarcodeDetectorEventArgs> OnBarcodeDetected

Event Type

EventHandler<BarcodeDetectorEventArgs>

See Also