tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

h265_vps_parser.h (1601B)


      1 /*
      2 *  Copyright (c) 2023 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 COMMON_VIDEO_H265_H265_VPS_PARSER_H_
     12 #define COMMON_VIDEO_H265_H265_VPS_PARSER_H_
     13 
     14 #include <cstddef>
     15 #include <cstdint>
     16 #include <optional>
     17 
     18 #include "api/array_view.h"
     19 #include "rtc_base/system/rtc_export.h"
     20 
     21 namespace webrtc {
     22 
     23 // A class for parsing out video parameter set (VPS) data from an H265 NALU.
     24 class RTC_EXPORT H265VpsParser {
     25 public:
     26  // The parsed state of the VPS. Only some select values are stored.
     27  // Add more as they are actually needed.
     28  struct RTC_EXPORT VpsState {
     29    VpsState();
     30 
     31    uint32_t id = 0;
     32  };
     33 
     34  // Unpack RBSP and parse VPS state from the supplied buffer.
     35  static std::optional<VpsState> ParseVps(ArrayView<const uint8_t> data);
     36  // TODO: bugs.webrtc.org/42225170 - Deprecate.
     37  static inline std::optional<VpsState> ParseVps(const uint8_t* data,
     38                                                 size_t length) {
     39    return ParseVps(MakeArrayView(data, length));
     40  }
     41 
     42 protected:
     43  // Parse the VPS state, for a bit buffer where RBSP decoding has already been
     44  // performed.
     45  static std::optional<VpsState> ParseInternal(ArrayView<const uint8_t> buffer);
     46 };
     47 
     48 }  // namespace webrtc
     49 #endif  // COMMON_VIDEO_H265_H265_VPS_PARSER_H_