1 /* 2 * Copyright (c) 2024, Alliance for Open Media. All rights reserved 3 * 4 * This source code is subject to the terms of the BSD 3-Clause Clear License 5 * and the Alliance for Open Media Patent License 1.0. If the BSD 3-Clause Clear 6 * License was not distributed with this source code in the LICENSE file, you 7 * can obtain it at www.aomedia.org/license/software-license/bsd-3-c-c. If the 8 * Alliance for Open Media Patent License 1.0 was not distributed with this 9 * source code in the PATENTS file, you can obtain it at 10 * www.aomedia.org/license/patent. 11 */ 12 #ifndef OBU_EXTNESION_PARAMETER_DATA_H_ 13 #define OBU_EXTNESION_PARAMETER_DATA_H_ 14 15 #include <cstdint> 16 #include <vector> 17 18 #include "absl/status/status.h" 19 #include "iamf/common/read_bit_buffer.h" 20 #include "iamf/common/write_bit_buffer.h" 21 #include "iamf/obu/parameter_data.h" 22 #include "iamf/obu/types.h" 23 24 namespace iamf_tools { 25 26 struct ExtensionParameterData : public ParameterData { 27 /*!\brief Constructor. 28 * 29 * \param input_parameter_data_size Input size of the parameter data. 30 * \param input_parameter_data_bytes Input bytes of the parameter data. 31 */ ExtensionParameterDataExtensionParameterData32 ExtensionParameterData(DecodedUleb128 input_parameter_data_size, 33 const std::vector<uint8_t>& input_parameter_data_bytes) 34 : ParameterData(), 35 parameter_data_size(input_parameter_data_size), 36 parameter_data_bytes(input_parameter_data_bytes) {} 37 ExtensionParameterData() = default; 38 39 /*!\brief Overridden destructor.*/ 40 ~ExtensionParameterData() override = default; 41 42 /*!\brief Reads and validates the `ExtensionParameterData` from a buffer. 43 * 44 * \param rb Buffer to read from. 45 * \return `absl::OkStatus()`. A specific error code on failure. 46 */ 47 absl::Status ReadAndValidate(ReadBitBuffer& rb) override; 48 49 /*!\brief Validates and writes to a buffer. 50 * 51 * \param wb Buffer to write to. 52 * \return `absl::OkStatus()` if successful. A specific status on failure. 53 */ 54 absl::Status Write(WriteBitBuffer& wb) const override; 55 56 /*!\brief Prints the extension parameter data. 57 */ 58 void Print() const override; 59 60 DecodedUleb128 parameter_data_size; 61 std::vector<uint8_t> parameter_data_bytes; 62 }; 63 64 } // namespace iamf_tools 65 66 #endif // OBU_EXTNESION_PARAMETER_DATA_H_ 67