1# Copyright (c) 2024 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("//foundation/multimedia/media_foundation/config.gni")
15
16if (hst_is_lite_sys) {
17  group("media_monitor_packages") {
18    deps = []
19  }
20} else {
21  group("media_monitor_packages") {
22    deps = [
23      ":media_monitor",
24      ":media_monitor_common",
25      ":media_monitor_init",
26      "sa_profile:media_monitor_sa_profile",
27    ]
28  }
29}
30
31if (hst_is_lite_sys) {
32  group("media_monitor_public_config") {
33    deps = []
34  }
35} else {
36  config("media_monitor_public_config") {
37    include_dirs = [
38      "common/include",
39      "client/include",
40      "../../interface/inner_api/common/",
41    ]
42    defines = [ "MEDIA_OHOS" ]
43  }
44}
45
46if (hst_is_lite_sys) {
47  group("media_monitor.para") {
48    deps = []
49  }
50} else {
51  ohos_prebuilt_etc("media_monitor.para") {
52    source = "etc/media_monitor.para"
53    part_name = "media_foundation"
54    module_install_dir = "etc/param"
55  }
56}
57
58if (hst_is_lite_sys) {
59  group("media_monitor.para.dac") {
60    deps = []
61  }
62} else {
63  ohos_prebuilt_etc("media_monitor.para.dac") {
64    source = "etc/media_monitor.para.dac"
65    part_name = "media_foundation"
66    module_install_dir = "etc/param"
67  }
68}
69
70if (hst_is_lite_sys) {
71  group("media_monitor_init") {
72    deps = []
73  }
74} else {
75  ohos_prebuilt_etc("media_monitor_init") {
76    source = "etc/media_monitor.cfg"
77    relative_install_dir = "init"
78    part_name = "media_foundation"
79    subsystem_name = "multimedia"
80  }
81}
82
83if (hst_is_lite_sys) {
84  group("media_monitor_buffer") {
85    deps = []
86  }
87} else {
88  ohos_shared_library("media_monitor_buffer") {
89    sanitize = {
90      ubsan = true
91      boundary_sanitize = true
92      cfi = true
93      cfi_cross_dso = true
94      debug = false
95      integer_overflow = true
96    }
97
98    public_configs = [ ":media_monitor_public_config" ]
99
100    install_enable = true
101
102    include_dirs = [
103      "buffer/include",
104      "../../interface/inner_api/common/",
105      "../../interface/inner_api/buffer/",
106    ]
107
108    sources = [
109      "buffer/src/dump_buffer_define.cpp",
110      "buffer/src/dump_buffer_manager.cpp",
111    ]
112
113    cflags = [
114      "-std=c++17",
115      "-fno-rtti",
116      "-fexceptions",
117      "-Wall",
118      "-fno-common",
119      "-fstack-protector-strong",
120      "-Wshadow",
121      "-FPIC",
122      "-FS",
123      "-O2",
124      "-D_FORTIFY_SOURCE=2",
125      "-Wformat=2",
126      "-Wdate-time",
127      "-Werror",
128      "-Wextra",
129      "-Wimplicit-fallthrough",
130      "-Wsign-compare",
131      "-Wunused-parameter",
132      "-Dprivate=public",
133      "-Dprotected=public",
134    ]
135
136    deps = [ "//foundation/multimedia/media_foundation/src:media_foundation" ]
137
138    external_deps = [
139      "c_utils:utils",
140      "hilog:libhilog",
141      "ipc:ipc_single",
142      "samgr:samgr_proxy",
143    ]
144
145    subsystem_name = "multimedia"
146    part_name = "media_foundation"
147    innerapi_tags = [ "platformsdk" ]
148  }
149}
150
151if (hst_is_lite_sys) {
152  group("media_monitor_common") {
153    deps = []
154  }
155} else {
156  ohos_shared_library("media_monitor_common") {
157    branch_protector_ret = "pac_ret"
158    sanitize = {
159      ubsan = true
160      boundary_sanitize = true
161      cfi = true
162      cfi_cross_dso = true
163      debug = false
164      integer_overflow = true
165    }
166
167    public_configs = [ ":media_monitor_public_config" ]
168
169    install_enable = true
170
171    include_dirs = [
172      "buffer/include",
173      "common/include",
174      "../../interface/inner_api/common/",
175    ]
176
177    sources = [
178      "common/src/dump_buffer_wrap.cpp",
179      "common/src/event_bean.cpp",
180      "common/src/monitor_utils.cpp",
181    ]
182
183    cflags = [
184      "-std=c++17",
185      "-fno-rtti",
186      "-fexceptions",
187      "-Wall",
188      "-fno-common",
189      "-fstack-protector-strong",
190      "-Wshadow",
191      "-FPIC",
192      "-FS",
193      "-O2",
194      "-D_FORTIFY_SOURCE=2",
195      "-Wformat=2",
196      "-Wdate-time",
197      "-Werror",
198      "-Wextra",
199      "-Wimplicit-fallthrough",
200      "-Wsign-compare",
201      "-Wunused-parameter",
202      "-Dprivate=public",
203      "-Dprotected=public",
204    ]
205
206    deps = []
207
208    external_deps = [
209      "c_utils:utils",
210      "hilog:libhilog",
211      "ipc:ipc_single",
212      "samgr:samgr_proxy",
213    ]
214
215    subsystem_name = "multimedia"
216    part_name = "media_foundation"
217    innerapi_tags = [ "platformsdk" ]
218  }
219}
220
221if (hst_is_lite_sys) {
222  group("media_monitor") {
223    deps = []
224  }
225} else {
226  ohos_shared_library("media_monitor") {
227    stack_protector_ret = true
228    sanitize = {
229      ubsan = true
230      boundary_sanitize = true
231      cfi = true
232      cfi_cross_dso = true
233      debug = false
234      integer_overflow = true
235    }
236    install_enable = true
237
238    sources = [
239      "server/src/audio_buffer_cache.cpp",
240      "server/src/audio_memo.cpp",
241      "server/src/event_aggregate.cpp",
242      "server/src/ffmpeg_api_wrap.cpp",
243      "server/src/media_audio_encoder.cpp",
244      "server/src/media_event_base_writer.cpp",
245      "server/src/media_monitor_policy.cpp",
246      "server/src/media_monitor_service.cpp",
247      "server/src/media_monitor_stub.cpp",
248    ]
249
250    configs = []
251
252    include_dirs = [
253      "buffer/include",
254      "client/include",
255      "server/include",
256      "common/include",
257      "../../interface/inner_api/common/",
258    ]
259
260    deps = [
261      ":media_monitor.para",
262      ":media_monitor.para.dac",
263      ":media_monitor_common",
264    ]
265
266    external_deps = [
267      "ability_base:want",
268      "audio_framework:audio_client",
269      "bundle_framework:appexecfwk_base",
270      "bundle_framework:appexecfwk_core",
271      "c_utils:utils",
272      "hilog:libhilog",
273      "init:libbegetutil",
274      "ipc:ipc_single",
275      "safwk:system_ability_fwk",
276      "samgr:samgr_proxy",
277    ]
278
279    public_external_deps = [ "ffmpeg:libohosffmpeg" ]
280
281    defines = []
282
283    if (has_hisysevent_part) {
284      defines += [ "MONITOR_ENABLE_HISYSEVENT" ]
285      external_deps += [ "hisysevent:libhisysevent" ]
286    }
287
288    subsystem_name = "multimedia"
289    part_name = "media_foundation"
290  }
291}
292
293if (hst_is_lite_sys) {
294  group("media_monitor_client") {
295    deps = []
296  }
297} else {
298  ohos_shared_library("media_monitor_client") {
299    branch_protector_ret = "pac_ret"
300    sanitize = {
301      ubsan = true
302      boundary_sanitize = true
303      cfi = true
304      cfi_cross_dso = true
305      debug = false
306      integer_overflow = true
307    }
308
309    public_configs = [ ":media_monitor_public_config" ]
310
311    install_enable = true
312
313    sources = [
314      "client/src/media_monitor_client.cpp",
315      "client/src/media_monitor_manager.cpp",
316    ]
317
318    include_dirs = [
319      "buffer/include",
320      "client/include",
321      "server/include",
322      "common/include",
323      "../../interface/inner_api/common/",
324    ]
325
326    deps = [ ":media_monitor_common" ]
327
328    external_deps = [
329      "c_utils:utils",
330      "hilog:libhilog",
331      "init:libbegetutil",
332      "ipc:ipc_single",
333      "samgr:samgr_proxy",
334    ]
335
336    subsystem_name = "multimedia"
337    innerapi_tags = [ "platformsdk" ]
338    part_name = "media_foundation"
339  }
340}
341