github.com/bluenviron/mediacommon@v1.9.3/pkg/codecs/h265/nalu_type.go (about) 1 package h265 2 3 import ( 4 "fmt" 5 ) 6 7 // NALUType is the type of a NALU. 8 // Specification: ITU-T Rec. H.265, Table 7-1 9 type NALUType uint8 10 11 // NALU types. 12 const ( 13 NALUType_TRAIL_N NALUType = 0 //nolint:revive 14 NALUType_TRAIL_R NALUType = 1 //nolint:revive 15 NALUType_TSA_N NALUType = 2 //nolint:revive 16 NALUType_TSA_R NALUType = 3 //nolint:revive 17 NALUType_STSA_N NALUType = 4 //nolint:revive 18 NALUType_STSA_R NALUType = 5 //nolint:revive 19 NALUType_RADL_N NALUType = 6 //nolint:revive 20 NALUType_RADL_R NALUType = 7 //nolint:revive 21 NALUType_RASL_N NALUType = 8 //nolint:revive 22 NALUType_RASL_R NALUType = 9 //nolint:revive 23 NALUType_RSV_VCL_N10 NALUType = 10 //nolint:revive 24 NALUType_RSV_VCL_N12 NALUType = 12 //nolint:revive 25 NALUType_RSV_VCL_N14 NALUType = 14 //nolint:revive 26 NALUType_RSV_VCL_R11 NALUType = 11 //nolint:revive 27 NALUType_RSV_VCL_R13 NALUType = 13 //nolint:revive 28 NALUType_RSV_VCL_R15 NALUType = 15 //nolint:revive 29 NALUType_BLA_W_LP NALUType = 16 //nolint:revive 30 NALUType_BLA_W_RADL NALUType = 17 //nolint:revive 31 NALUType_BLA_N_LP NALUType = 18 //nolint:revive 32 NALUType_IDR_W_RADL NALUType = 19 //nolint:revive 33 NALUType_IDR_N_LP NALUType = 20 //nolint:revive 34 NALUType_CRA_NUT NALUType = 21 //nolint:revive 35 NALUType_RSV_IRAP_VCL22 NALUType = 22 //nolint:revive 36 NALUType_RSV_IRAP_VCL23 NALUType = 23 //nolint:revive 37 NALUType_VPS_NUT NALUType = 32 //nolint:revive 38 NALUType_SPS_NUT NALUType = 33 //nolint:revive 39 NALUType_PPS_NUT NALUType = 34 //nolint:revive 40 NALUType_AUD_NUT NALUType = 35 //nolint:revive 41 NALUType_EOS_NUT NALUType = 36 //nolint:revive 42 NALUType_EOB_NUT NALUType = 37 //nolint:revive 43 NALUType_FD_NUT NALUType = 38 //nolint:revive 44 NALUType_PREFIX_SEI_NUT NALUType = 39 //nolint:revive 45 NALUType_SUFFIX_SEI_NUT NALUType = 40 //nolint:revive 46 47 // additional NALU types for RTP/H265 48 NALUType_AggregationUnit NALUType = 48 //nolint:revive 49 NALUType_FragmentationUnit NALUType = 49 //nolint:revive 50 NALUType_PACI NALUType = 50 //nolint:revive 51 ) 52 53 var naluTypeLabels = map[NALUType]string{ 54 NALUType_TRAIL_N: "TRAIL_N", 55 NALUType_TRAIL_R: "TRAIL_R", 56 NALUType_TSA_N: "TSA_N", 57 NALUType_TSA_R: "TSA_R", 58 NALUType_STSA_N: "STSA_N", 59 NALUType_STSA_R: "STSA_R:", 60 NALUType_RADL_N: "RADL_N", 61 NALUType_RADL_R: "RADL_R", 62 NALUType_RASL_N: "RASL_N", 63 NALUType_RASL_R: "RASL_R", 64 NALUType_RSV_VCL_N10: "RSV_VCL_N10", 65 NALUType_RSV_VCL_N12: "RSV_VCL_N12", 66 NALUType_RSV_VCL_N14: "RSV_VCL_N14", 67 NALUType_RSV_VCL_R11: "RSV_VCL_R11", 68 NALUType_RSV_VCL_R13: "RSV_VCL_R13", 69 NALUType_RSV_VCL_R15: "RSV_VCL_R15", 70 NALUType_BLA_W_LP: "BLA_W_LP", 71 NALUType_BLA_W_RADL: "BLA_W_RADL", 72 NALUType_BLA_N_LP: "BLA_N_LP", 73 NALUType_IDR_W_RADL: "IDR_W_RADL", 74 NALUType_IDR_N_LP: "IDR_N_LP", 75 NALUType_CRA_NUT: "CRA_NUT", 76 NALUType_RSV_IRAP_VCL22: "RSV_IRAP_VCL22", 77 NALUType_RSV_IRAP_VCL23: "RSV_IRAP_VCL23", 78 NALUType_VPS_NUT: "VPS_NUT", 79 NALUType_SPS_NUT: "SPS_NUT", 80 NALUType_PPS_NUT: "PPS_NUT", 81 NALUType_AUD_NUT: "AUD_NUT", 82 NALUType_EOS_NUT: "EOS_NUT", 83 NALUType_EOB_NUT: "EOB_NUT", 84 NALUType_FD_NUT: "FD_NUT", 85 NALUType_PREFIX_SEI_NUT: "PrefixSEINUT", 86 NALUType_SUFFIX_SEI_NUT: "SuffixSEINUT", 87 88 // additional NALU types for RTP/H265 89 NALUType_AggregationUnit: "AggregationUnit", 90 NALUType_FragmentationUnit: "FragmentationUnit", 91 NALUType_PACI: "PACI", 92 } 93 94 // String implements fmt.Stringer. 95 func (nt NALUType) String() string { 96 if l, ok := naluTypeLabels[nt]; ok { 97 return l 98 } 99 return fmt.Sprintf("unknown (%d)", nt) 100 }