Export h.265 bitstream parser APIs. This exports neccessary API as dependency for h.265 parameter sets tracker to be submitted at CL:5307256. Bug: webrtc:13485 Change-Id: I042599472f17d12ece4fa862c3715497502a5d76 Reviewed-on: https://webrtc-review.googlesource.com/c/src/+/340004 Reviewed-by: Erik Språng <sprang@webrtc.org> Commit-Queue: Jianlin Qiu <jianlin.qiu@intel.com> Cr-Commit-Position: refs/heads/main@{#41814}
diff --git a/common_video/h265/h265_bitstream_parser.cc b/common_video/h265/h265_bitstream_parser.cc index 9247d5d..9b95d12 100644 --- a/common_video/h265/h265_bitstream_parser.cc +++ b/common_video/h265/h265_bitstream_parser.cc
@@ -542,4 +542,13 @@ return parsed_qp; } +absl::optional<uint32_t> H265BitstreamParser::GetLastSlicePpsId() const { + if (!last_slice_pps_id_) { + RTC_LOG(LS_ERROR) << "Failed to parse PPS id from bitstream."; + return absl::nullopt; + } + + return last_slice_pps_id_; +} + } // namespace webrtc
diff --git a/common_video/h265/h265_bitstream_parser.h b/common_video/h265/h265_bitstream_parser.h index 3c0883c..48f27ef 100644 --- a/common_video/h265/h265_bitstream_parser.h +++ b/common_video/h265/h265_bitstream_parser.h
@@ -22,12 +22,13 @@ #include "common_video/h265/h265_sps_parser.h" #include "common_video/h265/h265_vps_parser.h" #include "rtc_base/containers/flat_map.h" +#include "rtc_base/system/rtc_export.h" namespace webrtc { // Stateful H265 bitstream parser (due to VPS/SPS/PPS). Used to parse out QP // values from the bitstream. -class H265BitstreamParser : public BitstreamParser { +class RTC_EXPORT H265BitstreamParser : public BitstreamParser { public: H265BitstreamParser(); ~H265BitstreamParser() override; @@ -36,6 +37,8 @@ void ParseBitstream(rtc::ArrayView<const uint8_t> bitstream) override; absl::optional<int> GetLastSliceQp() const override; + absl::optional<uint32_t> GetLastSlicePpsId() const; + static absl::optional<uint32_t> ParsePpsIdFromSliceSegmentLayerRbsp( const uint8_t* data, size_t length,
diff --git a/common_video/h265/h265_common.h b/common_video/h265/h265_common.h index d32de7f..b9186dc 100644 --- a/common_video/h265/h265_common.h +++ b/common_video/h265/h265_common.h
@@ -16,6 +16,7 @@ #include "common_video/h265/h265_inline.h" #include "rtc_base/buffer.h" +#include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -76,11 +77,11 @@ }; // Returns a vector of the NALU indices in the given buffer. -std::vector<NaluIndex> FindNaluIndices(const uint8_t* buffer, - size_t buffer_size); +RTC_EXPORT std::vector<NaluIndex> FindNaluIndices(const uint8_t* buffer, + size_t buffer_size); // Get the NAL type from the header byte immediately following start sequence. -NaluType ParseNaluType(uint8_t data); +RTC_EXPORT NaluType ParseNaluType(uint8_t data); // Methods for parsing and writing RBSP. See section 7.4.2 of the H.265 spec. //
diff --git a/common_video/h265/h265_pps_parser.h b/common_video/h265/h265_pps_parser.h index 625869d..62bc18f 100644 --- a/common_video/h265/h265_pps_parser.h +++ b/common_video/h265/h265_pps_parser.h
@@ -15,11 +15,12 @@ #include "api/array_view.h" #include "common_video/h265/h265_sps_parser.h" #include "rtc_base/bitstream_reader.h" +#include "rtc_base/system/rtc_export.h" namespace webrtc { // A class for parsing out picture parameter set (PPS) data from a H265 NALU. -class H265PpsParser { +class RTC_EXPORT H265PpsParser { public: // The parsed state of the PPS. Only some select values are stored. // Add more as they are actually needed.
diff --git a/common_video/h265/h265_sps_parser.h b/common_video/h265/h265_sps_parser.h index 854c0f2..7ec1706 100644 --- a/common_video/h265/h265_sps_parser.h +++ b/common_video/h265/h265_sps_parser.h
@@ -16,6 +16,7 @@ #include "absl/types/optional.h" #include "api/array_view.h" #include "rtc_base/bitstream_reader.h" +#include "rtc_base/system/rtc_export.h" namespace webrtc { @@ -42,7 +43,7 @@ }; // A class for parsing out sequence parameter set (SPS) data from an H265 NALU. -class H265SpsParser { +class RTC_EXPORT H265SpsParser { public: struct ProfileTierLevel { ProfileTierLevel(); @@ -74,7 +75,7 @@ // The parsed state of the SPS. Only some select values are stored. // Add more as they are actually needed. - struct SpsState { + struct RTC_EXPORT SpsState { SpsState() = default; uint32_t sps_max_sub_layers_minus1 = 0; @@ -124,8 +125,6 @@ // performed. static absl::optional<SpsState> ParseSpsInternal( rtc::ArrayView<const uint8_t> buffer); - static bool ParseProfileTierLevel(BitstreamReader& reader, - uint32_t sps_max_sub_layers_minus1); // From Table A.8 - General tier and level limits. static int GetMaxLumaPs(int general_level_idc);
diff --git a/common_video/h265/h265_vps_parser.h b/common_video/h265/h265_vps_parser.h index e391d47..c793996 100644 --- a/common_video/h265/h265_vps_parser.h +++ b/common_video/h265/h265_vps_parser.h
@@ -13,15 +13,16 @@ #include "absl/types/optional.h" #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 H265VpsParser { +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 VpsState { + struct RTC_EXPORT VpsState { VpsState(); uint32_t id = 0;