xref: /aosp_15_r20/external/webrtc/api/video_codecs/bitstream_parser.h (revision d9f758449e529ab9291ac668be2861e7a55c2422)
1 /*
2  *  Copyright (c) 2019 The WebRTC project authors. All Rights Reserved.
3  *
4  *  Use of this source code is governed by a BSD-style license
5  *  that can be found in the LICENSE file in the root of the source
6  *  tree. An additional intellectual property rights grant can be found
7  *  in the file PATENTS.  All contributing project authors may
8  *  be found in the AUTHORS file in the root of the source tree.
9  */
10 
11 #ifndef API_VIDEO_CODECS_BITSTREAM_PARSER_H_
12 #define API_VIDEO_CODECS_BITSTREAM_PARSER_H_
13 
14 #include <stddef.h>
15 #include <stdint.h>
16 
17 #include "absl/types/optional.h"
18 #include "api/array_view.h"
19 
20 namespace webrtc {
21 
22 // This class is an interface for bitstream parsers.
23 class BitstreamParser {
24  public:
25   virtual ~BitstreamParser() = default;
26 
27   // Parse an additional chunk of the bitstream.
28   virtual void ParseBitstream(rtc::ArrayView<const uint8_t> bitstream) = 0;
29 
30   // Get the last extracted QP value from the parsed bitstream. If no QP
31   // value could be parsed, returns absl::nullopt.
32   virtual absl::optional<int> GetLastSliceQp() const = 0;
33 };
34 
35 }  // namespace webrtc
36 
37 #endif  // API_VIDEO_CODECS_BITSTREAM_PARSER_H_
38