Class H264EncoderBlock
- 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, IMediaBlockInternalsInheritance
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
settingsIH264EncoderSettings-
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
Inputs
Gets the inputs.
public override MediaBlockPad[] Inputs { get; }Property Value
Output
Gets the output.
public override MediaBlockPad Output { get; }Property Value
Outputs
Gets the outputs.
public override MediaBlockPad[] Outputs { get; }Property Value
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
Type
Gets the type.
public override MediaBlockType Type { get; }Property Value
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
-
trueif the encoder was successfully built and configured;falseif 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
disposingbool-
trueto release both managed and unmanaged resources;falseto 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
settingsIH264EncoderSettings-
The H.264 encoder settings to validate.
Returns
- bool
-
trueif 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
pipelineMediaBlocksPipeline-
The MediaBlocksPipeline instance that will manage this block.