1# Copyright (c) 2023 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_Audio/unittest" 18 19avmuxer_unittest_cflags = [ 20 "-std=c++17", 21 "-fno-rtti", 22 "-fno-exceptions", 23 "-Wall", 24 "-fno-common", 25 "-fstack-protector-strong", 26 "-Wshadow", 27 "-FPIC", 28 "-FS", 29 "-O2", 30 "-D_FORTIFY_SOURCE=2", 31 "-fvisibility=hidden", 32 "-Wformat=2", 33 "-Wdate-time", 34 "-Werror", 35 "-Wextra", 36 "-Wimplicit-fallthrough", 37 "-Wsign-compare", 38 "-Wunused-parameter", 39] 40 41#################################################################################################################muxer 42ohos_unittest("avmuxer_capi_unit_test") { 43 sanitize = av_codec_test_sanitize 44 module_out_path = module_output_path 45 include_dirs = [ 46 "./", 47 "./capi", 48 ] 49 50 cflags = avmuxer_unittest_cflags 51 52 if (av_codec_support_muxer) { 53 sources = [ 54 "./avmuxer_sample.cpp", 55 "./avmuxer_unit_test.cpp", 56 "./avmuxer_wav_pcm_unit_test.cpp", 57 "./capi/avmuxer_capi_mock.cpp", 58 "./capi/avmuxer_capi_mock_factory.cpp", 59 ] 60 } 61 62 if (target_cpu == "arm64" || is_emulator) { 63 av_codec_path = "\"/system/lib64\"" 64 } else { 65 av_codec_path = "\"/system/lib\"" 66 } 67 defines = [ 68 "AVMUXER_UNITTEST_CAPI", 69 "AV_CODEC_PATH=${av_codec_path}", 70 ] 71 72 public_deps = 73 [ "$av_codec_root_dir/test/unittest/common:av_codec_capi_unit_test" ] 74 75 deps = [ "$av_codec_root_dir/interfaces/kits/c:capi_packages" ] 76 77 external_deps = [ 78 "av_codec:av_codec_client", 79 "graphic_surface:surface", 80 ] 81 82 resource_config_file = 83 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 84} 85 86#################################################################################################################muxer 87ohos_unittest("avmuxer_inner_unit_test") { 88 sanitize = av_codec_test_sanitize 89 module_out_path = module_output_path 90 include_dirs = [ 91 "./", 92 "./inner", 93 ] 94 95 cflags = avmuxer_unittest_cflags 96 97 if (av_codec_support_muxer) { 98 sources = [ 99 "./avmuxer_sample.cpp", 100 "./avmuxer_unit_test.cpp", 101 "./avmuxer_wav_pcm_unit_test.cpp", 102 "./avmuxer_flac_unit_test.cpp", 103 "./inner/avmuxer_inner_mock.cpp", 104 "./inner/avmuxer_inner_mock_factory.cpp", 105 ] 106 } 107 108 if (target_cpu == "arm64" || is_emulator) { 109 av_codec_path = "\"/system/lib64\"" 110 } else { 111 av_codec_path = "\"/system/lib\"" 112 } 113 defines = [ 114 "AVMUXER_UNITTEST_INNER_API", 115 "AV_CODEC_PATH=${av_codec_path}", 116 ] 117 118 public_deps = 119 [ "$av_codec_root_dir/test/unittest/common:av_codec_inner_unit_test" ] 120 121 deps = [ "$av_codec_root_dir/interfaces/kits/c:native_media_codecbase" ] 122 123 external_deps = [ 124 "av_codec:av_codec_client", 125 "graphic_surface:surface", 126 ] 127 128 resource_config_file = 129 "$av_codec_root_dir/test/unittest/resources/ohos_test.xml" 130} 131