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