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