1 /* 2 * Copyright (c) 2025, 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_PROTO_CONVERSION_DOWNMIXING_RECONSTRUCTION_UTIL_H_ 14 #define CLI_PROTO_CONVERSION_DOWNMIXING_RECONSTRUCTION_UTIL_H_ 15 16 #include "absl/container/flat_hash_map.h" 17 #include "absl/status/statusor.h" 18 #include "iamf/cli/audio_element_with_data.h" 19 #include "iamf/cli/demixing_module.h" 20 #include "iamf/cli/proto/user_metadata.pb.h" 21 #include "iamf/obu/types.h" 22 23 namespace iamf_tools { 24 25 /*!\brief Creates a map of ID to DownmixingAndReconstructionConfig. 26 * 27 * \param user_metadata Proto UserMetadata, the source of ChannelLabels. 28 * \param audio_elements AudioElements to source SubStreamIdsToLabels and 29 * LabelToOutputGains. 30 * \return Map of Audio Element ID to DemixingMetadata on success. An error if 31 * any Audio Element ID is not found in `audio_elements`. An error if 32 * any labels fail to be converted. 33 */ 34 absl::StatusOr<absl::flat_hash_map< 35 DecodedUleb128, DemixingModule::DownmixingAndReconstructionConfig>> 36 CreateAudioElementIdToDemixingMetadata( 37 const iamf_tools_cli_proto::UserMetadata& user_metadata, 38 const absl::flat_hash_map<DecodedUleb128, AudioElementWithData>& 39 audio_elements); 40 41 } // namespace iamf_tools 42 43 #endif // CLI_PROTO_CONVERSION_DOWNMIXING_RECONSTRUCTION_UTIL_H_ 44