scuffle_h265/enums/
nal_unit_type.rs

1use nutype_enum::nutype_enum;
2
3nutype_enum! {
4    /// NAL (Network Abstraction Layer) unit types as defined by ISO/IEC 23008-2 Table 7-1.
5    pub enum NALUnitType(u8) {
6        /// Coded slice segment of a non-TSA, non-STSA trailing picture
7        ///
8        /// NAL unit type class: VCL
9        TrailN = 0,
10        /// Coded slice segment of a non-TSA, non-STSA trailing picture
11        ///
12        /// NAL unit type class: VCL
13        TrailR = 1,
14        /// Coded slice segment of a TSA picture
15        ///
16        /// NAL unit type class: VCL
17        TsaN = 2,
18        /// Coded slice segment of a TSA picture
19        ///
20        /// NAL unit type class: VCL
21        TsaR = 3,
22        /// Coded slice segment of an STSA picture
23        ///
24        /// NAL unit type class: VCL
25        StsaN = 4,
26        /// Coded slice segment of an STSA picture
27        ///
28        /// NAL unit type class: VCL
29        StsaR = 5,
30        /// Coded slice segment of a RADL picture
31        ///
32        /// NAL unit type class: VCL
33        RadlN = 6,
34        /// Coded slice segment of a RADL picture
35        ///
36        /// NAL unit type class: VCL
37        RadlR = 7,
38        /// Coded slice segment of a RASL picture
39        ///
40        /// NAL unit type class: VCL
41        RaslN = 8,
42        /// Coded slice segment of a RASL picture
43        ///
44        /// NAL unit type class: VCL
45        RaslR = 9,
46        /// Reserved non-IRAP SLNR VCL NAL unit types
47        ///
48        /// NAL unit type class: VCL
49        RsvVclN10 = 10,
50        /// Reserved non-IRAP sub-layer reference VCL NAL unit types
51        ///
52        /// NAL unit type class: VCL
53        RsvVclR11 = 11,
54        /// Reserved non-IRAP SLNR VCL NAL unit types
55        ///
56        /// NAL unit type class: VCL
57        RsvVclN12 = 12,
58        /// Reserved non-IRAP sub-layer reference VCL NAL unit types
59        ///
60        /// NAL unit type class: VCL
61        RsvVclR13 = 13,
62        /// Reserved non-IRAP SLNR VCL NAL unit types
63        ///
64        /// NAL unit type class: VCL
65        RsvVclN14 = 14,
66        /// Reserved non-IRAP sub-layer reference VCL NAL unit types
67        ///
68        /// NAL unit type class: VCL
69        RsvVclR15 = 15,
70        /// Coded slice segment of a BLA picture
71        ///
72        /// NAL unit type class: VCL
73        BlaWLp = 16,
74        /// Coded slice segment of a BLA picture
75        ///
76        /// NAL unit type class: VCL
77        BlaWRadl = 17,
78        /// Coded slice segment of a BLA picture
79        ///
80        /// NAL unit type class: VCL
81        BlaNLp = 18,
82        /// Coded slice segment of an IDR picture
83        ///
84        /// NAL unit type class: VCL
85        IdrWRadl = 19,
86        /// Coded slice segment of an IDR picture
87        ///
88        /// NAL unit type class: VCL
89        IdrNLp = 20,
90        /// Coded slice segment of a CRA picture
91        ///
92        /// NAL unit type class: VCL
93        CraNut = 21,
94        /// Reserved IRAP VCL NAL unit types
95        ///
96        /// NAL unit type class: VCL
97        RsvIrapVcl22 = 22,
98        /// Reserved IRAP VCL NAL unit types
99        ///
100        /// NAL unit type class: VCL
101        RsvIrapVcl23 = 23,
102        /// Reserved non-IRAP VCL NAL unit types
103        ///
104        /// NAL unit type class: VCL
105        RsvVcl24 = 24,
106        /// Reserved non-IRAP VCL NAL unit types
107        ///
108        /// NAL unit type class: VCL
109        RsvVcl25 = 25,
110        /// Reserved non-IRAP VCL NAL unit types
111        ///
112        /// NAL unit type class: VCL
113        RsvVcl26 = 26,
114        /// Reserved non-IRAP VCL NAL unit types
115        ///
116        /// NAL unit type class: VCL
117        RsvVcl27 = 27,
118        /// Reserved non-IRAP VCL NAL unit types
119        ///
120        /// NAL unit type class: VCL
121        RsvVcl28 = 28,
122        /// Reserved non-IRAP VCL NAL unit types
123        ///
124        /// NAL unit type class: VCL
125        RsvVcl29 = 29,
126        /// Reserved non-IRAP VCL NAL unit types
127        ///
128        /// NAL unit type class: VCL
129        RsvVcl30 = 30,
130        /// Reserved non-IRAP VCL NAL unit types
131        ///
132        /// NAL unit type class: VCL
133        RsvVcl31 = 31,
134        /// Video parameter set
135        ///
136        /// NAL unit type class: non-VCL
137        VpsNut = 32,
138        /// Sequence parameter set
139        ///
140        /// NAL unit type class: non-VCL
141        SpsNut = 33,
142        /// Picture parameter set
143        ///
144        /// NAL unit type class: non-VCL
145        PpsNut = 34,
146        /// Access unit delimiter
147        ///
148        /// NAL unit type class: non-VCL
149        AudNut = 35,
150        /// End of sequence
151        ///
152        /// NAL unit type class: non-VCL
153        EosNut = 36,
154        /// End of bitstream
155        ///
156        /// NAL unit type class: non-VCL
157        EobNut = 37,
158        /// Filler data
159        ///
160        /// NAL unit type class: non-VCL
161        FdNut = 38,
162        /// Supplemental enhancement information
163        ///
164        /// NAL unit type class: non-VCL
165        PrefixSeiNut = 39,
166        /// Supplemental enhancement information
167        ///
168        /// NAL unit type class: non-VCL
169        SuffixSeiNut = 40,
170        /// Reserved
171        ///
172        /// NAL unit type class: non-VCL
173        RsvNvcl41 = 41,
174        /// Reserved
175        ///
176        /// NAL unit type class: non-VCL
177        RsvNvcl42 = 42,
178        /// Reserved
179        ///
180        /// NAL unit type class: non-VCL
181        RsvNvcl43 = 43,
182        /// Reserved
183        ///
184        /// NAL unit type class: non-VCL
185        RsvNvcl44 = 44,
186        /// Reserved
187        ///
188        /// NAL unit type class: non-VCL
189        RsvNvcl45 = 45,
190        /// Reserved
191        ///
192        /// NAL unit type class: non-VCL
193        RsvNvcl46 = 46,
194        /// Reserved
195        ///
196        /// NAL unit type class: non-VCL
197        RsvNvcl47 = 47,
198    }
199}
200
201impl NALUnitType {
202    /// Returns `true` if the NAL unit type class of this NAL unit type is VCL (Video Coding Layer).
203    ///
204    /// See ISO/IEC 23008-2 - Table 7-1, NAL unit type class column.
205    pub fn is_vcl(&self) -> bool {
206        (0..=31).contains(&self.0)
207    }
208}