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    export_header_libs: [
56        "libmediandk_headers",
57    ],
58}
59
60ndk_headers {
61    name: "libmediandk_headers",
62    from: "include/media",
63    to: "media",
64    srcs: ["include/media/**/*.h"],
65    license: "NOTICE",
66}
67
68// for use with header_libs
69// supports use as <media/NdkMediaExtractor.h> not <NdkMediaExtractor.h>
70cc_library_headers {
71    name: "media_ndk_headers",
72    vendor_available: true,
73    // TODO(b/153609531): remove when no longer needed.
74    native_bridge_supported: true,
75    apex_available: [
76        "//apex_available:platform",
77        "com.android.media",
78        "com.android.media.swcodec",
79    ],
80    min_sdk_version: "29",
81    export_include_dirs: ["include"],
82    host_supported: true,
83    target: {
84        darwin: {
85            enabled: false,
86        },
87    },
88}
89
90cc_library_shared {
91    name: "libmediandk",
92    llndk: {
93        symbol_file: "libmediandk.map.txt",
94    },
95
96    srcs: [
97        "NdkJavaVMHelper.cpp",
98        "NdkMediaCodec.cpp",
99        "NdkMediaCrypto.cpp",
100        "NdkMediaDataSource.cpp",
101        "NdkMediaExtractor.cpp",
102        "NdkMediaFormat.cpp",
103        "NdkMediaMuxer.cpp",
104        "NdkMediaDrm.cpp",
105        "NdkImage.cpp",
106        "NdkImageReader.cpp",
107    ],
108
109    include_dirs: [
110        "system/media/camera/include",
111    ],
112
113    cflags: [
114        "-DEXPORT=__attribute__((visibility(\"default\")))",
115        "-Werror",
116        "-Wall",
117    ],
118
119    static_libs: [
120        "libgrallocusage",
121        "libnativehelper_lazy",
122    ],
123
124    header_libs: [
125        "jni_headers",
126        "libmediadrm_headers",
127        "libmediametrics_headers",
128    ],
129
130    shared_libs: [
131        "android.hardware.graphics.bufferqueue@1.0",
132        "android.hidl.token@1.0-utils",
133        "libandroid_runtime_lazy",
134        "libbase",
135        "libdatasource",
136        "libmedia",
137        "libmediadrm",
138        "libmedia_omx",
139        "libmedia_jni_utils",
140        "libstagefright",
141        "libstagefright_foundation",
142        "liblog",
143        "libutils",
144        "libcutils",
145        "libnativewindow",
146        "libhidlbase",
147        "libgui",
148        "libui",
149        "libmediandk_utils",
150        "android.hardware.drm-V1-ndk",
151    ],
152
153    export_header_lib_headers: ["jni_headers"],
154
155    export_include_dirs: [
156        "include",
157        "include_platform",
158    ],
159
160    export_shared_lib_headers: [
161        "libgui",
162    ],
163
164    version_script: "libmediandk.map.txt",
165    stubs: {
166        symbol_file: "libmediandk.map.txt",
167        versions: ["29"],
168    },
169}
170
171cc_library {
172    name: "libmediandk_utils",
173
174    srcs: [
175        "NdkMediaDataSourceCallbacks.cpp",
176    ],
177
178    local_include_dirs: [
179        "include",
180    ],
181
182    export_include_dirs: [
183        "include",
184    ],
185
186    cflags: [
187        "-Werror",
188        "-Wno-error=deprecated-declarations",
189        "-Wall",
190    ],
191
192    header_libs: [
193        "libstagefright_headers",
194        "libmedia_headers",
195    ],
196
197    shared_libs: [
198    ],
199
200    sanitize: {
201        misc_undefined: [
202            "unsigned-integer-overflow",
203            "signed-integer-overflow",
204        ],
205        cfi: true,
206    },
207}
208
209cc_test {
210    name: "AImageReaderWindowTest",
211    test_suites: ["device-tests"],
212    srcs: ["tests/AImageReaderWindowTest.cpp"],
213    shared_libs: [
214        "libbinder",
215        "libmediandk",
216        "libmediautils",
217        "libnativewindow",
218        "libgui",
219        "libhidlbase",
220        "libutils",
221        "libui",
222        "libcutils",
223        "android.hardware.graphics.bufferqueue@1.0",
224        "android.hidl.token@1.0",
225    ],
226
227    header_libs: [
228        "libstagefright_foundation_headers",
229    ],
230
231    cflags: [
232        "-D__ANDROID_VNDK__",
233    ],
234}
235
236cc_library_static {
237    name: "libmediandk_format",
238
239    host_supported: true,
240
241    srcs: [
242        "NdkMediaFormat.cpp",
243    ],
244
245    header_libs: [
246        "libstagefright_foundation_headers",
247    ],
248
249    cflags: [
250        "-DEXPORT=__attribute__((visibility(\"default\")))",
251        "-Werror",
252        "-Wall",
253    ],
254
255    export_include_dirs: ["include"],
256
257    sanitize: {
258        misc_undefined: [
259            "unsigned-integer-overflow",
260            "signed-integer-overflow",
261        ],
262        cfi: true,
263    },
264
265    target: {
266        darwin: {
267            enabled: false,
268        },
269    },
270
271    apex_available: [
272        "//apex_available:platform",
273        "com.android.media",
274        "com.android.media.swcodec",
275    ],
276}
277