webrtc_m130/common_video/h265/h265_vps_parser.h
qwu16 972f28335a Added HEVC parser for WebRTC
This is part of effort to enable HEVC for WebRTC. Parser added here to support parsing of QP/picture size for bitstream, for dynamic adaptation and stream metadata abstraction.

Bug: webrtc:13485
Change-Id: I2fbdf210e72e77989ca87ce285da174df5bedd5c
Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/298421
Reviewed-by: Sergey Silkin <ssilkin@webrtc.org>
Reviewed-by: Philip Eliasson <philipel@webrtc.org>
Reviewed-by: Erik Språng <sprang@webrtc.org>
Reviewed-by: Mirko Bonadei <mbonadei@webrtc.org>
Commit-Queue: Sergey Silkin <ssilkin@webrtc.org>
Cr-Commit-Position: refs/heads/main@{#40572}
2023-08-18 17:48:11 +00:00

42 lines
1.3 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 "absl/types/optional.h"
#include "api/array_view.h"
namespace webrtc {
// A class for parsing out video parameter set (VPS) data from an H265 NALU.
class H265VpsParser {
public:
// The parsed state of the VPS. Only some select values are stored.
// Add more as they are actually needed.
struct VpsState {
VpsState();
uint32_t id = 0;
};
// Unpack RBSP and parse VPS state from the supplied buffer.
static absl::optional<VpsState> ParseVps(const uint8_t* data, size_t length);
protected:
// Parse the VPS state, for a bit buffer where RBSP decoding has already been
// performed.
static absl::optional<VpsState> ParseInternal(
rtc::ArrayView<const uint8_t> buffer);
};
} // namespace webrtc
#endif // COMMON_VIDEO_H265_H265_VPS_PARSER_H_