github.com/pion/webrtc/v3@v3.2.24/pkg/media/h264reader/nalunittype.go (about)

     1  // SPDX-FileCopyrightText: 2023 The Pion community <https://pion.ly>
     2  // SPDX-License-Identifier: MIT
     3  
     4  package h264reader
     5  
     6  import "strconv"
     7  
     8  // NalUnitType is the type of a NAL
     9  type NalUnitType uint8
    10  
    11  // Enums for NalUnitTypes
    12  const (
    13  	NalUnitTypeUnspecified              NalUnitType = 0  // Unspecified
    14  	NalUnitTypeCodedSliceNonIdr         NalUnitType = 1  // Coded slice of a non-IDR picture
    15  	NalUnitTypeCodedSliceDataPartitionA NalUnitType = 2  // Coded slice data partition A
    16  	NalUnitTypeCodedSliceDataPartitionB NalUnitType = 3  // Coded slice data partition B
    17  	NalUnitTypeCodedSliceDataPartitionC NalUnitType = 4  // Coded slice data partition C
    18  	NalUnitTypeCodedSliceIdr            NalUnitType = 5  // Coded slice of an IDR picture
    19  	NalUnitTypeSEI                      NalUnitType = 6  // Supplemental enhancement information (SEI)
    20  	NalUnitTypeSPS                      NalUnitType = 7  // Sequence parameter set
    21  	NalUnitTypePPS                      NalUnitType = 8  // Picture parameter set
    22  	NalUnitTypeAUD                      NalUnitType = 9  // Access unit delimiter
    23  	NalUnitTypeEndOfSequence            NalUnitType = 10 // End of sequence
    24  	NalUnitTypeEndOfStream              NalUnitType = 11 // End of stream
    25  	NalUnitTypeFiller                   NalUnitType = 12 // Filler data
    26  	NalUnitTypeSpsExt                   NalUnitType = 13 // Sequence parameter set extension
    27  	NalUnitTypeCodedSliceAux            NalUnitType = 19 // Coded slice of an auxiliary coded picture without partitioning
    28  	// 14..18                                            // Reserved
    29  	// 20..23                                            // Reserved
    30  	// 24..31                                            // Unspecified
    31  )
    32  
    33  func (n *NalUnitType) String() string {
    34  	var str string
    35  	switch *n {
    36  	case NalUnitTypeUnspecified:
    37  		str = "Unspecified"
    38  	case NalUnitTypeCodedSliceNonIdr:
    39  		str = "CodedSliceNonIdr"
    40  	case NalUnitTypeCodedSliceDataPartitionA:
    41  		str = "CodedSliceDataPartitionA"
    42  	case NalUnitTypeCodedSliceDataPartitionB:
    43  		str = "CodedSliceDataPartitionB"
    44  	case NalUnitTypeCodedSliceDataPartitionC:
    45  		str = "CodedSliceDataPartitionC"
    46  	case NalUnitTypeCodedSliceIdr:
    47  		str = "CodedSliceIdr"
    48  	case NalUnitTypeSEI:
    49  		str = "SEI"
    50  	case NalUnitTypeSPS:
    51  		str = "SPS"
    52  	case NalUnitTypePPS:
    53  		str = "PPS"
    54  	case NalUnitTypeAUD:
    55  		str = "AUD"
    56  	case NalUnitTypeEndOfSequence:
    57  		str = "EndOfSequence"
    58  	case NalUnitTypeEndOfStream:
    59  		str = "EndOfStream"
    60  	case NalUnitTypeFiller:
    61  		str = "Filler"
    62  	case NalUnitTypeSpsExt:
    63  		str = "SpsExt"
    64  	case NalUnitTypeCodedSliceAux:
    65  		str = "NalUnitTypeCodedSliceAux"
    66  	default:
    67  		str = "Unknown"
    68  	}
    69  	str = str + "(" + strconv.FormatInt(int64(*n), 10) + ")"
    70  	return str
    71  }