1049e185fSopenharmony_ci# Copyright (C) 2021 Huawei Device Co., Ltd.
2049e185fSopenharmony_ci# Licensed under the Apache License, Version 2.0 (the "License");
3049e185fSopenharmony_ci# you may not use this file except in compliance with the License.
4049e185fSopenharmony_ci# You may obtain a copy of the License at
5049e185fSopenharmony_ci#
6049e185fSopenharmony_ci#     http://www.apache.org/licenses/LICENSE-2.0
7049e185fSopenharmony_ci#
8049e185fSopenharmony_ci# Unless required by applicable law or agreed to in writing, software
9049e185fSopenharmony_ci# distributed under the License is distributed on an "AS IS" BASIS,
10049e185fSopenharmony_ci# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11049e185fSopenharmony_ci# See the License for the specific language governing permissions and
12049e185fSopenharmony_ci# limitations under the License.
13049e185fSopenharmony_ci
14049e185fSopenharmony_ciimport("//build/ohos.gni")
15049e185fSopenharmony_ciimport("//build/ohos/ace/ace.gni")
16049e185fSopenharmony_ciimport("//foundation/multimedia/player_framework/config.gni")
17049e185fSopenharmony_ciimport("./../../../multimedia_player_framework_aafwk.gni")
18049e185fSopenharmony_ci
19049e185fSopenharmony_cigroup("napi_packages") {
20049e185fSopenharmony_ci  deps = []
21049e185fSopenharmony_ci  if (player_framework_support_jsapi) {
22049e185fSopenharmony_ci    deps += [
23049e185fSopenharmony_ci      "./../../../frameworks/js/audio_haptic:audiohaptic_napi",
24049e185fSopenharmony_ci      "./../../../frameworks/js/system_sound_manager:systemsoundmanager",
25049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/interfaces/kits/js:media",
26049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/interfaces/kits/js:media_js",
27049e185fSopenharmony_ci    ]
28049e185fSopenharmony_ci  }
29049e185fSopenharmony_ci}
30049e185fSopenharmony_ci
31049e185fSopenharmony_cijs_declaration("media_js") {
32049e185fSopenharmony_ci  part_name = "player_framework"
33049e185fSopenharmony_ci  sources = [ "./@ohos.multimedia.media.d.ts" ]
34049e185fSopenharmony_ci}
35049e185fSopenharmony_ci
36049e185fSopenharmony_ciohos_copy("media_declaration") {
37049e185fSopenharmony_ci  sources = [ "./@ohos.multimedia.media.d.ts" ]
38049e185fSopenharmony_ci  outputs = [ target_out_dir + "/$target_name/" ]
39049e185fSopenharmony_ci  module_source_dir = target_out_dir + "/$target_name"
40049e185fSopenharmony_ci  module_install_name = ""
41049e185fSopenharmony_ci}
42049e185fSopenharmony_ci
43049e185fSopenharmony_ciohos_shared_library("media") {
44049e185fSopenharmony_ci  stack_protector_ret = true
45049e185fSopenharmony_ci  sanitize = {
46049e185fSopenharmony_ci    integer_overflow = true
47049e185fSopenharmony_ci    ubsan = true
48049e185fSopenharmony_ci    boundary_sanitize = true
49049e185fSopenharmony_ci    cfi = true
50049e185fSopenharmony_ci    cfi_cross_dso = true
51049e185fSopenharmony_ci    debug = false
52049e185fSopenharmony_ci  }
53049e185fSopenharmony_ci
54049e185fSopenharmony_ci  include_dirs = [
55049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/interfaces/kits/js",
56049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/frameworks/js/avplayer",
57049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/frameworks/js/avrecorder",
58049e185fSopenharmony_ci    "${multimedia_player_framework_path}/frameworks/js/avtranscoder",
59049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/frameworks/js/player",
60049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/frameworks/js/recorder",
61049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/frameworks/js/media",
62049e185fSopenharmony_ci    "${multimedia_player_framework_path}/frameworks/js/mediasource",
63049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/frameworks/js/common",
64049e185fSopenharmony_ci    "${multimedia_player_framework_path}/frameworks/js/avscreen_capture",
65049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/services/utils/include",
66049e185fSopenharmony_ci    "${multimedia_player_framework_path}/frameworks/js/soundpool/include",
67049e185fSopenharmony_ci    "${multimedia_player_framework_path}/frameworks/js/metadatahelper",
68049e185fSopenharmony_ci    "${multimedia_player_framework_path}/interfaces/inner_api/native/soundpool/include",
69049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/interfaces/inner_api/native/",
70049e185fSopenharmony_ci  ]
71049e185fSopenharmony_ci
72049e185fSopenharmony_ci  sources = [
73049e185fSopenharmony_ci    "${multimedia_player_framework_path}/frameworks/js/mediasource/media_source_napi.cpp",
74049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/frameworks/js/common/common_napi.cpp",
75049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/frameworks/js/media/media_enum_napi.cpp",
76049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/frameworks/js/media/native_module_ohos_media.cpp",
77049e185fSopenharmony_ci  ]
78049e185fSopenharmony_ci
79049e185fSopenharmony_ci  if (player_framework_support_player) {
80049e185fSopenharmony_ci    sources += [
81049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/frameworks/js/player/audio_player_napi.cpp",
82049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/frameworks/js/player/player_callback_napi.cpp",
83049e185fSopenharmony_ci    ]
84049e185fSopenharmony_ci    if (player_framework_support_video) {
85049e185fSopenharmony_ci      sources += [
86049e185fSopenharmony_ci        "//foundation/multimedia/player_framework/frameworks/js/player/video_callback_napi.cpp",
87049e185fSopenharmony_ci        "//foundation/multimedia/player_framework/frameworks/js/player/video_player_napi.cpp",
88049e185fSopenharmony_ci      ]
89049e185fSopenharmony_ci    }
90049e185fSopenharmony_ci  }
91049e185fSopenharmony_ci
92049e185fSopenharmony_ci  if (player_framework_support_recorder) {
93049e185fSopenharmony_ci    sources += [
94049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/frameworks/js/recorder/audio_recorder_napi.cpp",
95049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_callback_napi.cpp",
96049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/frameworks/js/recorder/recorder_napi_utils.cpp",
97049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/frameworks/js/recorder/video_recorder_napi.cpp",
98049e185fSopenharmony_ci    ]
99049e185fSopenharmony_ci  }
100049e185fSopenharmony_ci
101049e185fSopenharmony_ci  if (player_framework_support_recorder_js_api9) {
102049e185fSopenharmony_ci    sources += [
103049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_callback.cpp",
104049e185fSopenharmony_ci      "//foundation/multimedia/player_framework/frameworks/js/avrecorder/avrecorder_napi.cpp",
105049e185fSopenharmony_ci    ]
106049e185fSopenharmony_ci  }
107049e185fSopenharmony_ci
108049e185fSopenharmony_ci  if (player_framework_support_metadata) {
109049e185fSopenharmony_ci    sources += [
110049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avimagegenerator_napi.cpp",
111049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avmetadataextractor_napi.cpp",
112049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/avmetadatahelper_callback.cpp",
113049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/js/metadatahelper/helper_data_source_callback.cpp",
114049e185fSopenharmony_ci    ]
115049e185fSopenharmony_ci  }
116049e185fSopenharmony_ci
117049e185fSopenharmony_ci  if (player_framework_support_screen_capture) {
118049e185fSopenharmony_ci    sources += [
119049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/js/avscreen_capture/avscreen_capture_callback.cpp",
120049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/js/avscreen_capture/avscreen_capture_napi.cpp",
121049e185fSopenharmony_ci    ]
122049e185fSopenharmony_ci  }
123049e185fSopenharmony_ci
124049e185fSopenharmony_ci  if (player_framework_support_transcoder) {
125049e185fSopenharmony_ci    sources += [
126049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/js/avtranscoder/avtranscoder_callback.cpp",
127049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/js/avtranscoder/avtranscoder_napi.cpp",
128049e185fSopenharmony_ci    ]
129049e185fSopenharmony_ci  }
130049e185fSopenharmony_ci
131049e185fSopenharmony_ci  cflags = [
132049e185fSopenharmony_ci    "-std=c++17",
133049e185fSopenharmony_ci    "-fno-rtti",
134049e185fSopenharmony_ci    "-fno-exceptions",
135049e185fSopenharmony_ci    "-Wall",
136049e185fSopenharmony_ci    "-fno-common",
137049e185fSopenharmony_ci    "-fstack-protector-strong",
138049e185fSopenharmony_ci    "-Wshadow",
139049e185fSopenharmony_ci    "-FPIC",
140049e185fSopenharmony_ci    "-FS",
141049e185fSopenharmony_ci    "-O2",
142049e185fSopenharmony_ci    "-D_FORTIFY_SOURCE=2",
143049e185fSopenharmony_ci    "-fvisibility=hidden",
144049e185fSopenharmony_ci    "-Wformat=2",
145049e185fSopenharmony_ci    "-Wfloat-equal",
146049e185fSopenharmony_ci    "-Wdate-time",
147049e185fSopenharmony_ci    "-Werror",
148049e185fSopenharmony_ci    "-Wextra",
149049e185fSopenharmony_ci    "-Wimplicit-fallthrough",
150049e185fSopenharmony_ci    "-Wsign-compare",
151049e185fSopenharmony_ci    "-Wunused-parameter",
152049e185fSopenharmony_ci  ]
153049e185fSopenharmony_ci
154049e185fSopenharmony_ci  deps = [
155049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/interfaces/inner_api/native:media_client",
156049e185fSopenharmony_ci    "//foundation/multimedia/player_framework/services/utils:media_service_utils",
157049e185fSopenharmony_ci  ]
158049e185fSopenharmony_ci
159049e185fSopenharmony_ci  if (player_framework_support_jssoundpool) {
160049e185fSopenharmony_ci    deps += [
161049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/js/soundpool:media_soundpool",
162049e185fSopenharmony_ci      "${multimedia_player_framework_path}/frameworks/native/soundpool:soundpool_client",
163049e185fSopenharmony_ci    ]
164049e185fSopenharmony_ci  }
165049e185fSopenharmony_ci
166049e185fSopenharmony_ci  external_deps = [
167049e185fSopenharmony_ci    "access_token:libaccesstoken_sdk",
168049e185fSopenharmony_ci    "access_token:libtokenid_sdk",
169049e185fSopenharmony_ci    "audio_framework:audio_client",
170049e185fSopenharmony_ci    "audio_framework:audio_renderer",
171049e185fSopenharmony_ci    "av_codec:av_codec_client",
172049e185fSopenharmony_ci    "c_utils:utils",
173049e185fSopenharmony_ci    "ets_runtime:libark_jsruntime",
174049e185fSopenharmony_ci    "eventhandler:libeventhandler",
175049e185fSopenharmony_ci    "hilog:libhilog",
176049e185fSopenharmony_ci    "hisysevent:libhisysevent",
177049e185fSopenharmony_ci    "image_framework:image",
178049e185fSopenharmony_ci    "image_framework:image_native",
179049e185fSopenharmony_ci    "ipc:ipc_core",
180049e185fSopenharmony_ci    "ipc:ipc_single",
181049e185fSopenharmony_ci    "libuv:uv",
182049e185fSopenharmony_ci    "media_foundation:media_foundation",
183049e185fSopenharmony_ci    "napi:ace_napi",
184049e185fSopenharmony_ci    "qos_manager:qos",
185049e185fSopenharmony_ci    "window_manager:libdm",
186049e185fSopenharmony_ci  ]
187049e185fSopenharmony_ci
188049e185fSopenharmony_ci  if (player_framework_support_auto_create_file) {
189049e185fSopenharmony_ci    external_deps += [ "media_library:medialibrary_nutils" ]
190049e185fSopenharmony_ci  }
191049e185fSopenharmony_ci
192049e185fSopenharmony_ci  if (player_framework_support_player_js_api9) {
193049e185fSopenharmony_ci    deps += [ "../../../../../../foundation/multimedia/player_framework/frameworks/js/avplayer:media_avplayer" ]
194049e185fSopenharmony_ci    external_deps += [ "bounds_checking_function:libsec_shared" ]
195049e185fSopenharmony_ci  }
196049e185fSopenharmony_ci
197049e185fSopenharmony_ci  if (player_framework_support_video) {
198049e185fSopenharmony_ci    external_deps += [ "graphic_surface:surface" ]
199049e185fSopenharmony_ci  }
200049e185fSopenharmony_ci
201049e185fSopenharmony_ci  if (player_framework_support_jsstack) {
202049e185fSopenharmony_ci    external_deps += [ "hiview:libxpower_event_js" ]
203049e185fSopenharmony_ci  }
204049e185fSopenharmony_ci
205049e185fSopenharmony_ci  defines = []
206049e185fSopenharmony_ci  defines += player_framework_defines
207049e185fSopenharmony_ci
208049e185fSopenharmony_ci  if (is_arkui_x) {
209049e185fSopenharmony_ci    defines += [ "CROSS_PLATFORM" ]
210049e185fSopenharmony_ci  }
211049e185fSopenharmony_ci
212049e185fSopenharmony_ci  relative_install_dir = "module/multimedia"
213049e185fSopenharmony_ci  part_name = "player_framework"
214049e185fSopenharmony_ci  subsystem_name = "multimedia"
215049e185fSopenharmony_ci}
216