scuffle_h264/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 14496-10:2022 (Table 7-1).
5    ///
6    /// ## Decoder Behavior:
7    /// - **Some NAL units may be ignored** depending on the decoder.
8    /// - Decoders using **Annex A** must ignore unit types **14, 15, and 20**.
9    /// - **Types 0 and 24-31** are application-specific and do not affect decoding.
10    /// - **Reserved values** should be ignored.
11    ///
12    /// ## IDR (Instantaneous Decoder Refresh) Pictures:
13    /// - If `nal_unit_type` is **5**, the picture **must not contain** types **1-4**.
14    /// - `IdrPicFlag` is **1** if `nal_unit_type == 5`, otherwise **0**.
15    pub enum NALUnitType(u8) {
16        /// Unspecified (not used in decoding)
17        Unspecified1 = 0,
18
19        /// Regular video slice (non-IDR picture)
20        NonIDRSliceLayerWithoutPartitioning = 1,
21
22        /// Coded slice data partition A
23        SliceDataPartitionALayer = 2,
24
25        /// Coded slice data partition B
26        SliceDataPartitionBLayer = 3,
27
28        /// Coded slice data partition C
29        SliceDataPartitionCLayer = 4,
30
31        /// IDR picture (used to refresh the video stream)
32        IDRSliceLayerWithoutPartitioning = 5,
33
34        /// Extra metadata (Supplemental Enhancement Information)
35        SEI = 6,
36
37        /// Sequence Parameter Set (SPS) – contains video configuration details
38        SPS = 7,
39
40        /// Picture Parameter Set (PPS) – contains picture-specific settings
41        PPS = 8,
42
43        /// Marks the start of a new access unit (frame boundary)
44        AccessUnitDelimiter = 9,
45
46        /// End of video sequence
47        EndOfSeq = 10,
48
49        /// End of video stream
50        EndOfStream = 11,
51
52        /// Extra filler data (can be ignored)
53        FillerData = 12,
54
55        /// Extension to SPS (used for advanced encoding features)
56        SPSExtension = 13,
57
58        /// Prefix NAL unit (ignored by Annex A decoders)
59        PrefixNalUnit = 14,
60
61        /// Subset of SPS (ignored by Annex A decoders)
62        SubsetSPS = 15,
63
64        /// Depth parameter set (used for 3D video)
65        DepthParameterSet = 16,
66
67        /// Reserved (should be ignored)
68        Reserved1 = 17,
69
70        /// Reserved (should be ignored)
71        Reserved2 = 18,
72
73        /// Auxiliary coded slice (may be ignored by some decoders)
74        AuxCodedPictureSliceLayerWithoutPartitioning = 19,
75
76        /// Additional slice data for extended coding (ignored by Annex A decoders)
77        SliceLayerExtension = 20,
78
79        /// Slice extension for depth/3D-AVC video (ignored by some decoders)
80        SliceLayerExtension2 = 21,
81
82        /// Reserved (should be ignored)
83        Reserved3 = 22,
84
85        /// Reserved (should be ignored)
86        Reserved4 = 23,
87
88        /// Unspecified (application-defined use)
89        Unspecified2 = 24
90    }
91}