Table of Contents

Class H264PushSourceBlock

Namespace
VisioForge.Core.MediaBlocks.Sources
Assembly
VisioForge.Core.dll

Pushes H264 encoded byte-stream data into a pipeline for decoding. Connect output to H264DecoderBlock -> VideoRenderer; the block parses internally, so an H264ParseBlock in between is optional. Automatically converts AVC (length-prefixed) format to Annex B byte-stream. Rebases PTS timestamps relative to the first frame for proper pipeline clock alignment. Data may be pushed as whole frames or one NAL unit at a time; the output is always whole frames. A frame leaves the block once the next frame starts arriving; the last one, on VisioForge.Core.MediaBlocks.Sources.H264PushSourceBlock.SendEOS.

public class H264PushSourceBlock : MediaBlock, IMediaBlock, IDisposable, IMediaBlockInternals

Inheritance

Implements

Inherited Members

Extension Methods

Constructors

H264PushSourceBlock()

Initializes a new instance of the VisioForge.Core.MediaBlocks.Sources.H264PushSourceBlock class.

public H264PushSourceBlock()

Properties

DoTimestamp

Gets or sets whether appsrc should auto-generate timestamps using the pipeline clock. When true, PTS from PushData is ignored and appsrc stamps buffers with current pipeline time. This gives lowest display latency but breaks A/V sync if audio is added. When false (default), the PTS provided to PushData is used (rebased to pipeline time). Must be set before Build() / pipeline start.

public bool DoTimestamp { get; set; }

Property Value

bool

Input

Gets the input pad (none for source blocks).

public override MediaBlockPad Input { get; }

Property Value

MediaBlockPad

InputFormat

Gets or sets the format of the pushed data. VisioForge.Core.MediaBlocks.Sources.H264InputFormat.Auto (default) detects it.

public H264InputFormat InputFormat { get; set; }

Property Value

H264InputFormat

Inputs

Gets the input pads (none for source blocks).

public override MediaBlockPad[] Inputs { get; }

Property Value

MediaBlockPad[]

Output

Gets the output pad.

public override MediaBlockPad Output { get; }

Property Value

MediaBlockPad

Outputs

Gets the output pads.

public override MediaBlockPad[] Outputs { get; }

Property Value

MediaBlockPad[]

Type

Gets the type of the media block.

public override MediaBlockType Type { get; }

Property Value

MediaBlockType

Methods

Build()

Builds the block, creating GStreamer elements.

public override bool Build()

Returns

bool

CleanUp()

Cleans up resources.

public void CleanUp()

Dispose(bool)

Releases unmanaged and managed resources.

protected override void Dispose(bool disposing)

Parameters

disposing bool

GetCore()

Gets the core BaseElement wrapper (not used).

public BaseElement GetCore()

Returns

BaseElement

GetElement()

Gets the underlying GStreamer element.

public Element GetElement()

Returns

Element

IsAvailable()

Determines whether this element is available.

public static bool IsAvailable()

Returns

bool

PushData(byte[], int, TimeSpan)

Push H264 encoded data into the pipeline with timestamp. AVC (length-prefixed) data is converted to byte-stream (Annex B start codes) in place, as VisioForge.Core.MediaBlocks.Sources.H264PushSourceBlock.InputFormat states or detects. PTS is rebased relative to the first frame to align with the pipeline clock.

public FlowReturn PushData(byte[] data, int length, TimeSpan timestamp)

Parameters

data byte[]

H264 data (AVC length-prefixed or byte-stream).

length int

Length of data to push.

timestamp TimeSpan

Presentation timestamp.

Returns

FlowReturn

GStreamer FlowReturn status.

PushData(byte[], int)

Push H264 encoded data into the pipeline (no timestamp).

public FlowReturn PushData(byte[] data, int length)

Parameters

data byte[]

H264 data (AVC length-prefixed or byte-stream, see VisioForge.Core.MediaBlocks.Sources.H264PushSourceBlock.InputFormat).

length int

Length of data to push.

Returns

FlowReturn

GStreamer FlowReturn status.

SendEOS()

Signal end of stream.

public FlowReturn SendEOS()

Returns

FlowReturn

GStreamer FlowReturn status.

IMediaBlockInternals.SetContext(MediaBlocksPipeline)

Sets the pipeline context.

void IMediaBlockInternals.SetContext(MediaBlocksPipeline pipeline)

Parameters

pipeline MediaBlocksPipeline