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 (multimedia_histreamer_enable_video) { 28 deps += [ ":histreamer_plugin_FFmpegVideoDecoders" ] 29 } 30 } 31 if (!hst_is_lite_sys && multimedia_histreamer_enable_recorder) { 32 deps += [ 33 ":histreamer_plugin_FFmpegAudioEncoders", 34 ":histreamer_plugin_FFmpegMuxers", 35 ] 36 if (multimedia_histreamer_enable_video) { 37 deps += [ ":histreamer_plugin_FFmpegVideoEncoders" ] 38 } 39 } 40} 41config("plugin_ffmpeg_adapter_config") { 42 include_dirs = [ "//third_party/ffmpeg" ] 43} 44 45source_set("ffmpeg_audio_decoders") { 46 sources = [ 47 "audio_decoder/audio_ffmpeg_decoder_plugin.cpp", 48 "utils/ffmpeg_utils.cpp", 49 ] 50 public_configs = [ 51 ":plugin_ffmpeg_adapter_config", 52 "//foundation/multimedia/histreamer:histreamer_presets", 53 ] 54 public_deps = [ 55 "//foundation/multimedia/histreamer/engine/foundation:histreamer_foundation", 56 "//foundation/multimedia/histreamer/engine/plugin:histreamer_plugin_intf", 57 ] 58 if (hst_is_lite_sys) { 59 # deps on lite 60 } else { 61 public_deps += [ "//third_party/ffmpeg:libohosffmpeg" ] 62 } 63} 64source_set("ffmpeg_demuxers") { 65 sources = [ 66 "demuxer/ffmpeg_demuxer_plugin.cpp", 67 "demuxer/ffmpeg_track_meta.cpp", 68 "utils/aac_audio_config_parser.cpp", 69 "utils/bit_reader.cpp", 70 "utils/ffmpeg_utils.cpp", 71 ] 72 if (multimedia_histreamer_enable_video) { 73 sources += [ "utils/avc_config_data_parser.cpp" ] 74 } 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_intf", 82 ] 83 84 if (hst_is_lite_sys) { 85 # deps on lite 86 } else { 87 public_deps += [ "//third_party/ffmpeg:libohosffmpeg" ] 88 } 89} 90 91source_set("ffmpeg_audio_encoders") { 92 sources = [ 93 "audio_encoder/audio_ffmpeg_encoder_plugin.cpp", 94 "audio_encoder/ffmpeg_au_enc_config.cpp", 95 "utils/ffmpeg_utils.cpp", 96 ] 97 public_configs = [ 98 ":plugin_ffmpeg_adapter_config", 99 "//foundation/multimedia/histreamer:histreamer_presets", 100 ] 101 public_deps = [ 102 "//foundation/multimedia/histreamer/engine/foundation:histreamer_foundation", 103 "//foundation/multimedia/histreamer/engine/plugin:histreamer_plugin_intf", 104 ] 105 if (hst_is_lite_sys) { 106 print("histreamer audio encoder plugin only supports standard system") 107 } else { 108 public_deps += [ "//third_party/ffmpeg:libohosffmpeg" ] 109 } 110} 111 112source_set("ffmpeg_video_decoders") { 113 sources = [ 114 "utils/ffmpeg_utils.cpp", 115 "video_decoder/video_ffmpeg_decoder_plugin.cpp", 116 ] 117 public_configs = [ 118 ":plugin_ffmpeg_adapter_config", 119 "//foundation/multimedia/histreamer:histreamer_presets", 120 ] 121 public_deps = [ 122 "//foundation/multimedia/histreamer/engine/foundation:histreamer_foundation", 123 "//foundation/multimedia/histreamer/engine/plugin:histreamer_plugin_intf", 124 ] 125 if (hst_is_lite_sys) { 126 print("histreamer video decoder plugin only supports standard system") 127 } else { 128 public_deps += [ "//third_party/ffmpeg:libohosffmpeg" ] 129 } 130} 131 132source_set("ffmpeg_video_encoders") { 133 sources = [ 134 "utils/ffmpeg_utils.cpp", 135 "video_encoder/ffmpeg_vid_enc_config.cpp", 136 "video_encoder/video_ffmpeg_encoder_plugin.cpp", 137 ] 138 public_configs = [ 139 ":plugin_ffmpeg_adapter_config", 140 "//foundation/multimedia/histreamer:histreamer_presets", 141 ] 142 public_deps = [ 143 "//foundation/multimedia/histreamer/engine/foundation:histreamer_foundation", 144 "//foundation/multimedia/histreamer/engine/plugin:histreamer_plugin_intf", 145 ] 146 if (hst_is_lite_sys) { 147 print("histreamer video encoder plugin only supports standard system") 148 } else { 149 public_deps += [ "//third_party/ffmpeg:libohosffmpeg" ] 150 } 151} 152 153source_set("ffmpeg_muxers") { 154 sources = [ 155 "muxer/ffmpeg_muxer_plugin.cpp", 156 "utils/ffmpeg_codec_map.cpp", 157 "utils/ffmpeg_utils.cpp", 158 ] 159 public_configs = [ 160 ":plugin_ffmpeg_adapter_config", 161 "//foundation/multimedia/histreamer:histreamer_presets", 162 ] 163 public_deps = [ 164 "//foundation/multimedia/histreamer/engine/foundation:histreamer_foundation", 165 "//foundation/multimedia/histreamer/engine/plugin:histreamer_plugin_intf", 166 ] 167 if (hst_is_lite_sys) { 168 print("histreamer ffmpeg muxer plugin only supports standard system") 169 } else { 170 public_deps += [ "//third_party/ffmpeg:libohosffmpeg" ] 171 } 172} 173 174if (hst_is_lite_sys) { 175 # lite 176 import("//build/lite/config/component/lite_component.gni") 177 if (ohos_kernel_type == "liteos_m") { 178 # plugin is not need on this platform 179 } else { 180 lite_library("histreamer_plugin_FFmpegAudioDecoders") { 181 target_type = "shared_library" 182 sources = [] 183 deps = [ ":ffmpeg_audio_decoders" ] 184 ldflags = [ 185 "-lavcodec", 186 "-lswresample", 187 ] 188 } 189 lite_library("histreamer_plugin_FFmpegDemuxer") { 190 target_type = "shared_library" 191 sources = [] 192 deps = [ ":ffmpeg_demuxers" ] 193 ldflags = [ 194 "-lavformat", 195 "-lavcodec", 196 ] 197 } 198 } 199} else { 200 # standard 201 import("//build/ohos.gni") 202 ohos_shared_library("histreamer_plugin_FFmpegAudioDecoders") { 203 sanitize = { 204 cfi = true 205 debug = false 206 } 207 deps = [ ":ffmpeg_audio_decoders" ] 208 relative_install_dir = "media/histreamer_plugins" 209 subsystem_name = "multimedia" 210 part_name = "multimedia_histreamer" 211 } 212 ohos_shared_library("histreamer_plugin_FFmpegVideoDecoders") { 213 sanitize = { 214 cfi = true 215 debug = false 216 } 217 deps = [ ":ffmpeg_video_decoders" ] 218 relative_install_dir = "media/histreamer_plugins" 219 subsystem_name = "multimedia" 220 part_name = "multimedia_histreamer" 221 } 222 ohos_shared_library("histreamer_plugin_FFmpegDemuxer") { 223 sanitize = { 224 cfi = true 225 debug = false 226 } 227 deps = [ ":ffmpeg_demuxers" ] 228 relative_install_dir = "media/histreamer_plugins" 229 subsystem_name = "multimedia" 230 part_name = "multimedia_histreamer" 231 } 232 ohos_shared_library("histreamer_plugin_FFmpegAudioEncoders") { 233 sanitize = { 234 cfi = true 235 debug = false 236 } 237 deps = [ ":ffmpeg_audio_encoders" ] 238 relative_install_dir = "media/histreamer_plugins" 239 subsystem_name = "multimedia" 240 part_name = "multimedia_histreamer" 241 } 242 ohos_shared_library("histreamer_plugin_FFmpegVideoEncoders") { 243 sanitize = { 244 cfi = true 245 debug = false 246 } 247 deps = [ ":ffmpeg_video_encoders" ] 248 relative_install_dir = "media/histreamer_plugins" 249 subsystem_name = "multimedia" 250 part_name = "multimedia_histreamer" 251 } 252 ohos_shared_library("histreamer_plugin_FFmpegMuxers") { 253 sanitize = { 254 cfi = true 255 debug = false 256 } 257 deps = [ ":ffmpeg_muxers" ] 258 relative_install_dir = "media/histreamer_plugins" 259 subsystem_name = "multimedia" 260 part_name = "multimedia_histreamer" 261 } 262} 263