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 13 #ifndef CLI_USER_METADATA_BUILDER_CODEC_CONFIG_OBU_BUILDER_H_ 14 #define CLI_USER_METADATA_BUILDER_CODEC_CONFIG_OBU_BUILDER_H_ 15 16 #include <cstdint> 17 18 #include "iamf/cli/proto/codec_config.pb.h" 19 #include "iamf/obu/types.h" 20 21 namespace iamf_tools { 22 23 /*\brief Static functions to get `CodecConfigObuMetadata`s. 24 * 25 * Useful for generating `CodecConfigObuMetadata` with reasonable defaults. 26 */ 27 class CodecConfigObuMetadataBuilder { 28 public: 29 /*!\brief Gets a `CodecConfigObuMetadata` for LPCM. 30 * 31 * \param codec_config_id Codec config id. 32 * \param num_samples_per_frame Number of samples per frame. 33 * \param sample_size Sample size. 34 * \param sample_rate Sample rate. 35 * \return Codec config metadata. 36 */ 37 static iamf_tools_cli_proto::CodecConfigObuMetadata 38 GetLpcmCodecConfigObuMetadata(DecodedUleb128 codec_config_id, 39 uint32_t num_samples_per_frame, 40 uint8_t sample_size, uint32_t sample_rate); 41 42 /*!\brief Gets a `CodecConfigObuMetadata` for Opus. 43 * 44 * \param codec_config_id Codec config id. 45 * \param num_samples_per_frame Number of samples per frame. 46 * \return Codec config metadata. 47 */ 48 static iamf_tools_cli_proto::CodecConfigObuMetadata 49 GetOpusCodecConfigObuMetadata(DecodedUleb128 codec_config_id, 50 uint32_t num_samples_per_frame); 51 }; 52 53 } // namespace iamf_tools 54 55 #endif // CLI_USER_METADATA_BUILDER_CODEC_CONFIG_OBU_BUILDER_H_ 56