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