diff --git a/common_video/h265/h265_bitstream_parser.cc b/common_video/h265/h265_bitstream_parser.cc index 9247d5d272..9b95d12e43 100644 --- a/common_video/h265/h265_bitstream_parser.cc +++ b/common_video/h265/h265_bitstream_parser.cc @@ -542,4 +542,13 @@ absl::optional H265BitstreamParser::GetLastSliceQp() const { return parsed_qp; } +absl::optional 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 3c0883c7a1..48f27ef2e7 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 @@ class H265BitstreamParser : public BitstreamParser { void ParseBitstream(rtc::ArrayView bitstream) override; absl::optional GetLastSliceQp() const override; + absl::optional GetLastSlicePpsId() const; + static absl::optional 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 d32de7f059..b9186dcd2e 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 @@ struct NaluIndex { }; // Returns a vector of the NALU indices in the given buffer. -std::vector FindNaluIndices(const uint8_t* buffer, - size_t buffer_size); +RTC_EXPORT std::vector 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 625869d8d5..62bc18fe6b 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 854c0f29eb..7ec170671d 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 @@ enum H265ProfileIdc { }; // 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 @@ class H265SpsParser { // 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 @@ class H265SpsParser { // performed. static absl::optional ParseSpsInternal( rtc::ArrayView 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 e391d47401..c793996bc1 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;