xref: /aosp_15_r20/external/v4l2_codec2/common/include/v4l2_codec2/common/HEVCNalParser.h (revision 0ec5a0ec62797f775085659156625e7f1bdb369f)
1 // Copyright 2021 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4 
5 #ifndef ANDROID_V4L2_CODEC2_COMMON_HEVCNALPARSER_H
6 #define ANDROID_V4L2_CODEC2_COMMON_HEVCNALPARSER_H
7 
8 #include <stdint.h>
9 
10 #include <v4l2_codec2/common/NalParser.h>
11 
12 namespace android {
13 
14 // Helper class to parse HEVC NAL units from data.
15 class HEVCNalParser : public NalParser {
16 public:
17     // Type of a SPS NAL unit.
18     static constexpr uint8_t kIDRType = 19;  //IDR_W_RADL
19     static constexpr uint8_t kSPSType = 33;
20 
21     HEVCNalParser(const uint8_t* data, size_t length);
22     ~HEVCNalParser() = default;
23 
24     // Locate the sequence parameter set (SPS).
25     bool locateSPS() override;
26     bool locateIDR() override;
27 
28     // Get the type of the current NAL unit.
29     uint8_t type() const override;
30 
31     // Find the HEVC video's color aspects in the current SPS NAL.
32     bool findCodedColorAspects(ColorAspects* colorAspects) override;
33 };
34 
35 }  // namespace android
36 
37 #endif  // ANDROID_V4L2_CODEC2_COMMON_HEVCNALPARSER_H
38