1package {
2    // http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // the below license kinds from "system_media_license":
5    //   SPDX-license-identifier-Apache-2.0
6    default_applicable_licenses: ["system_media_license"],
7}
8
9subdirs = ["tests"]
10
11cc_defaults {
12    name: "audio_utils_defaults",
13
14    local_include_dirs: ["include"],
15    export_include_dirs: ["include"],
16
17    cflags: [
18        "-Wall",
19        "-Werror",
20    ],
21}
22
23cc_library_headers {
24    name: "libaudioutils_headers",
25    host_supported: true,
26    vendor_available: true,
27    product_available: true,
28    export_include_dirs: ["include"],
29    // referenced from CTS/MTS test suite which must run on sdk 29, make sure it's compatible
30    // (revisit if/when we add features to this library that require newer sdk.
31    sdk_version: "29",
32}
33
34cc_library {
35    name: "libaudioutils",
36    vendor_available: true,
37    product_available: true,
38    double_loadable: true,
39    host_supported: true,
40    defaults: [
41        "aconfig_lib_cc_static_link.defaults",
42        "audio_utils_defaults",
43    ],
44    srcs: [
45        "Balance.cpp",
46        "ErrorLog.cpp",
47        "MelAggregator.cpp",
48        "MelProcessor.cpp",
49        "Metadata.cpp",
50        "PowerLog.cpp",
51        "channels.cpp",
52        "fifo.cpp",
53        "fifo_index.cpp",
54        "fifo_writer_T.cpp",
55        "format.c",
56        "hal_smoothness.c",
57        "limiter.c",
58        "minifloat.c",
59        "mono_blend.cpp",
60        "mutex.cpp",
61        "power.cpp",
62        "primitives.c",
63        "roundup.c",
64        "sample.c",
65        "threads.cpp",
66    ],
67
68    header_libs: [
69        "libaudio_system_headers",
70        "libutils_headers",
71    ],
72
73    export_header_lib_headers: [
74        "libaudio_system_headers",
75        "libutils_headers",
76    ],
77
78    shared_libs: [
79        "libcutils",
80        "liblog",
81        "libutils",
82        "server_configurable_flags",
83    ],
84
85    whole_static_libs: [
86        // if libaudioutils is added as a static lib AND flags are used in the utils object,
87        // then add server_configurable_flags as a shared lib.
88        "com.android.media.audioserver-aconfig-cc",
89        "libaudioutils_fastmath",
90    ],
91
92    target: {
93        android: {
94            srcs: [
95                // "mono_blend.cpp",
96                "echo_reference.c",
97                "resampler.c",
98            ],
99            whole_static_libs: ["libaudioutils_fixedfft"],
100            shared_libs: [
101                "libspeexresampler",
102            ],
103        },
104        host: {
105            cflags: ["-D__unused=__attribute__((unused))"],
106        },
107    },
108    min_sdk_version: "29",
109    static: {
110        // library has C++ code that we don't allow across module boundaries
111        // a static link avoids that cross-module peril.
112        apex_available: [
113            "com.android.media",
114            "com.android.media.swcodec",
115        ],
116    },
117}
118
119cc_library_static {
120    name: "libaudioutils_fastmath",
121    vendor_available: true,
122    product_available: true,
123    double_loadable: true,
124    host_supported: true,
125    defaults: ["audio_utils_defaults"],
126
127    srcs: [
128        "ChannelMix.cpp",
129    ],
130
131    header_libs: [
132        "libaudio_system_headers",
133        "libutils_headers",
134    ],
135    min_sdk_version: "29",
136    shared_libs: [
137        "libcutils",
138        "liblog",
139        "libutils",
140    ],
141    cflags: [
142        "-Werror",
143        "-ffast-math",
144        "-fhonor-infinities",
145        "-fhonor-nans",
146    ],
147    apex_available: [
148        "//apex_available:platform",
149        "com.android.media",
150        "com.android.media.swcodec",
151    ],
152}
153
154cc_library_static {
155    name: "libaudioutils_fixedfft",
156    vendor_available: true,
157    product_available: true,
158    defaults: ["audio_utils_defaults"],
159
160    arch: {
161        arm: {
162            instruction_set: "arm",
163        },
164    },
165
166    srcs: ["fixedfft.cpp"],
167    min_sdk_version: "29",
168    apex_available: [
169        "//apex_available:platform",
170        "com.android.media",
171        "com.android.media.swcodec",
172    ],
173}
174
175cc_library_static {
176    name: "libsndfile",
177    defaults: ["audio_utils_defaults"],
178    host_supported: true,
179    srcs: [
180        "primitives.c",
181        "tinysndfile.c",
182    ],
183    cflags: [
184        "-UHAVE_STDERR",
185    ],
186}
187
188cc_library_static {
189    name: "libfifo",
190    defaults: ["audio_utils_defaults"],
191    srcs: [
192        "fifo.cpp",
193        "fifo_index.cpp",
194        "primitives.c",
195        "roundup.c",
196    ],
197    min_sdk_version: "29",
198    apex_available: [
199        "//apex_available:platform",
200        "com.android.media",
201    ],
202    host_supported: true,
203    target: {
204        darwin: {
205            enabled: false,
206        },
207    },
208}
209
210cc_library {
211    name: "libaudiospdif",
212    host_supported: true,
213    defaults: ["audio_utils_defaults"],
214
215    srcs: [
216        "spdif/AC3FrameScanner.cpp",
217        "spdif/BitFieldParser.cpp",
218        "spdif/DTSFrameScanner.cpp",
219        "spdif/FrameScanner.cpp",
220        "spdif/SPDIFDecoder.cpp",
221        "spdif/SPDIFEncoder.cpp",
222        "spdif/SPDIFFrameScanner.cpp",
223    ],
224
225    shared_libs: [
226        "libcutils",
227        "liblog",
228    ],
229}
230