• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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_IAMF_INPUT_LAYOUT_H_
14 #define CLI_USER_METADATA_BUILDER_IAMF_INPUT_LAYOUT_H_
15 
16 #include "absl/status/statusor.h"
17 #include "absl/strings/string_view.h"
18 namespace iamf_tools {
19 
20 /*!\brief Input layout of an IAMF Audio Element.
21  *
22  * Used as a generalization of types an audio element can represent. Even when
23  * the OBU may represent them using different structures (i.e. this type
24  * captures both `AUDIO_ELEMENT_CHANNEL_BASED` and `AUDIO_ELEMENT_SCENE_BASED`).
25  */
26 enum class IamfInputLayout {
27   kMono,
28   kStereo,
29   k5_1,
30   k5_1_2,
31   k5_1_4,
32   k7_1,
33   k7_1_4,
34   kBinaural,
35   kLFE,
36   kAmbisonicsOrder1,
37   kAmbisonicsOrder2,
38   kAmbisonicsOrder3,
39 };
40 
41 /*!\brief Lookup IAMF input layout from the ADM audio pack format ID.
42  *
43  * In ADM, audioPackFormatID has the format AP_yyyyxxxx, where 'yyyy' digits
44  * represent the type of audio and 'xxxx' gives the description within a
45  * particular type.
46  *
47  * yyyy    typeDefinition
48  * 0001    DirectSpeakers
49  * 0002    Matrix
50  * 0003    Objects
51  * 0004    HOA
52  * 0005    Binaural
53  *
54  * IAMF supports typeDefinitions ='DirectSpeakers'/'HOA'/'Binaural'.
55  */
56 absl::StatusOr<IamfInputLayout> LookupInputLayoutFromAudioPackFormatId(
57     absl::string_view audio_pack_format_id);
58 
59 }  // namespace iamf_tools
60 
61 #endif  // CLI_USER_METADATA_BUILDER_IAMF_INPUT_LAYOUT_H_
62