Table of Contents

Class H264EncoderBlock

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

H.264/AVC encoder block for industry-standard video compression with broad compatibility. This block provides comprehensive H.264 encoding capabilities with support for multiple hardware acceleration platforms including NVIDIA NVENC, AMD AMF, Intel QSV, and Apple VideoToolbox. Features adaptive bitrate control, multiple profile support (Baseline, Main, High), and optimized encoding for various use cases from streaming to broadcast. Essential for universal video compatibility across devices, platforms, and streaming services. Implements the VisioForge.Core.MediaBlocks.MediaBlock. Implements the VisioForge.Core.MediaBlocks.IMediaBlockInternals. Implements the IDisposable.

public class H264EncoderBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

H264EncoderBlock(IH264EncoderSettings)

Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoEncoders.H264EncoderBlock class with specified H.264 encoder settings.

public H264EncoderBlock(IH264EncoderSettings settings)

Parameters

settings IH264EncoderSettings

The H.264 encoder configuration settings.

H264EncoderBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.VideoEncoders.H264EncoderBlock class with automatically selected optimal encoder settings based on available hardware acceleration.

public H264EncoderBlock()

Properties

Input

Gets the input.

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

Inputs

Gets the inputs.

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the outputs.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Settings

Gets or sets the H.264 encoder settings. Contains comprehensive configuration parameters for H.264 encoding including profile selection, bitrate control, quality settings, and hardware acceleration options.

public IH264EncoderSettings Settings { get; set; }

Property Value

IH264EncoderSettings

Type

Gets the type.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Constructs and initializes the H.264 encoder and its associated GStreamer elements. This method creates the encoder with the specified settings, establishes input and output pads, and prepares the block for industry-standard video compression with broad compatibility.

public override bool Build()

Returns

bool

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

CleanUp()

Releases all resources and performs cleanup operations for this H.264 encoder block. This method disposes of the GStreamer elements 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 BaseElement wrapper that provides additional functionality around the GStreamer H.264 encoder element.

public BaseElement GetCore()

Returns

BaseElement

The BaseElement wrapper instance that encapsulates the GStreamer H.264 encoder.

GetDefaultSettings()

Gets the optimal default H.264 encoder settings based on available hardware acceleration. Automatically selects the best available encoder: hardware-accelerated encoders are preferred over software implementations for optimal performance.

public static IH264EncoderSettings GetDefaultSettings()

Returns

IH264EncoderSettings

The optimal H.264 encoder settings for the current system.

GetElement()

Gets the underlying GStreamer element that performs the H.264 video encoding.

public Element GetElement()

Returns

Element

The GStreamer Element instance representing the H.264 encoder.

IsAvailable(IH264EncoderSettings)

Determines whether H.264 encoding is available with the specified settings. Checks for required codec libraries and hardware acceleration support.

public static bool IsAvailable(IH264EncoderSettings settings)

Parameters

settings IH264EncoderSettings

The H.264 encoder settings to validate.

Returns

bool

true if H.264 encoding is available; otherwise, false.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Associates this H.264 encoder block with a pipeline and initializes its internal context. This method is called internally when the block is added to a pipeline.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline

The MediaBlocksPipeline instance that will manage this block.

See Also