xref: /aosp_15_r20/frameworks/av/media/ndk/Android.bp (revision ec779b8e0859a360c3d303172224686826e6e0e1)
1// Copyright (C) 2016 The Android Open Source Project
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//      http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15// Headers module is in frameworks/av/Android.bp because modules are not allowed
16// to refer to headers in parent directories and the headers live in
17// frameworks/av/include.
18
19package {
20    default_applicable_licenses: ["frameworks_av_media_ndk_license"],
21}
22
23// Added automatically by a large-scale-change that took the approach of
24// 'apply every license found to every target'. While this makes sure we respect
25// every license restriction, it may not be entirely correct.
26//
27// e.g. GPL in an MIT project might only apply to the contrib/ directory.
28//
29// Please consider splitting the single license below into multiple licenses,
30// taking care not to lose any license_kind information, and overriding the
31// default license using the 'licenses: [...]' property on targets as needed.
32//
33// For unused files, consider creating a 'fileGroup' with "//visibility:private"
34// to attach the license to, and including a comment whether the files may be
35// used in the current project.
36// See: http://go/android-license-faq
37license {
38    name: "frameworks_av_media_ndk_license",
39    visibility: [":__subpackages__"],
40    license_kinds: [
41        "SPDX-license-identifier-Apache-2.0",
42        "SPDX-license-identifier-MIT",
43        "SPDX-license-identifier-Unicode-DFS",
44    ],
45    license_text: [
46        "NOTICE",
47    ],
48}
49
50ndk_library {
51    name: "libmediandk",
52    symbol_file: "libmediandk.map.txt",
53    first_version: "21",
54    unversioned_until: "current",
55}
56
57ndk_headers {
58    name: "libmediandk_headers",
59    from: "include/media",
60    to: "media",
61    srcs: ["include/media/**/*.h"],
62    license: "NOTICE",
63}
64
65// for use with header_libs
66// supports use as <media/NdkMediaExtractor.h> not <NdkMediaExtractor.h>
67cc_library_headers {
68    name: "media_ndk_headers",
69    vendor_available: true,
70    // TODO(b/153609531): remove when no longer needed.
71    native_bridge_supported: true,
72    apex_available: [
73        "//apex_available:platform",
74        "com.android.media",
75        "com.android.media.swcodec",
76    ],
77    min_sdk_version: "29",
78    export_include_dirs: ["include"],
79    host_supported: true,
80    target: {
81        darwin: {
82            enabled: false,
83        },
84    },
85}
86
87cc_library_shared {
88    name: "libmediandk",
89    llndk: {
90        symbol_file: "libmediandk.map.txt",
91    },
92
93    srcs: [
94        "NdkJavaVMHelper.cpp",
95        "NdkMediaCodec.cpp",
96        "NdkMediaCodecInfo.cpp",
97        "NdkMediaCodecStore.cpp",
98        "NdkMediaCrypto.cpp",
99        "NdkMediaDataSource.cpp",
100        "NdkMediaExtractor.cpp",
101        "NdkMediaFormat.cpp",
102        "NdkMediaMuxer.cpp",
103        "NdkMediaDrm.cpp",
104        "NdkImage.cpp",
105        "NdkImageReader.cpp",
106    ],
107
108    include_dirs: [
109        "system/media/camera/include",
110    ],
111
112    cflags: [
113        "-DEXPORT=__attribute__((visibility(\"default\")))",
114        "-Werror",
115        "-Wall",
116    ],
117
118    static_libs: [
119        "libgrallocusage",
120        "libnativehelper_lazy",
121    ],
122
123    header_libs: [
124        "jni_headers",
125        "libmediadrm_headers",
126        "libmediametrics_headers",
127    ],
128
129    shared_libs: [
130        "[email protected]",
131        "[email protected]",
132        "libandroid_runtime_lazy",
133        "libbase",
134        "libdatasource",
135        "libmedia",
136        "libmedia_codeclist",
137        "libmedia_codeclist_capabilities",
138        "libmediadrm",
139        "libmedia_omx",
140        "libmedia_jni_utils",
141        "libstagefright",
142        "libstagefright_foundation",
143        "liblog",
144        "libutils",
145        "libcutils",
146        "libnativewindow",
147        "libhidlbase",
148        "libgui",
149        "libui",
150        "libmediandk_utils",
151        "android.hardware.drm-V1-ndk",
152    ],
153
154    export_header_lib_headers: ["jni_headers"],
155
156    export_include_dirs: [
157        "include",
158        "include_platform",
159    ],
160
161    export_shared_lib_headers: [
162        "libgui",
163    ],
164
165    version_script: "libmediandk.map.txt",
166    stubs: {
167        symbol_file: "libmediandk.map.txt",
168        versions: ["29"],
169    },
170}
171
172cc_library {
173    name: "libmediandk_utils",
174
175    srcs: [
176        "NdkMediaDataSourceCallbacks.cpp",
177    ],
178
179    local_include_dirs: [
180        "include",
181    ],
182
183    export_include_dirs: [
184        "include",
185    ],
186
187    cflags: [
188        "-Werror",
189        "-Wno-error=deprecated-declarations",
190        "-Wall",
191    ],
192
193    header_libs: [
194        "libstagefright_headers",
195        "libmedia_headers",
196    ],
197
198    shared_libs: [
199    ],
200
201    sanitize: {
202        misc_undefined: [
203            "unsigned-integer-overflow",
204            "signed-integer-overflow",
205        ],
206        cfi: true,
207    },
208}
209
210cc_test {
211    name: "AImageReaderWindowTest",
212    test_suites: ["device-tests"],
213    srcs: ["tests/AImageReaderWindowTest.cpp"],
214    shared_libs: [
215        "libbinder",
216        "libmediandk",
217        "libmediautils",
218        "libnativewindow",
219        "libgui",
220        "libhidlbase",
221        "libutils",
222        "libui",
223        "libcutils",
224        "[email protected]",
225        "[email protected]",
226    ],
227
228    header_libs: [
229        "libstagefright_foundation_headers",
230    ],
231
232    cflags: [
233        "-D__ANDROID_VNDK__",
234    ],
235}
236
237cc_library_static {
238    name: "libmediandk_format",
239
240    host_supported: true,
241
242    srcs: [
243        "NdkMediaFormat.cpp",
244    ],
245
246    header_libs: [
247        "libstagefright_foundation_headers",
248    ],
249
250    cflags: [
251        "-DEXPORT=__attribute__((visibility(\"default\")))",
252        "-Werror",
253        "-Wall",
254    ],
255
256    export_include_dirs: ["include"],
257
258    sanitize: {
259        misc_undefined: [
260            "unsigned-integer-overflow",
261            "signed-integer-overflow",
262        ],
263        cfi: true,
264    },
265
266    target: {
267        darwin: {
268            enabled: false,
269        },
270    },
271
272    apex_available: [
273        "//apex_available:platform",
274        "com.android.media",
275        "com.android.media.swcodec",
276    ],
277}
278