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