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_DEMIXING_PARAM_DEFINITION_H_ 13 #define OBU_DEMIXING_PARAM_DEFINITION_H_ 14 15 #include <memory> 16 17 #include "absl/status/status.h" 18 #include "iamf/common/read_bit_buffer.h" 19 #include "iamf/common/write_bit_buffer.h" 20 #include "iamf/obu/demixing_info_parameter_data.h" 21 #include "iamf/obu/param_definitions.h" 22 #include "iamf/obu/parameter_data.h" 23 24 namespace iamf_tools { 25 26 /* !\brief Parameter definition for demixing info. 27 */ 28 class DemixingParamDefinition : public ParamDefinition { 29 public: 30 /*!\brief Default constructor. 31 */ DemixingParamDefinition()32 DemixingParamDefinition() : ParamDefinition(kParameterDefinitionDemixing) {} 33 34 /*!\brief Default destructor. 35 */ 36 ~DemixingParamDefinition() override = default; 37 38 friend bool operator==(const DemixingParamDefinition& lhs, 39 const DemixingParamDefinition& rhs) = default; 40 41 /*!\brief Validates and writes to a buffer. 42 * 43 * \param wb Buffer to write to. 44 * \return `absl::OkStatus()` if successful. A specific status on failure. 45 */ 46 absl::Status ValidateAndWrite(WriteBitBuffer& wb) const override; 47 48 /*!\brief Reads from a buffer and validates the resulting output. 49 * 50 * \param rb Buffer to read from. 51 * \return `absl::OkStatus()` if successful. A specific status on failure. 52 */ 53 absl::Status ReadAndValidate(ReadBitBuffer& rb) override; 54 55 /*!\brief Creates a parameter data. 56 * 57 * The created instance will be of type `DemixingInfoParameterData`. 58 * 59 * \return Unique pointer to the created parameter data. 60 */ 61 std::unique_ptr<ParameterData> CreateParameterData() const override; 62 63 /*!\brief Prints the parameter definition. 64 */ 65 void Print() const override; 66 67 DefaultDemixingInfoParameterData default_demixing_info_parameter_data_; 68 }; 69 70 } // namespace iamf_tools 71 72 #endif // OBU_DEMIXING_PARAM_DEFINITION_H_ 73