Class Nalu
An H265 Network Abstraction Layer Unit.
Inheritance
Inherited Members
Namespace: FM.LiveSwitch.H265
Assembly: FM.LiveSwitch.dll
Syntax
public class Nalu
  Constructors
Nalu()
Creates an empty NAL Unit.
Declaration
public Nalu()
  Nalu(DataBuffer)
Creates a NAL Unit from a byte array.
Declaration
public Nalu(DataBuffer naluBytes)
  Parameters
| Type | Name | Description | 
|---|---|---|
| DataBuffer | naluBytes | The NALU bytes.  | 
      
Properties
Buffer
Gets the backing DataBuffer.
Declaration
public DataBuffer Buffer { get; }
  Property Value
| Type | Description | 
|---|---|
| DataBuffer | 
FBit
Gets the forbidden Zero Bit. The H.265 specification declares a value of 1 as a syntax violation.
Declaration
public bool FBit { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
FBitMask
Gets the forbidden zero bit mask.
Declaration
public static int FBitMask { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
FirstSliceSegmentInPicFlag
Gets the first_slice_segment_in_pic_flag
Declaration
protected bool FirstSliceSegmentInPicFlag { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Boolean | 
LayerId
Gets the LayerId: 6bits otherwise known as nuh_layer_id.
Declaration
public int LayerId { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
LayerIdMask
Gets the Layer Id (nuh_layer_id) mask.
Declaration
public static int LayerIdMask { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
Payload
Gets the NAL payload.
Declaration
public DataBuffer Payload { get; }
  Property Value
| Type | Description | 
|---|---|
| DataBuffer | 
ShortLength
Gets the size of the NAL Unit (including NAL header) in two octets stored in the returned byte array. Useful for creating H265 aggregation packets.
Declaration
public DataBuffer ShortLength { get; }
  Property Value
| Type | Description | 
|---|---|
| DataBuffer | 
StartCode
Gets the 4-byte NALU start code.
Declaration
public static DataBuffer StartCode { get; }
  Property Value
| Type | Description | 
|---|---|
| DataBuffer | 
Tid
Gets the TID: 3bits otherwise known as nuh_temporal_plus1.
Declaration
public int Tid { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
TidMask
Gets the TID (nuh_temporal_id_plus1) mask.
Declaration
public static int TidMask { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
Type
Gets the NAL Unit Type.
Declaration
public int Type { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
TypeMask
Gets the NAL Unit Type (nal_unit_type) mask.
Declaration
public static int TypeMask { get; }
  Property Value
| Type | Description | 
|---|---|
| System.Int32 | 
Methods
FindNalu(DataBuffer)
Scans for the index of the first NAL Unit after start.
Declaration
public static int FindNalu(DataBuffer encodedData)
  Parameters
| Type | Name | Description | 
|---|---|---|
| DataBuffer | encodedData | The stream to search.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Int32 | 
FindNextNalu(DataBuffer, Int32)
Scans for the index of the first NAL Unit after start.
Declaration
public static int FindNextNalu(DataBuffer encodedData, int start)
  Parameters
| Type | Name | Description | 
|---|---|---|
| DataBuffer | encodedData | The stream to search.  | 
      
| System.Int32 | start | The index to start searching from.  | 
      
Returns
| Type | Description | 
|---|---|
| System.Int32 | 
GetBytes()
Gets the NAL Unit as a byte array that can be passed to an encoder (includes Start Code).
Declaration
public DataBuffer GetBytes()
  Returns
| Type | Description | 
|---|---|
| DataBuffer | 
GetNalu(DataBuffer)
Returns the first NAL unit after nalStart.
Declaration
public static Nalu GetNalu(DataBuffer encodedData)
  Parameters
| Type | Name | Description | 
|---|---|---|
| DataBuffer | encodedData | The byte array to search.  | 
      
Returns
| Type | Description | 
|---|---|
| Nalu | 
GetNalu(DataBuffer, Int32, out Int32)
Returns the first NAL unit after nalStart.
Declaration
public static Nalu GetNalu(DataBuffer encodedData, int nalStart, out int nextStartCodeLength)
  Parameters
| Type | Name | Description | 
|---|---|---|
| DataBuffer | encodedData | The byte array to search.  | 
      
| System.Int32 | nalStart | The start index of the NAL.  | 
      
| System.Int32 | nextStartCodeLength | OUT The length of the next the NAL startcode.  | 
      
Returns
| Type | Description | 
|---|---|
| Nalu |