• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2025 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("//build/test.gni")
15import("//foundation/multimedia/av_codec/config.gni")
16
17module_output_path = "av_codec/AVCodec_Video/unittest"
18demuxer_plugin_test_sources = [
19  "$av_codec_root_dir/services/media_engine/modules/demuxer/base_stream_demuxer.cpp",
20  "$av_codec_root_dir/services/media_engine/modules/demuxer/demuxer_plugin_manager.cpp",
21  "$av_codec_root_dir/services/media_engine/modules/demuxer/stream_demuxer.cpp",
22  "$av_codec_root_dir/services/media_engine/modules/demuxer/type_finder.cpp",
23  "$av_codec_root_dir/services/media_engine/modules/source/source.cpp",
24  "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_demuxer_plugin.cpp",
25  "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_demuxer_thread.cpp",
26  "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/demuxer/block_queue_pool.cpp",
27  "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/demuxer/ffmpeg_format_helper.cpp",
28  "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/common/ffmpeg_convert.cpp",
29  "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/common/ffmpeg_utils.cpp",
30  "$av_codec_root_dir/test/nativedemo/avdemuxer/server_demo/file_server_demo.cpp",
31]
32config("demuxer_plugin_test_unittest_cfg") {
33  defines = [
34    "HST_ANY_WITH_NO_RTTI",
35    "MEDIA_OHOS",
36    "TESTING",
37  ]
38
39  cflags = [
40    "-Wno-sign-compare",
41    "-fno-exceptions",
42    "-fno-common",
43    "-fstack-protector-all",
44    "-Wshadow",
45    "-FPIC",
46    "-FS",
47    "-O2",
48    "-D_FORTIFY_SOURCE=2",
49    "-Wformat=2",
50    "-Wdate-time",
51    "-Dprivate=public",
52    "-Dprotected=public",
53    "-Wno-unused-parameter",
54  ]
55
56  cflags_cc = [
57    "-std=c++17",
58    "-fno-rtti",
59  ]
60
61  include_dirs = [
62    "$av_codec_root_dir/interfaces",
63    "$av_codec_root_dir/interfaces/inner_api",
64    "$av_codec_root_dir/interfaces/inner_api/native",
65    "$av_codec_root_dir/interfaces/kits/c",
66    "$av_codec_root_dir/services/media_engine/modules",
67    "$av_codec_root_dir/services/media_engine/modules/demuxer",
68    "$av_codec_root_dir/test/unittest/common",
69    "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/demuxer",
70    "$av_codec_root_dir/services/media_engine/plugins/ffmpeg_adapter/common",
71    "$av_codec_root_dir/test/nativedemo/avdemuxer/server_demo",
72    "$av_codec_root_dir/test/nativedemo/include",
73  ]
74}
75
76#################################################################################################################
77ohos_unittest("demuxer_plugin_unit_test") {
78  sanitize = av_codec_test_sanitize
79  module_out_path = module_output_path
80  testonly = true
81  configs = [
82    ":demuxer_plugin_test_unittest_cfg",
83    "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config",
84  ]
85  sources = demuxer_plugin_test_sources
86  sources += [
87    "demuxer_plugin_audio_unit_test.cpp",
88    "demuxer_plugin_video_unit_test.cpp",
89  ]
90  deps = [
91    "$av_codec_root_dir/services/dfx:av_codec_service_dfx",
92    "$av_codec_root_dir/services/engine/base:av_codec_codec_base",
93  ]
94  if (target_cpu == "arm64" || is_emulator) {
95    av_codec_path = "\"/system/lib64\""
96  } else {
97    av_codec_path = "\"/system/lib\""
98  }
99  defines = [
100    "AV_CODEC_PATH=${av_codec_path}",
101  ]
102  external_deps = [
103    "c_utils:utils",
104    "ffmpeg:libohosffmpeg",
105    "hilog:libhilog",
106    "hisysevent:libhisysevent",
107    "init:libbegetutil",
108    "ipc:ipc_single",
109    "media_foundation:media_foundation",
110  ]
111  resource_config_file =
112      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
113}
114