1# Copyright (C) 2023-2024 Huawei Device Co., Ltd. 2# Licensed under the Apache License, Version 2.0 (the "License"); 3# you may not use this file except in compliance with the License. 4# You may obtain a copy of the License at 5# 6# http://www.apache.org/licenses/LICENSE-2.0 7# 8# Unless required by applicable law or agreed to in writing, software 9# distributed under the License is distributed on an "AS IS" BASIS, 10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 11# See the License for the specific language governing permissions and 12# limitations under the License. 13 14import("//build/ohos.gni") 15import("//foundation/multimedia/player_framework/config.gni") 16 17group("capi_packages") { 18 deps = [] 19 if (player_framework_support_capi) { 20 deps += [ 21 "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:avimage_generator", 22 "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:avmetadata_extractor", 23 "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:avplayer", 24 "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:avrecorder", 25 "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:native_avscreen_capture", 26 ] 27 } 28} 29 30config("media_capi_config") { 31 include_dirs = [ 32 "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native", 33 "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c", 34 "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/common", 35 "$MEDIA_PLAYER_ROOT_DIR/services/utils/include", 36 ] 37 38 cflags = [ 39 "-fno-exceptions", 40 "-Wall", 41 "-fno-common", 42 "-fstack-protector-all", 43 "-Wshadow", 44 "-FPIC", 45 "-FS", 46 "-O2", 47 "-D_FORTIFY_SOURCE=2", 48 "-Wformat=2", 49 "-Wdate-time", 50 ] 51 52 cflags_cc = [ 53 "-std=c++17", 54 "-fno-rtti", 55 ] 56} 57 58config("media_capi_public_config") { 59 include_dirs = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c" ] 60} 61 62ohos_shared_library("native_avscreen_capture") { 63 stack_protector_ret = true 64 install_enable = true 65 66 sanitize = { 67 integer_overflow = true 68 ubsan = true 69 boundary_sanitize = true 70 cfi = true 71 cfi_cross_dso = true 72 debug = false 73 } 74 75 sources = [ "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/screencapture/native_avscreen_capture.cpp" ] 76 77 configs = [ ":media_capi_config" ] 78 79 public_configs = [ ":media_capi_public_config" ] 80 81 deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ] 82 83 external_deps = [ 84 "audio_framework:audio_client", 85 "av_codec:av_codec_client", 86 "c_utils:utils", 87 "graphic_surface:surface", 88 "hilog:libhilog", 89 "ipc:ipc_core", 90 "media_foundation:media_foundation", 91 "qos_manager:qos", 92 "window_manager:libdm", 93 ] 94 output_extension = "so" 95 subsystem_name = "multimedia" 96 part_name = "player_framework" 97} 98 99ohos_shared_library("avplayer") { 100 stack_protector_ret = true 101 install_enable = true 102 103 sanitize = { 104 integer_overflow = true 105 ubsan = true 106 boundary_sanitize = true 107 cfi = true 108 cfi_cross_dso = true 109 debug = false 110 } 111 112 configs = [ ":media_capi_config" ] 113 114 public_configs = [ ":media_capi_public_config" ] 115 116 sources = [ 117 "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/player/native_avplayer.cpp", 118 ] 119 120 deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ] 121 122 external_deps = [ 123 "audio_framework:audio_capturer", 124 "av_codec:av_codec_client", 125 "c_utils:utils", 126 "graphic_surface:surface", 127 "hilog:libhilog", 128 "hisysevent:libhisysevent", 129 "ipc:ipc_core", 130 "media_foundation:media_foundation", 131 "samgr:samgr_proxy", 132 "window_manager:libdm", 133 ] 134 if (player_framework_support_drm) { 135 public_external_deps = [ 136 "drm_framework:drm_framework", 137 "drm_framework:native_drm", 138 ] 139 } 140 141 defines = [] 142 defines += player_framework_defines 143 144 output_extension = "so" 145 subsystem_name = "multimedia" 146 part_name = "player_framework" 147} 148 149ohos_shared_library("avrecorder") { 150 stack_protector_ret = true 151 install_enable = true 152 153 sanitize = { 154 integer_overflow = true 155 ubsan = true 156 boundary_sanitize = true 157 cfi = true 158 cfi_cross_dso = true 159 debug = false 160 } 161 162 sources = [ "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/recorder/native_avrecorder.cpp" ] 163 164 configs = [ ":media_capi_config" ] 165 166 public_configs = [ ":media_capi_public_config" ] 167 168 deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ] 169 170 external_deps = [ 171 "audio_framework:audio_client", 172 "av_codec:av_codec_client", 173 "c_utils:utils", 174 "graphic_surface:surface", 175 "hilog:libhilog", 176 "image_framework:image", 177 "image_framework:image_native", 178 "image_framework:image_source", 179 "image_framework:ohimage", 180 "ipc:ipc_core", 181 "media_foundation:media_foundation", 182 "napi:ace_napi", 183 "qos_manager:qos", 184 "resource_management:librawfile", 185 "window_manager:libdm", 186 ] 187 188 if (player_framework_support_auto_create_file) { 189 external_deps += [ 190 "media_library:media_library", 191 "media_library:media_library_asset_manager", 192 "media_library:native_media_asset_manager", 193 ] 194 } 195 196 output_extension = "so" 197 subsystem_name = "multimedia" 198 part_name = "player_framework" 199} 200 201ohos_shared_library("avimage_generator") { 202 stack_protector_ret = true 203 install_enable = true 204 205 sanitize = { 206 integer_overflow = true 207 ubsan = true 208 boundary_sanitize = true 209 cfi = true 210 cfi_cross_dso = true 211 debug = false 212 } 213 214 cflags = [ "--coverage" ] 215 ldflags = [ "--coverage" ] 216 217 sources = [ "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/avmetadatahelper/native_avimage_generator.cpp" ] 218 219 configs = [ ":media_capi_config" ] 220 221 public_configs = [ ":media_capi_public_config" ] 222 223 deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ] 224 225 external_deps = [ 226 "audio_framework:audio_capturer", 227 "av_codec:av_codec_client", 228 "c_utils:utils", 229 "graphic_surface:surface", 230 "hilog:libhilog", 231 "hisysevent:libhisysevent", 232 "image_framework:ohimage", 233 "image_framework:pixelmap", 234 "ipc:ipc_core", 235 "media_foundation:media_foundation", 236 "qos_manager:qos", 237 "samgr:samgr_proxy", 238 "window_manager:libdm", 239 ] 240 241 innerapi_tags = [ "ndk" ] 242 243 output_extension = "so" 244 subsystem_name = "multimedia" 245 part_name = "player_framework" 246} 247 248ohos_shared_library("avmetadata_extractor") { 249 stack_protector_ret = true 250 install_enable = true 251 252 sanitize = { 253 integer_overflow = true 254 ubsan = true 255 boundary_sanitize = true 256 cfi = true 257 cfi_cross_dso = true 258 debug = false 259 } 260 261 configs = [ ":media_capi_config" ] 262 263 public_configs = [ ":media_capi_public_config" ] 264 265 cflags_cc = [ "--coverage" ] 266 cflags = [ "--coverage" ] 267 ldflags = [ "--coverage" ] 268 269 sources = [ "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/avmetadatahelper/native_avmetadata_extractor.cpp" ] 270 271 deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ] 272 273 external_deps = [ 274 "audio_framework:audio_capturer", 275 "av_codec:av_codec_client", 276 "c_utils:utils", 277 "graphic_surface:surface", 278 "hilog:libhilog", 279 "hisysevent:libhisysevent", 280 "image_framework:image_native", 281 "image_framework:ohimage", 282 "image_framework:pixelmap", 283 "ipc:ipc_core", 284 "media_foundation:media_foundation", 285 "samgr:samgr_proxy", 286 "window_manager:libdm", 287 ] 288 if (player_framework_support_drm) { 289 public_external_deps = [ 290 "drm_framework:drm_framework", 291 "drm_framework:native_drm", 292 ] 293 } 294 295 defines = [] 296 defines += player_framework_defines 297 298 innerapi_tags = [ "ndk" ] 299 300 output_extension = "so" 301 subsystem_name = "multimedia" 302 part_name = "player_framework" 303} 304