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