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
19ndk_library {
20    name: "libmediandk",
21    symbol_file: "libmediandk.map.txt",
22    first_version: "21",
23    unversioned_until: "current",
24}
25
26ndk_headers {
27    name: "libmediandk_headers",
28    from: "include/media",
29    to: "media",
30    srcs: ["include/media/**/*.h"],
31    license: "NOTICE",
32}
33
34// for use with header_libs
35cc_library_headers {
36    name: "media_ndk_headers",
37    vendor_available: true,
38    export_include_dirs: ["include"]
39}
40
41cc_library_shared {
42    name: "libmediandk",
43
44    srcs: [
45        "NdkMediaCodec.cpp",
46        "NdkMediaCrypto.cpp",
47        "NdkMediaDataSource.cpp",
48        "NdkMediaExtractor.cpp",
49        "NdkMediaFormat.cpp",
50        "NdkMediaMuxer.cpp",
51        "NdkMediaDrm.cpp",
52        "NdkImage.cpp",
53        "NdkImageReader.cpp",
54    ],
55
56    include_dirs: [
57        "bionic/libc/private",
58        "frameworks/base/core/jni",
59        "frameworks/native/include/media/openmax",
60        "system/media/camera/include",
61    ],
62
63    cflags: [
64        "-DEXPORT=__attribute__((visibility(\"default\")))",
65        "-Werror",
66        "-Wall",
67    ],
68
69    static_libs: [
70        "libgrallocusage",
71    ],
72
73    shared_libs: [
74        "android.hardware.graphics.bufferqueue@1.0",
75        "android.hidl.token@1.0-utils",
76        "libandroid_runtime_lazy",
77        "libbase",
78        "libbinder",
79        "libmedia",
80        "libmedia_omx",
81        "libmedia_jni_utils",
82        "libmediadrm",
83        "libstagefright",
84        "libstagefright_foundation",
85        "liblog",
86        "libutils",
87        "libcutils",
88        "libnativewindow",
89        "libbinder",
90        "libhidlbase",
91        "libgui",
92        "libui",
93        "libmedia2_jni_core",
94        "libmediandk_utils",
95    ],
96
97    export_include_dirs: ["include"],
98
99    export_shared_lib_headers: [
100        "libgui",
101    ],
102
103    product_variables: {
104        pdk: {
105            enabled: false,
106        },
107    },
108    version_script: "libmediandk.map.txt",
109    stubs: {
110        symbol_file: "libmediandk.map.txt",
111        versions: ["29"],
112    },
113
114    // Bug: http://b/124522995 libmediandk has linker errors when built with
115    // coverage
116    native_coverage: false,
117}
118
119llndk_library {
120    name: "libmediandk",
121    symbol_file: "libmediandk.map.txt",
122    export_include_dirs: [
123        "include",
124    ],
125}
126
127cc_library {
128    name: "libmediandk_utils",
129
130    srcs: [
131        "NdkMediaDataSourceCallbacks.cpp",
132    ],
133
134    include_dirs: [
135        "frameworks/av/media/libstagefright/include",
136        "frameworks/av/media/ndk/include",
137    ],
138
139    export_include_dirs: [
140        "include",
141    ],
142
143    cflags: [
144        "-Werror",
145        "-Wno-error=deprecated-declarations",
146        "-Wall",
147    ],
148
149    shared_libs: [
150    ],
151
152    sanitize: {
153        misc_undefined: [
154            "unsigned-integer-overflow",
155            "signed-integer-overflow",
156        ],
157        cfi: true,
158    },
159}
160
161cc_test {
162    name: "AImageReaderWindowHandleTest",
163    srcs: ["tests/AImageReaderWindowHandleTest.cpp"],
164    shared_libs: [
165        "libbinder",
166        "libmediandk",
167        "libmediautils",
168        "libnativewindow",
169        "libgui",
170        "libutils",
171        "libui",
172        "libcutils",
173        "android.hardware.graphics.bufferqueue@1.0",
174    ],
175    cflags: [
176        "-D__ANDROID_VNDK__",
177    ],
178    include_dirs: [
179        "frameworks/av/media/ndk/",
180    ],
181}
182