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