• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2023 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/media_foundation/config.gni")
16
17if (hst_is_standard_sys) {
18  config("media_foundation_public_config") {
19    include_dirs = [
20      "$histreamer_root_dir/interface/kits/c",
21      "$histreamer_root_dir/interface/inner_api",
22      "$histreamer_root_dir/interface/inner_api/buffer",
23      "$histreamer_root_dir/interface/inner_api/common",
24      "$histreamer_root_dir/interface/inner_api/meta",
25    ]
26  }
27
28  config("media_foundation_config") {
29    defines = [
30      "HST_ANY_WITH_NO_RTTI",
31      "MEDIA_OHOS",
32    ]
33
34    if (media_foundation_enable_ffrt) {
35      defines += [ "MEDIA_FOUNDATION_FFRT" ]
36    }
37
38    if (media_foundation_enable_rm_demuxer) {
39      defines += [ "SUPPORT_CODEC_RM" ]
40    }
41    if (media_foundation_enable_cook_audio_decoder) {
42      defines += [ "SUPPORT_CODEC_COOK" ]
43    }
44    if (media_foundation_enable_ac3_audio_decoder) {
45      defines += [ "SUPPORT_CODEC_AC3" ]
46    }
47
48    include_dirs = [
49      "$histreamer_root_dir/osal/base",
50      "$histreamer_root_dir/plugin",
51      "$histreamer_root_dir/src/buffer/avbuffer/include",
52      "$histreamer_root_dir/src/buffer/avbuffer_queue/include",
53      "$histreamer_root_dir/src/capi/common",
54    ]
55
56    cflags = [
57      "-O2",
58      "-fPIC",
59      "-Wall",
60      "-fexceptions",
61      "-fno-rtti",
62      "-Wno-unused-but-set-variable",
63      "-Wno-format",
64    ]
65    cflags_cc = cflags
66  }
67
68  ohos_shared_library("media_foundation") {
69    branch_protector_ret = "pac_ret"
70    install_enable = true
71
72    public_configs = [ ":media_foundation_public_config" ]
73
74    configs = [ ":media_foundation_config" ]
75
76    defines = [
77      "HST_ANY_WITH_NO_RTTI",
78      "MEDIA_OHOS",
79      "DYNAMIC_PLUGINS",
80    ]
81
82    sanitize = {
83      ubsan = true
84      boundary_sanitize = true
85      cfi = true
86      cfi_cross_dso = true
87      debug = false
88      integer_overflow = true
89    }
90
91    sources = [
92      "$histreamer_root_dir/src/buffer/avbuffer/av_hardware_memory.cpp",
93      "$histreamer_root_dir/src/buffer/avbuffer/av_shared_memory_ext.cpp",
94      "$histreamer_root_dir/src/buffer/avbuffer/av_surface_memory.cpp",
95      "$histreamer_root_dir/src/buffer/avbuffer/av_virtual_memory.cpp",
96      "$histreamer_root_dir/src/buffer/avbuffer/avbuffer.cpp",
97      "$histreamer_root_dir/src/buffer/avbuffer/avbuffer_common.cpp",
98      "$histreamer_root_dir/src/buffer/avbuffer/avbuffer_utils.cpp",
99      "$histreamer_root_dir/src/buffer/avbuffer/avmemory.cpp",
100    ]
101
102    sources += [
103      "$histreamer_root_dir/src/buffer/avbuffer_queue/avbuffer_queue.cpp",
104      "$histreamer_root_dir/src/buffer/avbuffer_queue/avbuffer_queue_consumer.cpp",
105      "$histreamer_root_dir/src/buffer/avbuffer_queue/avbuffer_queue_producer.cpp",
106      "$histreamer_root_dir/src/buffer/avbuffer_queue/avbuffer_queue_producer_proxy.cpp",
107      "$histreamer_root_dir/src/buffer/avbuffer_queue/avbuffer_queue_producer_stub.cpp",
108    ]
109
110    sources += [
111      "$histreamer_root_dir/src/buffer/avsharedmemory/avsharedmemorybase.cpp",
112    ]
113
114    sources += [
115      "$histreamer_root_dir/src/common/avsharedmemorypool.cpp",
116      "$histreamer_root_dir/src/common/interrupt_monitor.cpp",
117    ]
118
119    sources += [
120      "$histreamer_root_dir/src/meta/any.cpp",
121      "$histreamer_root_dir/src/meta/format.cpp",
122      "$histreamer_root_dir/src/meta/media_source.cpp",
123      "$histreamer_root_dir/src/meta/meta.cpp",
124    ]
125
126    sources += [ "$histreamer_root_dir/src/capi/common/native_mfmagic.cpp" ]
127
128    sources += [
129      "$histreamer_root_dir/src/osal/filesystem/file_system.cpp",
130      "$histreamer_root_dir/src/osal/task/task.cpp",
131      "$histreamer_root_dir/src/osal/utils/dump_buffer.cpp",
132      "$histreamer_root_dir/src/osal/utils/steady_clock.cpp",
133      "$histreamer_root_dir/src/osal/utils/util.cpp",
134    ]
135
136    if (media_foundation_enable_ffrt) {
137      sources += [
138        "$histreamer_root_dir/src/osal/task/ffrt/condition_variable.cpp",
139        "$histreamer_root_dir/src/osal/task/ffrt/jobutils.cpp",
140        "$histreamer_root_dir/src/osal/task/ffrt/task.cpp",
141      ]
142    } else {
143      sources += [
144        "$histreamer_root_dir/src/osal/task/pthread/autolock.cpp",
145        "$histreamer_root_dir/src/osal/task/pthread/condition_variable.cpp",
146        "$histreamer_root_dir/src/osal/task/pthread/jobutils.cpp",
147        "$histreamer_root_dir/src/osal/task/pthread/mutex.cpp",
148        "$histreamer_root_dir/src/osal/task/pthread/pipeline_threadpool.cpp",
149        "$histreamer_root_dir/src/osal/task/pthread/taskInner.cpp",
150        "$histreamer_root_dir/src/osal/task/pthread/thread.cpp",
151      ]
152    }
153
154    sources += [
155      "$histreamer_root_dir/src/filter/filter.cpp",
156      "$histreamer_root_dir/src/filter/filter_factory.cpp",
157      "$histreamer_root_dir/src/pipeline/pipeline.cpp",
158    ]
159
160    sources += [
161      "$histreamer_root_dir/src/plugin/cached_plugin_package.cpp",
162      "$histreamer_root_dir/src/plugin/plugin_buffer.cpp",
163      "$histreamer_root_dir/src/plugin/plugin_list.cpp",
164      "$histreamer_root_dir/src/plugin/plugin_manager_v2.cpp",
165      "$histreamer_root_dir/src/plugin/plugin_package.cpp",
166    ]
167
168    public_deps = []
169
170    external_deps = [
171      "c_utils:utils",
172      "ffmpeg:libohosffmpeg",
173      "graphic_2d:libgraphic_utils",
174      "graphic_surface:sync_fence",
175      "hilog:libhilog",
176      "hitrace:hitrace_meter",
177      "init:libbegetutil",
178      "ipc:ipc_core",
179    ]
180
181    public_external_deps = [
182      "bounds_checking_function:libsec_static",
183      "graphic_surface:surface",
184      "qos_manager:qos",
185      "resource_schedule_service:ressched_client",
186    ]
187
188    if (media_foundation_enable_ffrt) {
189      external_deps += [ "ffrt:libffrt" ]
190    }
191
192    innerapi_tags = [
193      "platformsdk",
194      "sasdk",
195    ]
196
197    if (target_cpu == "arm64" || is_emulator) {
198      hst_plugin_path = "\"/system/lib64/media/media_plugins\""
199    } else {
200      hst_plugin_path = "\"/system/lib/media/media_plugins\""
201    }
202
203    defines += [
204      "HST_PLUGIN_PATH=${hst_plugin_path}",
205      "HST_PLUGIN_FILE_TAIL=\".z.so\"",
206    ]
207
208    subsystem_name = "multimedia"
209    part_name = "media_foundation"
210  }
211} else {
212  group("media_foundation") {
213  }
214}
215