• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2021-2022 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
16declare_args() {
17  if (hst_is_mini_sys) {
18    plugin_dynamic_register = false
19  } else {
20    plugin_dynamic_register = true
21  }
22}
23
24config("hst_plugin_intf_config") {
25  include_dirs = [
26    "//foundation/multimedia/media_foundation/engine/include",
27    "//foundation/multimedia/media_foundation/engine/scene/standard",
28  ]
29  if (hst_is_lite_sys) {
30    include_dirs +=
31        [ "//foundation/multimedia/media_utils_lite/interfaces/kits" ]
32  } else {
33    include_dirs += [
34      "//foundation/multimedia/media_foundation/engine/scene/standard",
35      "//foundation/multimedia/player_framework/interfaces/inner_api/native",
36    ]
37    if (media_foundation_enable_video) {
38      include_dirs += [
39        "//commonlibrary/c_utils/base/include",
40        "//drivers/peripheral/display/interfaces/include",
41        "//foundation/graphic/graphic_surface/surface/include",
42        "//foundation/graphic/graphic_2d/interfaces/inner_api/",
43        "//foundation/graphic/graphic_2d/utils/sync_fence/export",
44      ]
45    }
46  }
47}
48
49if (hst_is_lite_sys) {
50  source_set("histreamer_plugin_intf") {
51    sources = [
52      "common/media_sink.cpp",
53      "common/media_source.cpp",
54      "common/plugin_buffer.cpp",
55    ]
56    public_configs = [
57      ":hst_plugin_intf_config",
58      "//foundation/multimedia/media_foundation:histreamer_presets",
59    ]
60    if (hst_is_mini_sys) {
61      public_deps = [ "//third_party/bounds_checking_function:libsec_static" ]
62    } else {
63      public_deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
64    }
65  }
66} else {
67  ohos_source_set("histreamer_plugin_intf") {
68    subsystem_name = "multimedia"
69    part_name = "media_foundation"
70    sources = [
71      "common/media_sink.cpp",
72      "common/media_source.cpp",
73      "common/plugin_buffer.cpp",
74    ]
75    public_configs = [
76      ":hst_plugin_intf_config",
77      "//foundation/multimedia/media_foundation:histreamer_presets",
78    ]
79    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
80    if (media_foundation_enable_video) {
81      sources += [
82        "common/share_allocator.cpp",
83        "common/share_memory.cpp",
84        "common/surface_allocator.cpp",
85        "common/surface_memory.cpp",
86      ]
87      external_deps = [
88        "c_utils:utils",
89        "graphic_surface:surface",
90        "graphic_surface:sync_fence",
91        "hilog:libhilog",
92        "ipc:ipc_single",
93      ]
94    }
95  }
96}
97
98ohos_source_set("plugin_base") {
99  subsystem_name = "multimedia"
100  part_name = "media_foundation"
101  sources = []
102  public_deps = [
103    ":histreamer_plugin_intf",
104    "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation",
105  ]
106  public_configs =
107      [ "//foundation/multimedia/media_foundation:histreamer_presets" ]
108}
109
110config("histreamer_plugin_base_external_config") {
111  include_dirs = [
112    "//foundation/graphic/graphic_2d/interfaces/inner_api/",
113    "//foundation/multimedia/media_foundation/engine",
114    "//foundation/multimedia/media_foundation/engine/include",
115    "//foundation/multimedia/media_foundation/engine/include/plugin/common",
116    "//foundation/multimedia/media_foundation/engine/include/plugin/core",
117    "//foundation/multimedia/media_foundation/engine/scene/standard",
118  ]
119}
120
121if (hst_is_lite_sys) {
122  import("//build/lite/config/component/lite_component.gni")
123  lite_library("histreamer_plugin_base") {
124    if (hst_is_mini_sys) {
125      target_type = "static_library"
126    } else {
127      target_type = "shared_library"
128    }
129    sources = []
130    deps = [ ":plugin_base" ]
131  }
132} else {
133  import("//build/ohos.gni")
134  ohos_shared_library("histreamer_plugin_base") {
135    subsystem_name = "multimedia"
136    part_name = "media_foundation"
137    public_configs = [ ":histreamer_plugin_base_external_config" ]
138    deps = [ ":plugin_base" ]
139    external_deps = [ "hilog:libhilog" ]
140    sanitize = {
141      cfi = true
142      cfi_cross_dso = true
143      debug = false
144      integer_overflow = true
145    }
146  }
147}
148
149ohos_source_set("ffmpeg_convert") {
150  subsystem_name = "multimedia"
151  part_name = "media_foundation"
152  include_dirs = [
153    "//foundation/multimedia/media_foundation/engine/include",
154    "//third_party/ffmpeg",
155  ]
156  sources = [ "convert/ffmpeg_convert.cpp" ]
157  public_configs =
158      [ "//foundation/multimedia/media_foundation:histreamer_presets" ]
159  public_deps = [
160    "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation",
161    "//foundation/multimedia/media_foundation/engine/pipeline:histreamer_base",
162  ]
163  if (hst_is_standard_sys) {
164    public_deps += [ "//third_party/ffmpeg:libohosffmpeg" ]
165    external_deps = [ "hilog:libhilog" ]
166  }
167}
168
169if (hst_is_lite_sys) {
170  import("//build/lite/config/component/lite_component.gni")
171  lite_library("histreamer_ffmpeg_convert") {
172    if (hst_is_mini_sys) {
173      target_type = "static_library"
174    } else {
175      target_type = "shared_library"
176    }
177    sources = []
178    deps = [ ":ffmpeg_convert" ]
179  }
180} else {
181  import("//build/ohos.gni")
182  ohos_shared_library("histreamer_ffmpeg_convert") {
183    subsystem_name = "multimedia"
184    part_name = "media_foundation"
185    include_dirs = [
186      "//foundation/multimedia/media_foundation/engine/include",
187      "//third_party/ffmpeg",
188    ]
189    deps = [ ":ffmpeg_convert" ]
190    external_deps = [ "hilog:libhilog" ]
191    sanitize = {
192      cfi = true
193      cfi_cross_dso = true
194      debug = false
195      integer_overflow = true
196    }
197  }
198}
199
200ohos_source_set("histreamer_plugin_core") {
201  subsystem_name = "multimedia"
202  part_name = "media_foundation"
203  include_dirs = [ "//foundation/multimedia/media_foundation/engine/include" ]
204  sources = [
205    "core/audio_sink.cpp",
206    "core/base.cpp",
207    "core/codec.cpp",
208    "core/demuxer.cpp",
209    "core/muxer.cpp",
210    "core/output_sink.cpp",
211    "core/plugin_core_utils.cpp",
212    "core/plugin_manager.cpp",
213    "core/plugin_register.cpp",
214    "core/plugin_wrapper.cpp",
215    "core/source.cpp",
216    "core/video_sink.cpp",
217  ]
218  defines = []
219  if (plugin_dynamic_register) {
220    sources += [ "core/plugin_loader.cpp" ]
221    defines += [ "DYNAMIC_PLUGINS" ]
222  }
223  public_configs =
224      [ "//foundation/multimedia/media_foundation:histreamer_presets" ]
225  public_deps = [
226    ":histreamer_plugin_base",
227    "plugins:gen_plugin_static_header",
228    "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation",
229  ]
230  if (hst_is_lite_sys) {
231    defines += [
232      "HST_PLUGIN_PATH=\"/usr/lib\"",
233      "HST_PLUGIN_FILE_TAIL=\".so\"",
234    ]
235    include_dirs +=
236        [ "//foundation/multimedia/media_utils_lite/interfaces/kits" ]
237    if (hst_is_mini_sys) {
238      public_deps += [ "//third_party/bounds_checking_function:libsec_static" ]
239    } else {
240      public_deps += [ "//third_party/bounds_checking_function:libsec_shared" ]
241    }
242  } else {
243    if (target_cpu == "arm64") {
244      hst_plugin_path = "\"/system/lib64/media/histreamer_plugins\""
245    } else {
246      hst_plugin_path = "\"/system/lib/media/histreamer_plugins\""
247    }
248    defines += [
249      "HST_PLUGIN_PATH=${hst_plugin_path}",
250      "HST_PLUGIN_FILE_TAIL=\".z.so\"",
251    ]
252    include_dirs += [
253      "//commonlibrary/c_utils/base/include",
254      "//foundation/graphic/graphic_surface/surface/include",
255      "//foundation/graphic/graphic_2d/interfaces/inner_api/",
256      "//foundation/multimedia/player_framework/interfaces/inner_api/native",
257      "//drivers/peripheral/display/interfaces/include",
258    ]
259    deps = [ "//third_party/bounds_checking_function:libsec_shared" ]
260    external_deps = [
261      "graphic_surface:surface",
262      "ipc:ipc_single",
263    ]
264  }
265}
266