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