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_AUDIO_FRAME_METADATA_BUILDER_H_ 14 #define CLI_USER_METADATA_BUILDER_AUDIO_FRAME_METADATA_BUILDER_H_ 15 16 #include <cstdint> 17 18 #include "absl/status/status.h" 19 #include "absl/strings/string_view.h" 20 #include "iamf/cli/proto/audio_frame.pb.h" 21 #include "iamf/cli/user_metadata_builder/iamf_input_layout.h" 22 23 namespace iamf_tools { 24 25 /*!\brief Helps create consistent audio frame metadatas for an IAMF stream. 26 * 27 * In `iamf-tools` this metadata is typically associated in a 1:1 mapping with 28 * an audio element. 29 * 30 * `PopulateAudioFrameMetadata()` will generate a single audio frame metadata. 31 * It can be called multiple times to generate additional audio frame 32 * metadatas. 33 * 34 * The generated metadatas have a channel mapping consistent with an ITU-2051-3 35 * layout. 36 */ 37 class AudioFrameMetadataBuilder { 38 public: 39 /*!\brief Populates a `AudioFrameMetadata`. 40 * 41 * \param wav_filename Name of the associated wav file. 42 * \param audio_element_id ID of the associated audio element. 43 * \param input_layout Input layout of the associated audio element. 44 * \param file_suffix Suffix to include in the file name 45 * \param audio_frame_metadata Data to populate. 46 */ 47 static absl::Status PopulateAudioFrameMetadata( 48 absl::string_view wav_filename, uint32_t audio_element_id, 49 IamfInputLayout input_layout, 50 iamf_tools_cli_proto::AudioFrameObuMetadata& audio_frame_obu_metadata); 51 }; 52 53 } // namespace iamf_tools 54 55 #endif // CLI_USER_METADATA_BUILDER_AUDIO_FRAME_METADATA_BUILDER_H_ 56