• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2023-2025 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("//foundation/multimedia/player_framework/config.gni")
16
17group("capi_packages") {
18  deps = []
19  if (player_framework_support_capi) {
20    deps += [
21      "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:avimage_generator",
22      "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:avmetadata_extractor",
23      "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:avplayer",
24      "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:avrecorder",
25      "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:avtranscoder",
26      "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:lowpower_avsink",
27      "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c:native_avscreen_capture",
28    ]
29  }
30}
31
32config("media_capi_config") {
33  include_dirs = [
34    "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native",
35    "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c",
36    "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/common",
37    "$MEDIA_PLAYER_ROOT_DIR/services/utils/include",
38  ]
39
40  cflags = [
41    "-fno-exceptions",
42    "-Wall",
43    "-fno-common",
44    "-fstack-protector-all",
45    "-Wshadow",
46    "-FPIC",
47    "-FS",
48    "-O2",
49    "-D_FORTIFY_SOURCE=2",
50    "-Wformat=2",
51    "-Wdate-time",
52  ]
53
54  cflags_cc = [
55    "-std=c++17",
56    "-fno-rtti",
57  ]
58}
59
60config("media_capi_public_config") {
61  include_dirs = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/kits/c" ]
62}
63
64ohos_shared_library("native_avscreen_capture") {
65  stack_protector_ret = true
66  install_enable = true
67
68  sanitize = {
69    integer_overflow = true
70    ubsan = true
71    boundary_sanitize = true
72    cfi = true
73    cfi_cross_dso = true
74    debug = false
75  }
76
77  sources = [ "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/screencapture/native_avscreen_capture.cpp" ]
78
79  configs = [ ":media_capi_config" ]
80
81  public_configs = [ ":media_capi_public_config" ]
82
83  deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ]
84
85  external_deps = [
86    "audio_framework:audio_client",
87    "av_codec:av_codec_client",
88    "c_utils:utils",
89    "graphic_surface:surface",
90    "hilog:libhilog",
91    "ipc:ipc_core",
92    "media_foundation:media_foundation",
93    "qos_manager:qos",
94    "window_manager:libdm",
95  ]
96  output_extension = "so"
97  subsystem_name = "multimedia"
98  part_name = "player_framework"
99}
100
101ohos_shared_library("avplayer") {
102  stack_protector_ret = true
103  install_enable = true
104
105  sanitize = {
106    integer_overflow = true
107    ubsan = true
108    boundary_sanitize = true
109    cfi = true
110    cfi_cross_dso = true
111    debug = false
112  }
113
114  configs = [ ":media_capi_config" ]
115
116  public_configs = [ ":media_capi_public_config" ]
117
118  sources = [
119    "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/player/native_avplayer.cpp",
120  ]
121
122  deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ]
123
124  external_deps = [
125    "audio_framework:audio_capturer",
126    "av_codec:av_codec_client",
127    "c_utils:utils",
128    "graphic_surface:surface",
129    "hilog:libhilog",
130    "hisysevent:libhisysevent",
131    "ipc:ipc_core",
132    "media_foundation:media_foundation",
133    "samgr:samgr_proxy",
134    "window_manager:libdm",
135  ]
136  if (player_framework_support_drm) {
137    public_external_deps = [
138      "drm_framework:drm_framework",
139      "drm_framework:native_drm",
140    ]
141  }
142
143  defines = []
144  defines += player_framework_defines
145
146  output_extension = "so"
147  subsystem_name = "multimedia"
148  part_name = "player_framework"
149}
150
151ohos_shared_library("avrecorder") {
152  stack_protector_ret = true
153  install_enable = true
154
155  sanitize = {
156    integer_overflow = true
157    ubsan = true
158    boundary_sanitize = true
159    cfi = true
160    cfi_cross_dso = true
161    debug = false
162  }
163
164  sources = [ "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/recorder/native_avrecorder.cpp" ]
165
166  configs = [ ":media_capi_config" ]
167
168  public_configs = [ ":media_capi_public_config" ]
169
170  deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ]
171
172  external_deps = [
173    "audio_framework:audio_client",
174    "av_codec:av_codec_client",
175    "c_utils:utils",
176    "graphic_surface:surface",
177    "hilog:libhilog",
178    "image_framework:image",
179    "image_framework:image_native",
180    "image_framework:image_source",
181    "image_framework:ohimage",
182    "ipc:ipc_core",
183    "media_foundation:media_foundation",
184    "napi:ace_napi",
185    "qos_manager:qos",
186    "resource_management:librawfile",
187    "window_manager:libdm",
188  ]
189
190  if (player_framework_support_auto_create_file) {
191    external_deps += [
192      "media_library:media_library",
193      "media_library:media_library_asset_manager",
194      "media_library:native_media_asset_manager",
195    ]
196  }
197
198  output_extension = "so"
199  subsystem_name = "multimedia"
200  part_name = "player_framework"
201}
202
203ohos_shared_library("avimage_generator") {
204  stack_protector_ret = true
205  install_enable = true
206
207  sanitize = {
208    integer_overflow = true
209    ubsan = true
210    boundary_sanitize = true
211    cfi = true
212    cfi_cross_dso = true
213    debug = false
214  }
215
216  cflags = [ "--coverage" ]
217  ldflags = [ "--coverage" ]
218
219  sources = [ "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/avmetadatahelper/native_avimage_generator.cpp" ]
220
221  configs = [ ":media_capi_config" ]
222
223  public_configs = [ ":media_capi_public_config" ]
224
225  deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ]
226
227  external_deps = [
228    "audio_framework:audio_capturer",
229    "av_codec:av_codec_client",
230    "c_utils:utils",
231    "graphic_surface:surface",
232    "hilog:libhilog",
233    "hisysevent:libhisysevent",
234    "image_framework:ohimage",
235    "image_framework:pixelmap",
236    "ipc:ipc_core",
237    "media_foundation:media_foundation",
238    "qos_manager:qos",
239    "samgr:samgr_proxy",
240    "window_manager:libdm",
241  ]
242
243  innerapi_tags = [ "ndk" ]
244
245  output_extension = "so"
246  subsystem_name = "multimedia"
247  part_name = "player_framework"
248}
249
250ohos_shared_library("avmetadata_extractor") {
251  stack_protector_ret = true
252  install_enable = true
253
254  sanitize = {
255    integer_overflow = true
256    ubsan = true
257    boundary_sanitize = true
258    cfi = true
259    cfi_cross_dso = true
260    debug = false
261  }
262
263  configs = [ ":media_capi_config" ]
264
265  public_configs = [ ":media_capi_public_config" ]
266
267  cflags_cc = [ "--coverage" ]
268  cflags = [ "--coverage" ]
269  ldflags = [ "--coverage" ]
270
271  sources = [ "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/avmetadatahelper/native_avmetadata_extractor.cpp" ]
272
273  deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ]
274
275  external_deps = [
276    "audio_framework:audio_capturer",
277    "av_codec:av_codec_client",
278    "c_utils:utils",
279    "graphic_surface:surface",
280    "hilog:libhilog",
281    "hisysevent:libhisysevent",
282    "image_framework:image_native",
283    "image_framework:ohimage",
284    "image_framework:pixelmap",
285    "ipc:ipc_core",
286    "media_foundation:media_foundation",
287    "samgr:samgr_proxy",
288    "window_manager:libdm",
289  ]
290  if (player_framework_support_drm) {
291    public_external_deps = [
292      "drm_framework:drm_framework",
293      "drm_framework:native_drm",
294    ]
295  }
296
297  defines = []
298  defines += player_framework_defines
299
300  innerapi_tags = [ "ndk" ]
301
302  output_extension = "so"
303  subsystem_name = "multimedia"
304  part_name = "player_framework"
305}
306
307ohos_shared_library("avtranscoder") {
308  stack_protector_ret = true
309  install_enable = true
310
311  sanitize = {
312    integer_overflow = true
313    ubsan = true
314    boundary_sanitize = true
315    cfi = true
316    cfi_cross_dso = true
317    debug = false
318  }
319
320  configs = [ ":media_capi_config" ]
321
322  public_configs = [ ":media_capi_public_config" ]
323
324  cflags_cc = [ "--coverage" ]
325  cflags = [ "--coverage" ]
326  ldflags = [ "--coverage" ]
327
328  sources = [
329    "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/avtranscoder/native_avtranscoder.cpp",
330  ]
331
332  deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ]
333
334  external_deps = [
335    "audio_framework:audio_capturer",
336    "av_codec:av_codec_client",
337    "c_utils:utils",
338    "graphic_surface:surface",
339    "hilog:libhilog",
340    "hisysevent:libhisysevent",
341    "ipc:ipc_core",
342    "media_foundation:media_foundation",
343    "samgr:samgr_proxy",
344    "window_manager:libdm",
345  ]
346
347  innerapi_tags = [ "ndk" ]
348
349  defines = []
350  defines += player_framework_defines
351
352  output_extension = "so"
353  subsystem_name = "multimedia"
354  part_name = "player_framework"
355}
356
357ohos_shared_library("lowpower_avsink") {
358  stack_protector_ret = true
359  install_enable = true
360
361  sanitize = {
362    integer_overflow = true
363    ubsan = true
364    boundary_sanitize = true
365    cfi = true
366    cfi_cross_dso = true
367    debug = false
368  }
369
370  sources = [
371    "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/lppplayer/native_lpp_audio_streamer.cpp",
372    "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/common/lpp_common.cpp",
373    "$MEDIA_PLAYER_ROOT_DIR/frameworks/native/capi/lppplayer/native_lpp_video_streamer.cpp",
374  ]
375
376  configs = [ ":media_capi_config" ]
377
378  public_configs = [ ":media_capi_public_config" ]
379
380  deps = [ "$MEDIA_PLAYER_ROOT_DIR/interfaces/inner_api/native:media_client" ]
381
382  external_deps = [
383    "audio_framework:audio_capturer",
384    "av_codec:av_codec_client",
385    "c_utils:utils",
386    "graphic_surface:surface",
387    "hilog:libhilog",
388    "init:libbegetutil",
389    "ipc:ipc_core",
390    "media_foundation:media_foundation",
391    "image_framework:pixelmap",
392    "hisysevent:libhisysevent",
393  ]
394  innerapi_tags = [ "ndk" ]
395  output_extension = "so"
396  subsystem_name = "multimedia"
397  part_name = "player_framework"
398}