• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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}/frameworks/js/utils",
70    "${multimedia_player_framework_path}/interfaces/inner_api/native/soundpool/include",
71    "//foundation/multimedia/player_framework/interfaces/inner_api/native/",
72  ]
73
74  sources = [
75    "${multimedia_player_framework_path}/frameworks/js/mediasource/media_source_loader_callback.cpp",
76    "${multimedia_player_framework_path}/frameworks/js/mediasource/media_source_loading_request_napi.cpp",
77    "${multimedia_player_framework_path}/frameworks/js/mediasource/media_source_napi.cpp",
78    "//foundation/multimedia/player_framework/frameworks/js/common/common_napi.cpp",
79    "//foundation/multimedia/player_framework/frameworks/js/media/media_enum_napi.cpp",
80    "//foundation/multimedia/player_framework/frameworks/js/media/native_module_ohos_media.cpp",
81  ]
82
83  if (player_framework_support_player) {
84    sources += [
85      "//foundation/multimedia/player_framework/frameworks/js/player/audio_player_napi.cpp",
86      "//foundation/multimedia/player_framework/frameworks/js/player/player_callback_napi.cpp",
87    ]
88    if (player_framework_support_video) {
89      sources += [
90        "//foundation/multimedia/player_framework/frameworks/js/player/video_callback_napi.cpp",
91        "//foundation/multimedia/player_framework/frameworks/js/player/video_player_napi.cpp",
92      ]
93    }
94  }
95
96  if (player_framework_support_recorder) {
97    sources += [
98      "//foundation/multimedia/player_framework/frameworks/js/recorder/audio_recorder_napi.cpp",
99      "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_callback_napi.cpp",
100      "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_napi_utils.cpp",
101      "//foundation/multimedia/player_framework/frameworks/js/recorder/video_recorder_napi.cpp",
102    ]
103  }
104
105  if (player_framework_support_recorder_js_api9) {
106    sources += [
107      "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_callback.cpp",
108      "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_napi.cpp",
109    ]
110  }
111
112  if (player_framework_support_metadata) {
113    sources += [
114      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avimagegenerator_napi.cpp",
115      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avmetadataextractor_napi.cpp",
116      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avmetadatahelper_callback.cpp",
117      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/helper_data_source_callback.cpp",
118    ]
119  }
120
121  if (player_framework_support_screen_capture) {
122    sources += [
123      "${multimedia_player_framework_path}/frameworks/js/avscreen_capture/avscreen_capture_callback.cpp",
124      "${multimedia_player_framework_path}/frameworks/js/avscreen_capture/avscreen_capture_napi.cpp",
125      "${multimedia_player_framework_path}/frameworks/js/screencapturemonitor/screen_capture_monitor_callback.cpp",
126      "${multimedia_player_framework_path}/frameworks/js/screencapturemonitor/screen_capture_monitor_napi.cpp",
127    ]
128  }
129
130  if (player_framework_support_transcoder) {
131    sources += [
132      "${multimedia_player_framework_path}/frameworks/js/avtranscoder/avtranscoder_callback.cpp",
133      "${multimedia_player_framework_path}/frameworks/js/avtranscoder/avtranscoder_napi.cpp",
134    ]
135  }
136
137  cflags = [
138    "-std=c++17",
139    "-fno-rtti",
140    "-fno-exceptions",
141    "-Wall",
142    "-fno-common",
143    "-fstack-protector-strong",
144    "-Wshadow",
145    "-FPIC",
146    "-FS",
147    "-O2",
148    "-D_FORTIFY_SOURCE=2",
149    "-fvisibility=hidden",
150    "-Wformat=2",
151    "-Wfloat-equal",
152    "-Wdate-time",
153    "-Werror",
154    "-Wextra",
155    "-Wimplicit-fallthrough",
156    "-Wsign-compare",
157    "-Wunused-parameter",
158  ]
159
160  deps = [
161    "//foundation/multimedia/player_framework/interfaces/inner_api/native:media_client",
162    "//foundation/multimedia/player_framework/services/utils:media_service_utils",
163  ]
164
165  if (player_framework_support_jssoundpool) {
166    deps += [
167      "${multimedia_player_framework_path}/frameworks/js/soundpool:media_soundpool",
168      "${multimedia_player_framework_path}/frameworks/native/soundpool:soundpool_client",
169    ]
170  }
171
172  external_deps = [
173    "access_token:libaccesstoken_sdk",
174    "access_token:libtokenid_sdk",
175    "audio_framework:audio_client",
176    "audio_framework:audio_renderer",
177    "av_codec:av_codec_client",
178    "c_utils:utils",
179    "ets_runtime:libark_jsruntime",
180    "eventhandler:libeventhandler",
181    "hilog:libhilog",
182    "hisysevent:libhisysevent",
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