• 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 (multimedia_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  sanitize = {
45    cfi = true
46    cfi_cross_dso = true
47    debug = false
48  }
49
50  include_dirs = [
51    "//foundation/multimedia/player_framework/interfaces/kits/js",
52    "//foundation/multimedia/player_framework/frameworks/js/avplayer",
53    "//foundation/multimedia/player_framework/frameworks/js/avrecorder",
54    "//foundation/multimedia/player_framework/frameworks/js/player",
55    "//foundation/multimedia/player_framework/frameworks/js/recorder",
56    "//foundation/multimedia/player_framework/frameworks/js/media",
57    "//foundation/multimedia/player_framework/frameworks/js/common",
58    "//foundation/multimedia/player_framework/services/utils/include",
59    "${multimedia_player_framework_path}/frameworks/js/soundpool/include",
60    "${multimedia_player_framework_path}/frameworks/js/metadatahelper",
61    "${multimedia_player_framework_path}/interfaces/inner_api/native/soundpool/include",
62    "//third_party/libuv/include",
63    "//foundation/multimedia/player_framework/interfaces/inner_api/native/",
64    "//foundation/multimedia/image_framework/interfaces/innerkits/include/",
65  ]
66
67  sources = [
68    "//foundation/multimedia/player_framework/frameworks/js/common/common_napi.cpp",
69    "//foundation/multimedia/player_framework/frameworks/js/media/media_enum_napi.cpp",
70    "//foundation/multimedia/player_framework/frameworks/js/media/native_module_ohos_media.cpp",
71  ]
72
73  if (multimedia_player_framework_support_player) {
74    sources += [
75      "//foundation/multimedia/player_framework/frameworks/js/player/audio_player_napi.cpp",
76      "//foundation/multimedia/player_framework/frameworks/js/player/player_callback_napi.cpp",
77    ]
78    if (multimedia_player_framework_support_video) {
79      sources += [
80        "//foundation/multimedia/player_framework/frameworks/js/player/video_callback_napi.cpp",
81        "//foundation/multimedia/player_framework/frameworks/js/player/video_player_napi.cpp",
82      ]
83    }
84  }
85
86  if (multimedia_player_framework_support_recorder) {
87    sources += [
88      "//foundation/multimedia/player_framework/frameworks/js/recorder/audio_recorder_napi.cpp",
89      "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_callback_napi.cpp",
90      "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_napi_utils.cpp",
91      "//foundation/multimedia/player_framework/frameworks/js/recorder/video_recorder_napi.cpp",
92    ]
93  }
94
95  if (multimedia_player_framework_support_recorder_js_api9) {
96    sources += [
97      "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_callback.cpp",
98      "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_napi.cpp",
99    ]
100  }
101
102  if (multimedia_player_framework_support_metadata) {
103    sources += [
104      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avimagegenerator_napi.cpp",
105      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avmetadataextractor_napi.cpp",
106      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avmetadatahelper_callback.cpp",
107      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/helper_data_source_callback.cpp",
108    ]
109  }
110
111  cflags = [
112    "-std=c++17",
113    "-fno-rtti",
114    "-fno-exceptions",
115    "-Wall",
116    "-fno-common",
117    "-fstack-protector-strong",
118    "-Wshadow",
119    "-FPIC",
120    "-FS",
121    "-O2",
122    "-D_FORTIFY_SOURCE=2",
123    "-fvisibility=hidden",
124    "-Wformat=2",
125    "-Wfloat-equal",
126    "-Wdate-time",
127    "-Werror",
128    "-Wextra",
129    "-Wimplicit-fallthrough",
130    "-Wsign-compare",
131    "-Wunused-parameter",
132  ]
133
134  deps = [
135    "//foundation/multimedia/player_framework/interfaces/inner_api/native:media_client",
136    "//foundation/multimedia/player_framework/services/utils:media_service_utils",
137  ]
138
139  if (multimedia_player_framework_support_player_js_api9) {
140    deps += [
141      "../../../../../../foundation/multimedia/player_framework/frameworks/js/avplayer:media_avplayer",
142      "../../../../../../third_party/bounds_checking_function:libsec_shared",
143    ]
144  }
145
146  if (multimedia_player_framework_support_jssoundpool) {
147    deps += [
148      "${multimedia_player_framework_path}/frameworks/js/soundpool:media_soundpool",
149      "${multimedia_player_framework_path}/frameworks/native/soundpool:soundpool_client",
150    ]
151  }
152
153  external_deps = [
154    "access_token:libaccesstoken_sdk",
155    "access_token:libtokenid_sdk",
156    "audio_framework:audio_client",
157    "audio_framework:audio_renderer",
158    "c_utils:utils",
159    "hilog:libhilog",
160    "image_framework:image",
161    "image_framework:image_native",
162    "ipc:ipc_single",
163    "media_foundation:media_foundation",
164    "napi:ace_napi",
165    "qos_manager:qos",
166  ]
167
168  if (multimedia_player_framework_support_video) {
169    external_deps += [ "graphic_surface:surface" ]
170  }
171
172  if (multimedia_player_framework_support_jsstack) {
173    external_deps += [ "hiview:libxpower_event_js" ]
174  }
175
176  defines = []
177  defines += player_framework_defines
178
179  relative_install_dir = "module/multimedia"
180  part_name = "player_framework"
181  subsystem_name = "multimedia"
182}
183