webrtc_m130/common_video/h265/h265_vps_parser.h
Florent Castelli 8037fc6ffa Migrate absl::optional to std::optional
Bug: webrtc:342905193
No-Try: True
Change-Id: Icc968be43b8830038ea9a1f5f604307220457807
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/361021
Auto-Submit: Florent Castelli <orphis@webrtc.org>
Reviewed-by: Harald Alvestrand <hta@webrtc.org>
Commit-Queue: Florent Castelli <orphis@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#42911}
2024-09-02 12:16:47 +00:00

49 lines
1.5 KiB
C++

/*
* Copyright (c) 2023 The WebRTC project authors. All Rights Reserved.
*
* Use of this source code is governed by a BSD-style license
* that can be found in the LICENSE file in the root of the source
* tree. An additional intellectual property rights grant can be found
* in the file PATENTS. All contributing project authors may
* be found in the AUTHORS file in the root of the source tree.
*/
#ifndef COMMON_VIDEO_H265_H265_VPS_PARSER_H_
#define COMMON_VIDEO_H265_H265_VPS_PARSER_H_
#include <optional>
#include "api/array_view.h"
#include "rtc_base/system/rtc_export.h"
namespace webrtc {
// A class for parsing out video parameter set (VPS) data from an H265 NALU.
class RTC_EXPORT H265VpsParser {
public:
// The parsed state of the VPS. Only some select values are stored.
// Add more as they are actually needed.
struct RTC_EXPORT VpsState {
VpsState();
uint32_t id = 0;
};
// Unpack RBSP and parse VPS state from the supplied buffer.
static std::optional<VpsState> ParseVps(rtc::ArrayView<const uint8_t> data);
// TODO: bugs.webrtc.org/42225170 - Deprecate.
static inline std::optional<VpsState> ParseVps(const uint8_t* data,
size_t length) {
return ParseVps(rtc::MakeArrayView(data, length));
}
protected:
// Parse the VPS state, for a bit buffer where RBSP decoding has already been
// performed.
static std::optional<VpsState> ParseInternal(
rtc::ArrayView<const uint8_t> buffer);
};
} // namespace webrtc
#endif // COMMON_VIDEO_H265_H265_VPS_PARSER_H_