1# Copyright (c) 2021-2021 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 16if (!hst_is_lite_sys) { 17 ohos_kernel_type = "" 18} 19 20group("plugin_ffmpeg_adapter") { 21 deps = [] 22 if (ohos_kernel_type != "liteos_m") { 23 deps += [ 24 ":histreamer_plugin_FFmpegAudioDecoders", 25 ":histreamer_plugin_FFmpegDemuxer", 26 ] 27 if (media_foundation_enable_video) { 28 deps += [ ":histreamer_plugin_FFmpegVideoDecoders" ] 29 } 30 } 31 if (!hst_is_lite_sys && media_foundation_enable_recorder) { 32 deps += [ 33 ":histreamer_plugin_FFmpegAudioEncoders", 34 ":histreamer_plugin_FFmpegMuxers", 35 ] 36 if (media_foundation_enable_video) { 37 deps += [ ":histreamer_plugin_FFmpegVideoEncoders" ] 38 } 39 } 40} 41config("plugin_ffmpeg_adapter_config") { 42 include_dirs = [ 43 "//foundation/multimedia/media_foundation/engine/include/", 44 "//foundation/multimedia/media_foundation/engine/plugin/", 45 ] 46} 47 48ohos_source_set("ffmpeg_adapter_common") { 49 subsystem_name = "multimedia" 50 part_name = "media_foundation" 51 sources = [ "utils/ffmpeg_utils.cpp" ] 52 public_configs = [ 53 ":plugin_ffmpeg_adapter_config", 54 "//foundation/multimedia/media_foundation:histreamer_presets", 55 ] 56 public_deps = [ 57 "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation", 58 "//foundation/multimedia/media_foundation/engine/plugin:histreamer_plugin_base", 59 ] 60 if (!hst_is_lite_sys) { 61 external_deps = [ 62 "graphic_surface:surface", 63 "hilog:libhilog", 64 "ipc:ipc_core", 65 ] 66 } 67 if (hst_is_lite_sys) { 68 print("histreamer audio encoder plugin only supports standard system") 69 include_dirs = [ "//third_party/ffmpeg" ] 70 } else { 71 public_external_deps = [ "ffmpeg:libohosffmpeg" ] 72 } 73} 74 75ohos_source_set("ffmpeg_audio_decoders") { 76 subsystem_name = "multimedia" 77 part_name = "media_foundation" 78 sources = [ "audio_decoder/audio_ffmpeg_decoder_plugin.cpp" ] 79 public_configs = [ 80 ":plugin_ffmpeg_adapter_config", 81 "//foundation/multimedia/media_foundation:histreamer_presets", 82 ] 83 public_deps = [ 84 "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation", 85 "//foundation/multimedia/media_foundation/engine/plugin:histreamer_plugin_base", 86 ] 87 if (!hst_is_lite_sys) { 88 external_deps = [ 89 "graphic_surface:surface", 90 "hilog:libhilog", 91 "ipc:ipc_core", 92 ] 93 } 94 if (hst_is_lite_sys) { 95 include_dirs = [ "//third_party/ffmpeg" ] 96 # deps on lite 97 } else { 98 public_external_deps = [ "ffmpeg:libohosffmpeg" ] 99 } 100} 101ohos_source_set("ffmpeg_demuxers") { 102 subsystem_name = "multimedia" 103 part_name = "media_foundation" 104 sources = [ 105 "demuxer/ffmpeg_demuxer_plugin.cpp", 106 "demuxer/ffmpeg_track_meta.cpp", 107 "utils/aac_audio_config_parser.cpp", 108 "utils/bit_reader.cpp", 109 ] 110 if (media_foundation_enable_video) { 111 sources += [ "utils/avc_config_data_parser.cpp" ] 112 } 113 public_configs = [ 114 ":plugin_ffmpeg_adapter_config", 115 "//foundation/multimedia/media_foundation:histreamer_presets", 116 ] 117 public_deps = [ 118 "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation", 119 "//foundation/multimedia/media_foundation/engine/plugin:histreamer_plugin_base", 120 ] 121 if (!hst_is_lite_sys) { 122 external_deps = [ 123 "graphic_surface:surface", 124 "hilog:libhilog", 125 "ipc:ipc_core", 126 ] 127 } 128 129 if (hst_is_lite_sys) { 130 include_dirs = [ "//third_party/ffmpeg" ] 131 # deps on lite 132 } else { 133 public_external_deps = [ "ffmpeg:libohosffmpeg" ] 134 } 135} 136 137ohos_source_set("ffmpeg_audio_encoders") { 138 subsystem_name = "multimedia" 139 part_name = "media_foundation" 140 sources = [ 141 "audio_encoder/audio_ffmpeg_encoder_plugin.cpp", 142 "audio_encoder/ffmpeg_au_enc_config.cpp", 143 ] 144 public_configs = [ 145 ":plugin_ffmpeg_adapter_config", 146 "//foundation/multimedia/media_foundation:histreamer_presets", 147 ] 148 public_deps = [ 149 "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation", 150 "//foundation/multimedia/media_foundation/engine/plugin:histreamer_ffmpeg_convert", 151 "//foundation/multimedia/media_foundation/engine/plugin:histreamer_plugin_base", 152 ] 153 if (!hst_is_lite_sys) { 154 external_deps = [ 155 "graphic_surface:surface", 156 "hilog:libhilog", 157 "ipc:ipc_core", 158 ] 159 } 160 if (hst_is_lite_sys) { 161 include_dirs = [ "//third_party/ffmpeg" ] 162 print("histreamer audio encoder plugin only supports standard system") 163 } else { 164 public_external_deps = [ "ffmpeg:libohosffmpeg" ] 165 } 166} 167 168ohos_source_set("ffmpeg_video_decoders") { 169 subsystem_name = "multimedia" 170 part_name = "media_foundation" 171 sources = [ "video_decoder/video_ffmpeg_decoder_plugin.cpp" ] 172 public_configs = [ 173 ":plugin_ffmpeg_adapter_config", 174 "//foundation/multimedia/media_foundation:histreamer_presets", 175 ] 176 public_deps = [ 177 "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation", 178 "//foundation/multimedia/media_foundation/engine/plugin:histreamer_ffmpeg_convert", 179 "//foundation/multimedia/media_foundation/engine/plugin:histreamer_plugin_base", 180 ] 181 if (!hst_is_lite_sys) { 182 external_deps = [ 183 "graphic_surface:surface", 184 "hilog:libhilog", 185 "ipc:ipc_core", 186 ] 187 } 188 if (hst_is_lite_sys) { 189 include_dirs = [ "//third_party/ffmpeg" ] 190 print("histreamer video decoder plugin only supports standard system") 191 } else { 192 public_external_deps = [ "ffmpeg:libohosffmpeg" ] 193 } 194} 195 196ohos_source_set("ffmpeg_video_encoders") { 197 subsystem_name = "multimedia" 198 part_name = "media_foundation" 199 sources = [ 200 "video_encoder/ffmpeg_vid_enc_config.cpp", 201 "video_encoder/video_ffmpeg_encoder_plugin.cpp", 202 ] 203 public_configs = [ 204 ":plugin_ffmpeg_adapter_config", 205 "//foundation/multimedia/media_foundation:histreamer_presets", 206 ] 207 public_deps = [ 208 "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation", 209 "//foundation/multimedia/media_foundation/engine/plugin:histreamer_plugin_base", 210 ] 211 if (!hst_is_lite_sys) { 212 external_deps = [ 213 "graphic_surface:surface", 214 "hilog:libhilog", 215 "ipc:ipc_core", 216 ] 217 } 218 if (hst_is_lite_sys) { 219 include_dirs = [ "//third_party/ffmpeg" ] 220 print("histreamer video encoder plugin only supports standard system") 221 } else { 222 public_external_deps = [ "ffmpeg:libohosffmpeg" ] 223 } 224} 225 226ohos_source_set("ffmpeg_muxers") { 227 subsystem_name = "multimedia" 228 part_name = "media_foundation" 229 sources = [ 230 "muxer/ffmpeg_muxer_plugin.cpp", 231 "utils/ffmpeg_codec_map.cpp", 232 ] 233 public_configs = [ 234 ":plugin_ffmpeg_adapter_config", 235 "//foundation/multimedia/media_foundation:histreamer_presets", 236 ] 237 public_deps = [ 238 "//foundation/multimedia/media_foundation/engine/foundation:histreamer_foundation", 239 "//foundation/multimedia/media_foundation/engine/plugin:histreamer_plugin_base", 240 ] 241 if (!hst_is_lite_sys) { 242 external_deps = [ 243 "graphic_surface:surface", 244 "hilog:libhilog", 245 "ipc:ipc_core", 246 ] 247 } 248 if (hst_is_lite_sys) { 249 include_dirs = [ "//third_party/ffmpeg" ] 250 print("histreamer ffmpeg muxer plugin only supports standard system") 251 } else { 252 public_external_deps = [ "ffmpeg:libohosffmpeg" ] 253 } 254} 255 256if (hst_is_lite_sys) { 257 # lite 258 import("//build/lite/config/component/lite_component.gni") 259 if (ohos_kernel_type == "liteos_m") { 260 # plugin is not need on this platform 261 } else { 262 lite_library("histreamer_plugin_FFmpegAudioDecoders") { 263 target_type = "shared_library" 264 sources = [] 265 deps = [ 266 ":ffmpeg_adapter_common", 267 ":ffmpeg_audio_decoders", 268 ] 269 ldflags = [ 270 "-lavcodec", 271 "-lswresample", 272 ] 273 } 274 lite_library("histreamer_plugin_FFmpegDemuxer") { 275 target_type = "shared_library" 276 sources = [] 277 deps = [ 278 ":ffmpeg_adapter_common", 279 ":ffmpeg_demuxers", 280 ] 281 ldflags = [ 282 "-lavformat", 283 "-lavcodec", 284 ] 285 } 286 } 287} else { 288 # standard 289 import("//build/ohos.gni") 290 ohos_shared_library("histreamer_plugin_FFmpegAudioDecoders") { 291 sanitize = { 292 cfi = true 293 cfi_cross_dso = true 294 debug = false 295 integer_overflow = true 296 } 297 deps = [ 298 ":ffmpeg_adapter_common", 299 ":ffmpeg_audio_decoders", 300 ] 301 external_deps = [ "hilog:libhilog" ] 302 relative_install_dir = "media/histreamer_plugins" 303 subsystem_name = "multimedia" 304 part_name = "media_foundation" 305 } 306 ohos_shared_library("histreamer_plugin_FFmpegVideoDecoders") { 307 sanitize = { 308 cfi = true 309 cfi_cross_dso = true 310 debug = false 311 integer_overflow = true 312 } 313 deps = [ 314 ":ffmpeg_adapter_common", 315 ":ffmpeg_video_decoders", 316 ] 317 external_deps = [ "hilog:libhilog" ] 318 relative_install_dir = "media/histreamer_plugins" 319 subsystem_name = "multimedia" 320 part_name = "media_foundation" 321 } 322 ohos_shared_library("histreamer_plugin_FFmpegDemuxer") { 323 sanitize = { 324 cfi = true 325 cfi_cross_dso = true 326 debug = false 327 integer_overflow = true 328 } 329 deps = [ 330 ":ffmpeg_adapter_common", 331 ":ffmpeg_demuxers", 332 ] 333 external_deps = [ "hilog:libhilog" ] 334 relative_install_dir = "media/histreamer_plugins" 335 subsystem_name = "multimedia" 336 part_name = "media_foundation" 337 } 338 ohos_shared_library("histreamer_plugin_FFmpegAudioEncoders") { 339 sanitize = { 340 cfi = true 341 cfi_cross_dso = true 342 debug = false 343 integer_overflow = true 344 } 345 deps = [ 346 ":ffmpeg_adapter_common", 347 ":ffmpeg_audio_encoders", 348 ] 349 external_deps = [ "hilog:libhilog" ] 350 relative_install_dir = "media/histreamer_plugins" 351 subsystem_name = "multimedia" 352 part_name = "media_foundation" 353 } 354 ohos_shared_library("histreamer_plugin_FFmpegVideoEncoders") { 355 sanitize = { 356 cfi = true 357 cfi_cross_dso = true 358 debug = false 359 integer_overflow = true 360 } 361 deps = [ 362 ":ffmpeg_adapter_common", 363 ":ffmpeg_video_encoders", 364 ] 365 external_deps = [ "hilog:libhilog" ] 366 relative_install_dir = "media/histreamer_plugins" 367 subsystem_name = "multimedia" 368 part_name = "media_foundation" 369 } 370 ohos_shared_library("histreamer_plugin_FFmpegMuxers") { 371 sanitize = { 372 cfi = true 373 cfi_cross_dso = true 374 debug = false 375 integer_overflow = true 376 } 377 deps = [ 378 ":ffmpeg_adapter_common", 379 ":ffmpeg_muxers", 380 ] 381 external_deps = [ "hilog:libhilog" ] 382 relative_install_dir = "media/histreamer_plugins" 383 subsystem_name = "multimedia" 384 part_name = "media_foundation" 385 } 386} 387