1# Copyright (C) 2021 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("//build/ohos/ace/ace.gni") 16import("//foundation/multimedia/player_framework/config.gni") 17import("./../../../multimedia_player_framework_aafwk.gni") 18 19group("napi_packages") { 20 deps = [] 21 if (player_framework_support_jsapi) { 22 deps += [ 23 "./../../../frameworks/js/audio_haptic:audiohaptic_napi", 24 "./../../../frameworks/js/system_sound_manager:systemsoundmanager", 25 "//foundation/multimedia/player_framework/interfaces/kits/js:media", 26 "//foundation/multimedia/player_framework/interfaces/kits/js:media_js", 27 ] 28 } 29} 30 31js_declaration("media_js") { 32 part_name = "player_framework" 33 sources = [ "./@ohos.multimedia.media.d.ts" ] 34} 35 36ohos_copy("media_declaration") { 37 sources = [ "./@ohos.multimedia.media.d.ts" ] 38 outputs = [ target_out_dir + "/$target_name/" ] 39 module_source_dir = target_out_dir + "/$target_name" 40 module_install_name = "" 41} 42 43ohos_shared_library("media") { 44 stack_protector_ret = true 45 sanitize = { 46 integer_overflow = true 47 ubsan = true 48 boundary_sanitize = true 49 cfi = true 50 cfi_cross_dso = true 51 debug = false 52 } 53 54 include_dirs = [ 55 "//foundation/multimedia/player_framework/interfaces/kits/js", 56 "//foundation/multimedia/player_framework/frameworks/js/avplayer", 57 "//foundation/multimedia/player_framework/frameworks/js/avrecorder", 58 "${multimedia_player_framework_path}/frameworks/js/avtranscoder", 59 "//foundation/multimedia/player_framework/frameworks/js/player", 60 "//foundation/multimedia/player_framework/frameworks/js/recorder", 61 "//foundation/multimedia/player_framework/frameworks/js/media", 62 "${multimedia_player_framework_path}/frameworks/js/mediasource", 63 "//foundation/multimedia/player_framework/frameworks/js/common", 64 "${multimedia_player_framework_path}/frameworks/js/avscreen_capture", 65 "${multimedia_player_framework_path}/frameworks/js/screencapturemonitor", 66 "//foundation/multimedia/player_framework/services/utils/include", 67 "${multimedia_player_framework_path}/frameworks/js/soundpool/include", 68 "${multimedia_player_framework_path}/frameworks/js/metadatahelper", 69 "${multimedia_player_framework_path}/interfaces/inner_api/native/soundpool/include", 70 "//foundation/multimedia/player_framework/interfaces/inner_api/native/", 71 ] 72 73 sources = [ 74 "${multimedia_player_framework_path}/frameworks/js/mediasource/media_source_loader_callback.cpp", 75 "${multimedia_player_framework_path}/frameworks/js/mediasource/media_source_loading_request_napi.cpp", 76 "${multimedia_player_framework_path}/frameworks/js/mediasource/media_source_napi.cpp", 77 "//foundation/multimedia/player_framework/frameworks/js/common/common_napi.cpp", 78 "//foundation/multimedia/player_framework/frameworks/js/media/media_enum_napi.cpp", 79 "//foundation/multimedia/player_framework/frameworks/js/media/native_module_ohos_media.cpp", 80 ] 81 82 if (player_framework_support_player) { 83 sources += [ 84 "//foundation/multimedia/player_framework/frameworks/js/player/audio_player_napi.cpp", 85 "//foundation/multimedia/player_framework/frameworks/js/player/player_callback_napi.cpp", 86 ] 87 if (player_framework_support_video) { 88 sources += [ 89 "//foundation/multimedia/player_framework/frameworks/js/player/video_callback_napi.cpp", 90 "//foundation/multimedia/player_framework/frameworks/js/player/video_player_napi.cpp", 91 ] 92 } 93 } 94 95 if (player_framework_support_recorder) { 96 sources += [ 97 "//foundation/multimedia/player_framework/frameworks/js/recorder/audio_recorder_napi.cpp", 98 "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_callback_napi.cpp", 99 "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_napi_utils.cpp", 100 "//foundation/multimedia/player_framework/frameworks/js/recorder/video_recorder_napi.cpp", 101 ] 102 } 103 104 if (player_framework_support_recorder_js_api9) { 105 sources += [ 106 "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_callback.cpp", 107 "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_napi.cpp", 108 ] 109 } 110 111 if (player_framework_support_metadata) { 112 sources += [ 113 "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avimagegenerator_napi.cpp", 114 "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avmetadataextractor_napi.cpp", 115 "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avmetadatahelper_callback.cpp", 116 "${multimedia_player_framework_path}/frameworks/js/metadatahelper/helper_data_source_callback.cpp", 117 ] 118 } 119 120 if (player_framework_support_screen_capture) { 121 sources += [ 122 "${multimedia_player_framework_path}/frameworks/js/avscreen_capture/avscreen_capture_callback.cpp", 123 "${multimedia_player_framework_path}/frameworks/js/avscreen_capture/avscreen_capture_napi.cpp", 124 "${multimedia_player_framework_path}/frameworks/js/screencapturemonitor/screen_capture_monitor_callback.cpp", 125 "${multimedia_player_framework_path}/frameworks/js/screencapturemonitor/screen_capture_monitor_napi.cpp", 126 ] 127 } 128 129 if (player_framework_support_transcoder) { 130 sources += [ 131 "${multimedia_player_framework_path}/frameworks/js/avtranscoder/avtranscoder_callback.cpp", 132 "${multimedia_player_framework_path}/frameworks/js/avtranscoder/avtranscoder_napi.cpp", 133 ] 134 } 135 136 cflags = [ 137 "-std=c++17", 138 "-fno-rtti", 139 "-fno-exceptions", 140 "-Wall", 141 "-fno-common", 142 "-fstack-protector-strong", 143 "-Wshadow", 144 "-FPIC", 145 "-FS", 146 "-O2", 147 "-D_FORTIFY_SOURCE=2", 148 "-fvisibility=hidden", 149 "-Wformat=2", 150 "-Wfloat-equal", 151 "-Wdate-time", 152 "-Werror", 153 "-Wextra", 154 "-Wimplicit-fallthrough", 155 "-Wsign-compare", 156 "-Wunused-parameter", 157 ] 158 159 deps = [ 160 "//foundation/multimedia/player_framework/interfaces/inner_api/native:media_client", 161 "//foundation/multimedia/player_framework/services/utils:media_service_utils", 162 ] 163 164 if (player_framework_support_jssoundpool) { 165 deps += [ 166 "${multimedia_player_framework_path}/frameworks/js/soundpool:media_soundpool", 167 "${multimedia_player_framework_path}/frameworks/native/soundpool:soundpool_client", 168 ] 169 } 170 171 external_deps = [ 172 "access_token:libaccesstoken_sdk", 173 "access_token:libtokenid_sdk", 174 "audio_framework:audio_client", 175 "audio_framework:audio_renderer", 176 "av_codec:av_codec_client", 177 "c_utils:utils", 178 "ets_runtime:libark_jsruntime", 179 "eventhandler:libeventhandler", 180 "hilog:libhilog", 181 "hisysevent:libhisysevent", 182 "hitrace:hitrace_meter", 183 "image_framework:image", 184 "image_framework:image_native", 185 "ipc:ipc_core", 186 "ipc:ipc_single", 187 "libuv:uv", 188 "media_foundation:media_foundation", 189 "napi:ace_napi", 190 "qos_manager:qos", 191 "window_manager:libdm", 192 ] 193 194 if (player_framework_support_auto_create_file) { 195 external_deps += [ "media_library:medialibrary_nutils" ] 196 } 197 198 if (player_framework_support_player_js_api9) { 199 deps += [ "../../../../../../foundation/multimedia/player_framework/frameworks/js/avplayer:media_avplayer" ] 200 external_deps += [ "bounds_checking_function:libsec_shared" ] 201 } 202 203 if (player_framework_support_video) { 204 external_deps += [ "graphic_surface:surface" ] 205 } 206 207 if (player_framework_support_jsstack) { 208 external_deps += [ "hiview:libxpower_event_js" ] 209 } 210 211 defines = [] 212 defines += player_framework_defines 213 214 if (is_arkui_x) { 215 defines += [ "CROSS_PLATFORM" ] 216 } 217 218 relative_install_dir = "module/multimedia" 219 part_name = "player_framework" 220 subsystem_name = "multimedia" 221} 222