• 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      "${multimedia_player_framework_path}/frameworks/js/ringtone_manager:systemsoundmanager",
24      "//foundation/multimedia/player_framework/interfaces/kits/js:media",
25      "//foundation/multimedia/player_framework/interfaces/kits/js:media_js",
26    ]
27  }
28}
29
30js_declaration("media_js") {
31  part_name = "player_framework"
32  sources = [ "./@ohos.multimedia.media.d.ts" ]
33}
34
35ohos_copy("media_declaration") {
36  sources = [ "./@ohos.multimedia.media.d.ts" ]
37  outputs = [ target_out_dir + "/$target_name/" ]
38  module_source_dir = target_out_dir + "/$target_name"
39  module_install_name = ""
40}
41
42ohos_shared_library("media") {
43  sanitize = {
44    cfi = true
45    cfi_cross_dso = true
46    debug = false
47  }
48
49  include_dirs = [
50    "//foundation/multimedia/player_framework/interfaces/kits/js",
51    "//foundation/multimedia/player_framework/frameworks/js/avplayer",
52    "//foundation/multimedia/player_framework/frameworks/js/avrecorder",
53    "//foundation/multimedia/player_framework/frameworks/js/player",
54    "//foundation/multimedia/player_framework/frameworks/js/recorder",
55    "//foundation/multimedia/player_framework/frameworks/js/media",
56    "//foundation/multimedia/player_framework/frameworks/js/common",
57    "//foundation/multimedia/player_framework/services/utils/include",
58    "${multimedia_player_framework_path}/frameworks/js/soundpool/include",
59    "${multimedia_player_framework_path}/interfaces/inner_api/native/soundpool/include",
60    "//third_party/libuv/include",
61  ]
62
63  sources = [
64    "//foundation/multimedia/player_framework/frameworks/js/common/common_napi.cpp",
65    "//foundation/multimedia/player_framework/frameworks/js/media/media_enum_napi.cpp",
66    "//foundation/multimedia/player_framework/frameworks/js/media/native_module_ohos_media.cpp",
67  ]
68
69  if (multimedia_player_framework_support_player) {
70    sources += [
71      "//foundation/multimedia/player_framework/frameworks/js/player/audio_player_napi.cpp",
72      "//foundation/multimedia/player_framework/frameworks/js/player/player_callback_napi.cpp",
73    ]
74    if (multimedia_player_framework_support_video) {
75      sources += [
76        "//foundation/multimedia/player_framework/frameworks/js/player/video_callback_napi.cpp",
77        "//foundation/multimedia/player_framework/frameworks/js/player/video_player_napi.cpp",
78      ]
79    }
80  }
81
82  if (multimedia_player_framework_support_recorder) {
83    sources += [
84      "//foundation/multimedia/player_framework/frameworks/js/recorder/audio_recorder_napi.cpp",
85      "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_callback_napi.cpp",
86      "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_napi_utils.cpp",
87      "//foundation/multimedia/player_framework/frameworks/js/recorder/video_recorder_napi.cpp",
88    ]
89  }
90
91  if (multimedia_player_framework_support_recorder_js_api9) {
92    sources += [
93      "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_callback.cpp",
94      "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_napi.cpp",
95    ]
96  }
97
98  cflags = [
99    "-std=c++17",
100    "-fno-rtti",
101    "-fno-exceptions",
102    "-Wall",
103    "-fno-common",
104    "-fstack-protector-strong",
105    "-Wshadow",
106    "-FPIC",
107    "-FS",
108    "-O2",
109    "-D_FORTIFY_SOURCE=2",
110    "-fvisibility=hidden",
111    "-Wformat=2",
112    "-Wfloat-equal",
113    "-Wdate-time",
114    "-Werror",
115    "-Wextra",
116    "-Wimplicit-fallthrough",
117    "-Wsign-compare",
118    "-Wunused-parameter",
119  ]
120
121  deps = [
122    "//foundation/multimedia/player_framework/interfaces/inner_api/native:media_client",
123    "//foundation/multimedia/player_framework/services/utils:media_service_utils",
124  ]
125
126  if (multimedia_player_framework_support_player_js_api9) {
127    deps += [
128      "../../../../../../foundation/multimedia/player_framework/frameworks/js/avplayer:media_avplayer",
129      "../../../../../../third_party/bounds_checking_function:libsec_shared",
130    ]
131  }
132
133  if (multimedia_player_framework_support_jssoundpool) {
134    deps += [
135      "${multimedia_player_framework_path}/frameworks/js/soundpool:media_soundpool",
136      "${multimedia_player_framework_path}/frameworks/native/soundpool:soundpool_client",
137    ]
138  }
139
140  external_deps = [
141    "access_token:libaccesstoken_sdk",
142    "access_token:libtokenid_sdk",
143    "audio_framework:audio_client",
144    "audio_framework:audio_renderer",
145    "c_utils:utils",
146    "hilog:libhilog",
147    "ipc:ipc_single",
148    "napi:ace_napi",
149  ]
150
151  if (multimedia_player_framework_support_video) {
152    external_deps += [ "graphic_2d:surface" ]
153  }
154
155  if (multimedia_player_framework_support_jsstack) {
156    external_deps += [ "hiview:libxpower_event_js" ]
157  }
158
159  defines = []
160  defines += player_framework_defines
161
162  relative_install_dir = "module/multimedia"
163  part_name = "player_framework"
164  subsystem_name = "multimedia"
165}
166