Class Nalu
An H264 Network Abstraction Layer Unit.
Inheritance
Namespace: FM.LiveSwitch.H264
Assembly: FM.LiveSwitch.dll
Syntax
public class Nalu : object
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
BottomFieldFlag
Gets the bottom_field_flag.
Declaration
protected int BottomFieldFlag { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Buffer
Gets the backing DataBuffer.
Declaration
public DataBuffer Buffer { get; }
Property Value
Type | Description |
---|---|
DataBuffer |
DeltaPicOrderCnt
Gets the pic_order_cnt_lsb
Declaration
protected int[] DeltaPicOrderCnt { get; }
Property Value
Type | Description |
---|---|
System.Int32[] |
FBit
Gets the forbidden Zero Bit. The H.264 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 |
FieldPicFlag
Gets the field_pic_flag.
Declaration
protected int FieldPicFlag { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
FirstMbInSlice
Gets the first_mb_in_slice specifies the address of the first macroblock in the slice. When arbitrary slice order is not allowed as specified in Annex A, the value of first_mb_in_slice is constrained as follows: – If separate_colour_plane_flag is equal to 0, the value of first_mb_in_slice shall not be less than the value of first_mb_in_slice for any other slice of the current picture that precedes the current slice in decoding order. – Otherwise (separate_colour_plane_flag is equal to 1), the value of first_mb_in_slice shall not be less than the value of first_mb_in_slice for any other slice of the current picture that precedes the current slice in decoding order and has the same value of colour_plane_id.
Declaration
protected int FirstMbInSlice { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
FrameNum
Gets the frame_num: The Frame Number is used as an identifier for pictures and shall be represented by log2_max_frame_num_minus4 + 4 bits in the bitstream.
Declaration
protected int FrameNum { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Header
Gets the NAL header.
Declaration
public int Header { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IdrPicFlag
Gets the idr_pic_flag.
Declaration
protected int IdrPicFlag { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IdrPicId
Gets the idr_pic_id: The values of idr_pic_id in all the slices of an IDR picture shall remain unchanged. When two consecutive access units in decoding order are both IDR access units, the value of idr_pic_id in the slices of the first such IDR access unit shall differ from the idr_pic_id in the second such IDR access unit. The value of idr_pic_id shall be in the range of 0 to 65535, inclusive.
Declaration
protected int IdrPicId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NalRefIdc
Gets the NRI: 2bits otherwise known as nal_ref_idc.
Declaration
public int NalRefIdc { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
NriMask
Gets the nal_ref_idc mask.
Declaration
public static int NriMask { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
Payload
Gets or sets the NAL payload.
Declaration
public DataBuffer Payload { get; }
Property Value
Type | Description |
---|---|
DataBuffer |
PicOrderCntLsb
Gets the pic_order_cnt_lsb.
Declaration
protected int PicOrderCntLsb { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
PicOrderCntType
Gets the pic_order_cnt_type.
Declaration
protected int PicOrderCntType { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
PpsId
Gets the Picture Parameter Set specifies the picture parameter set in use. The value of pic_parameter_set_id shall be in the range of 0 to 255, inclusive.
Declaration
protected int PpsId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
ShortLength
Gets the size of the NAL Unit (including NAL header) in two octets stored in the returned byte array. Useful for creating certain types of H264 such as STAP.
Declaration
public DataBuffer ShortLength { get; }
Property Value
Type | Description |
---|---|
DataBuffer |
SliceType
Gets the type of Slice contained in this NAL.
Declaration
protected int SliceType { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
SpsId
Gets the Sequence Parameter Set this NAL references.
Declaration
protected int SpsId { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
StartCode
Gets the 4-byte NALU start code.
Declaration
public static DataBuffer StartCode { get; }
Property Value
Type | Description |
---|---|
DataBuffer |
Type
Gets the NAL Unit Type.
Declaration
public int Type { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
TypeMask
Gets the 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 |