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 CLI_LOUDNESS_CALCULATOR_FACTORY_BASE_H_ 13 #define CLI_LOUDNESS_CALCULATOR_FACTORY_BASE_H_ 14 15 #include <cstdint> 16 #include <memory> 17 18 #include "iamf/cli/loudness_calculator_base.h" 19 #include "iamf/obu/mix_presentation.h" 20 21 namespace iamf_tools { 22 23 /*!\brief Abstract class to create loudness calculators. 24 * 25 * This class will be used when calculating the loudness of a mix presentation 26 * layout. The mix presentation finalizer will take in a factory (or factories) 27 * and use them to create a loudness calculator for each stream. By taking in a 28 * factory the finalizer can be agnostic to the type of loudness calculator 29 * being used which may depend on implementation details, or it may depend on 30 * the specific layouts. 31 */ 32 class LoudnessCalculatorFactoryBase { 33 public: 34 /*!\brief Creates a loudness calculator. 35 * 36 * \param layout Layout to measure loudness on. 37 * \param num_samples_per_frame Number of samples per frame for the calculator 38 * to process. 39 * \param rendered_sample_rate Sample rate of the rendered audio. 40 * \param rendered_bit_depth Bit-depth of the rendered audio. 41 * \return Unique pointer to a loudness calculator. 42 */ 43 virtual std::unique_ptr<LoudnessCalculatorBase> CreateLoudnessCalculator( 44 const MixPresentationLayout& layout, uint32_t num_samples_per_frame, 45 int32_t rendered_sample_rate, int32_t rendered_bit_depth) const = 0; 46 47 /*!\brief Destructor. */ 48 virtual ~LoudnessCalculatorFactoryBase() = 0; 49 }; 50 51 } // namespace iamf_tools 52 53 #endif // CLI_LOUDNESS_CALCULATOR_FACTORY_BASE_H_ 54