• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
19av_codec_unittest_include_dirs = [
20  "$av_codec_root_dir/interfaces/inner_api/native",
21  "$av_codec_root_dir/interfaces/interfaces/inner_api/native",
22]
23
24av_codec_unittest_cflags = [
25  "-std=c++17",
26  "-fno-rtti",
27  "-fno-exceptions",
28  "-Wall",
29  "-fno-common",
30  "-fstack-protector-strong",
31  "-Wshadow",
32  "-FPIC",
33  "-FS",
34  "-O2",
35  "-D_FORTIFY_SOURCE=2",
36  "-fvisibility=hidden",
37  "-Wformat=2",
38  "-Wdate-time",
39  "-Werror",
40  "-Wextra",
41  "-Wimplicit-fallthrough",
42  "-Wsign-compare",
43  "-Wunused-parameter",
44]
45
46##################################################################################################################
47ohos_unittest("av_audio_capi_unit_test") {
48  sanitize = av_codec_test_sanitize
49  module_out_path = module_output_path
50  include_dirs = av_codec_unittest_include_dirs
51  include_dirs += [
52    "./",
53    "$av_codec_root_dir/interfaces/kits/c",
54    "$av_codec_root_dir/services/engine/common/include",
55    "$av_codec_root_dir/services/engine/base/include",
56    "$av_codec_root_dir/services/utils/include",
57    "$av_codec_root_dir/services/engine/codec/include/audio",
58    "$av_codec_root_dir/services/engine/factory",
59  ]
60
61  cflags = av_codec_unittest_cflags
62
63  cflags_cc = cflags
64
65  public_configs = []
66
67  if (av_codec_support_test) {
68    sources = [ "./audio_decoder_capi_unit_test.cpp" ]
69  }
70
71  deps = [
72    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
73    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
74    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
75    "$av_codec_root_dir/services/services:av_codec_service",
76    "$av_codec_root_dir/services/utils:av_codec_service_utils",
77  ]
78
79  external_deps = [
80    "ffmpeg:libohosffmpeg",
81    "graphic_surface:surface",
82    "media_foundation:native_media_core",
83  ]
84
85  if (target_cpu == "arm64") {
86    av_codec_path = "\"/system/lib64\""
87  } else {
88    av_codec_path = "\"/system/lib\""
89  }
90  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
91
92  resource_config_file =
93      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
94}
95
96##################################################################################################################
97ohos_unittest("av_audio_codecbase_unit_test") {
98  sanitize = av_codec_test_sanitize
99  module_out_path = module_output_path
100  include_dirs = av_codec_unittest_include_dirs
101  include_dirs += [
102    "./",
103    "$av_codec_root_dir/interfaces/kits/c",
104    "$av_codec_root_dir/services/engine/common/include",
105    "$av_codec_root_dir/services/engine/base/include",
106    "$av_codec_root_dir/services/utils/include",
107    "$av_codec_root_dir/services/engine/codec/include/audio",
108    "$av_codec_root_dir/services/engine/factory",
109  ]
110
111  cflags = av_codec_unittest_cflags
112
113  cflags_cc = cflags
114
115  public_configs = []
116
117  if (av_codec_support_test) {
118    sources = [ "./audio_decoder_codecbase_unit_test.cpp" ]
119  }
120
121  deps = [
122    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
123    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
124    "$av_codec_root_dir/services/utils:av_codec_service_utils",
125  ]
126
127  external_deps = [
128    "ffmpeg:libohosffmpeg",
129    "graphic_surface:surface",
130    "hilog:libhilog",
131  ]
132
133  if (target_cpu == "arm64") {
134    av_codec_path = "\"/system/lib64\""
135  } else {
136    av_codec_path = "\"/system/lib\""
137  }
138  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
139
140  resource_config_file =
141      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
142}
143
144##################################################################################################################
145ohos_unittest("av_audio_decode_ability_unit_test") {
146  sanitize = av_codec_test_sanitize
147  module_out_path = module_output_path
148  include_dirs = av_codec_unittest_include_dirs
149  include_dirs += [
150    "./",
151    "$av_codec_root_dir/interfaces/kits/c",
152    "$av_codec_root_dir/services/engine/common/include",
153    "$av_codec_root_dir/services/engine/base/include",
154    "$av_codec_root_dir/services/utils/include",
155    "$av_codec_root_dir/services/engine/codec/include/audio",
156    "$av_codec_root_dir/services/engine/factory",
157  ]
158
159  cflags = av_codec_unittest_cflags
160
161  cflags_cc = cflags
162
163  public_configs = []
164
165  if (av_codec_support_test) {
166    sources = [ "./audio_decoder_ability_unit_test.cpp" ]
167  }
168
169  deps = [
170    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
171    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
172    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
173    "$av_codec_root_dir/services/services:av_codec_service",
174    "$av_codec_root_dir/services/utils:av_codec_service_utils",
175  ]
176
177  external_deps = [
178    "ffmpeg:libohosffmpeg",
179    "graphic_surface:surface",
180    "media_foundation:native_media_core",
181  ]
182
183  if (target_cpu == "arm64") {
184    av_codec_path = "\"/system/lib64\""
185  } else {
186    av_codec_path = "\"/system/lib\""
187  }
188  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
189
190  resource_config_file =
191      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
192}
193
194##################################################################################################################
195ohos_unittest("av_audio_inner_unit_test") {
196  sanitize = av_codec_test_sanitize
197  module_out_path = module_output_path
198  include_dirs = av_codec_unittest_include_dirs
199  include_dirs += [
200    "./",
201    "$av_codec_root_dir/interfaces/kits/c",
202    "$av_codec_root_dir/services/engine/common/include",
203    "$av_codec_root_dir/services/engine/base/include",
204    "$av_codec_root_dir/services/utils/include",
205    "$av_codec_root_dir/services/engine/codec/include/audio",
206    "$av_codec_root_dir/services/engine/factory",
207  ]
208
209  cflags = av_codec_unittest_cflags
210
211  cflags_cc = cflags
212
213  public_configs = []
214
215  if (av_codec_support_test) {
216    sources = [
217      "./audio_decoder_inner_unit_test.cpp",
218      "./audio_codec_adapter_unit_test.cpp",
219    ]
220  }
221
222  deps = [
223    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
224    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
225    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
226    "$av_codec_root_dir/services/services:av_codec_service",
227    "$av_codec_root_dir/services/utils:av_codec_service_utils",
228  ]
229
230  external_deps = [
231    "ffmpeg:libohosffmpeg",
232    "graphic_surface:surface",
233  ]
234
235  if (target_cpu == "arm64") {
236    av_codec_path = "\"/system/lib64\""
237  } else {
238    av_codec_path = "\"/system/lib\""
239  }
240  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
241
242  resource_config_file =
243      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
244}
245
246##################################################################################################################
247ohos_unittest("av_audio_encoder_capi_unit_test") {
248  sanitize = av_codec_test_sanitize
249  module_out_path = module_output_path
250  include_dirs = av_codec_unittest_include_dirs
251  include_dirs += [
252    "./",
253    "$av_codec_root_dir/interfaces/kits/c",
254    "$av_codec_root_dir/services/engine/common/include",
255    "$av_codec_root_dir/services/engine/base/include",
256    "$av_codec_root_dir/services/utils/include",
257    "$av_codec_root_dir/services/engine/codec/include/audio",
258    "$av_codec_root_dir/services/engine/factory",
259  ]
260
261  cflags = av_codec_unittest_cflags
262
263  cflags_cc = cflags
264
265  public_configs = []
266
267  if (av_codec_support_test) {
268    sources = [ "./audio_encoder_capi_unit_test.cpp" ]
269  }
270
271  deps = [
272    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
273    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
274    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
275    "$av_codec_root_dir/services/services:av_codec_service",
276    "$av_codec_root_dir/services/utils:av_codec_service_utils",
277  ]
278
279  external_deps = [
280    "ffmpeg:libohosffmpeg",
281    "graphic_surface:surface",
282    "media_foundation:native_media_core",
283  ]
284
285  if (target_cpu == "arm64") {
286    av_codec_path = "\"/system/lib64\""
287  } else {
288    av_codec_path = "\"/system/lib\""
289  }
290  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
291
292  resource_config_file =
293      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
294}
295
296##################################################################################################################
297ohos_unittest("av_audio_encoder_avbuffer_capi_unit_test") {
298  sanitize = av_codec_test_sanitize
299  module_out_path = module_output_path
300  include_dirs = av_codec_unittest_include_dirs
301  include_dirs += [
302    "./",
303    "$av_codec_root_dir/interfaces/kits/c",
304    "$av_codec_root_dir/services/engine/common/include",
305    "$av_codec_root_dir/services/engine/base/include",
306    "$av_codec_root_dir/services/utils/include",
307    "$av_codec_root_dir/services/engine/codec/include/audio",
308    "$av_codec_root_dir/services/engine/factory",
309  ]
310
311  cflags = av_codec_unittest_cflags
312
313  cflags_cc = cflags
314
315  public_configs = []
316
317  if (av_codec_support_test) {
318    sources = [ "./audio_encoder_avbuffer_capi_unit_test.cpp" ]
319  }
320
321  deps = [
322    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
323    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
324    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
325    "$av_codec_root_dir/services/services:av_codec_service",
326    "$av_codec_root_dir/services/utils:av_codec_service_utils",
327  ]
328
329  external_deps = [
330    "ffmpeg:libohosffmpeg",
331    "graphic_surface:surface",
332    "media_foundation:media_foundation",
333    "media_foundation:native_media_core",
334  ]
335
336  if (target_cpu == "arm64") {
337    av_codec_path = "\"/system/lib64\""
338  } else {
339    av_codec_path = "\"/system/lib\""
340  }
341  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
342
343  resource_config_file =
344      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
345}
346
347##################################################################################################################
348ohos_unittest("av_audio_decoder_avbuffer_capi_unit_test") {
349  sanitize = av_codec_test_sanitize
350  module_out_path = module_output_path
351  include_dirs = av_codec_unittest_include_dirs
352  include_dirs += [
353    "./",
354    "$av_codec_root_dir/interfaces/kits/c",
355    "$av_codec_root_dir/services/engine/common/include",
356    "$av_codec_root_dir/services/engine/base/include",
357    "$av_codec_root_dir/services/utils/include",
358    "$av_codec_root_dir/services/engine/codec/include/audio",
359    "$av_codec_root_dir/services/engine/factory",
360    "$av_codec_root_dir/test/unittest/common/common_mock/",
361    "$av_codec_root_dir/test/unittest/common/common_mock/drm_mock/capi/",
362  ]
363
364  cflags = av_codec_unittest_cflags
365
366  cflags_cc = cflags
367
368  public_configs = []
369
370  if (av_codec_support_test) {
371    sources = [ "./audio_decoder_avbuffer_capi_unit_test.cpp" ]
372  }
373  if (av_codec_support_drm) {
374    sources += [ "$av_codec_root_dir/test/unittest/common/common_mock/drm_mock/capi/media_key_system_mock.cpp" ]
375  }
376
377  deps = [
378    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
379    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
380    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
381    "$av_codec_root_dir/services/services:av_codec_service",
382    "$av_codec_root_dir/services/utils:av_codec_service_utils",
383  ]
384
385  external_deps = [
386    "ffmpeg:libohosffmpeg",
387    "graphic_surface:surface",
388    "media_foundation:media_foundation",
389    "media_foundation:native_media_core",
390  ]
391
392  if (target_cpu == "arm64") {
393    av_codec_path = "\"/system/lib64\""
394  } else {
395    av_codec_path = "\"/system/lib\""
396  }
397  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
398  defines += av_codec_defines
399  if (av_codec_support_drm) {
400    external_deps += [
401      "drm_framework:drm_framework",
402      "drm_framework:native_drm",
403    ]
404  }
405
406  resource_config_file =
407      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
408}
409
410##################################################################################################################
411ohos_unittest("av_audio_media_codec_unit_test") {
412  sanitize = av_codec_test_sanitize
413  module_out_path = module_output_path
414  include_dirs = av_codec_unittest_include_dirs
415  include_dirs += [
416    "./",
417    "$av_codec_root_dir/interfaces",
418    "$av_codec_root_dir/interfaces/kits/c",
419    "$av_codec_root_dir/services/drm_decryptor",
420    "$av_codec_root_dir/services/engine/common/include",
421    "$av_codec_root_dir/services/media_engine/modules/media_codec",
422  ]
423
424  cflags = [
425    "-fno-exceptions",
426    "-Wall",
427    "-fno-common",
428    "-fstack-protector-all",
429    "-Wshadow",
430    "-FPIC",
431    "-FS",
432    "-O2",
433    "-D_FORTIFY_SOURCE=2",
434    "-Wformat=2",
435    "-Wdate-time",
436  ]
437
438  cflags_cc = [
439    "-std=c++17",
440    "-fno-rtti",
441  ]
442
443  public_configs = []
444
445  sources = [ "./audio_media_codec_unit_test.cpp" ]
446
447  deps = [ "$av_codec_root_dir/services/media_engine/modules:av_codec_media_engine_modules" ]
448
449  external_deps = [
450    "c_utils:utils",
451    "media_foundation:media_foundation",
452  ]
453
454  resource_config_file =
455      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
456}
457
458##################################################################################################################
459ohos_unittest("audio_codec_inner_avbuffer_unit_test") {
460  sanitize = av_codec_test_sanitize
461  module_out_path = module_output_path
462  include_dirs = av_codec_unittest_include_dirs
463  include_dirs += [
464    "./",
465    "$av_codec_root_dir/interfaces",
466    "$av_codec_root_dir/interfaces/kits/c",
467    "$av_codec_root_dir/services/drm_decryptor",
468    "$av_codec_root_dir/services/engine/common/include",
469    "$av_codec_root_dir/services/media_engine/modules/media_codec",
470    "$av_codec_root_dir/framework/native/avcodec",
471    "$av_codec_root_dir/test/nativedemo/include",
472  ]
473
474  cflags = [
475    "-fno-exceptions",
476    "-Wall",
477    "-fno-common",
478    "-fstack-protector-all",
479    "-Wshadow",
480    "-FPIC",
481    "-FS",
482    "-O2",
483    "-D_FORTIFY_SOURCE=2",
484    "-Wformat=2",
485    "-Wdate-time",
486  ]
487
488  cflags_cc = [
489    "-std=c++17",
490    "-fno-rtti",
491  ]
492
493  public_configs = []
494
495  sources = [ "./audio_codec_inner_avbuffer_unit_test.cpp" ]
496
497  deps = [
498    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
499    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
500    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
501    "$av_codec_root_dir/services/media_engine/modules:av_codec_media_engine_modules",
502    "$av_codec_root_dir/services/services:av_codec_service",
503    "$av_codec_root_dir/services/utils:av_codec_service_utils",
504  ]
505
506  external_deps = [
507    "c_utils:utils",
508    "media_foundation:media_foundation",
509  ]
510
511  resource_config_file =
512      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
513}
514
515##################################################################################################################
516ohos_unittest("audio_lbvc_plugin_unit_test") {
517  sanitize = av_codec_test_sanitize
518  module_out_path = module_output_path
519  include_dirs = av_codec_unittest_include_dirs
520  include_dirs += [
521    "./",
522    "$av_codec_root_dir/interfaces/kits/c",
523    "$av_codec_root_dir/services/engine/common/include",
524    "$av_codec_root_dir/services/engine/base/include",
525    "$av_codec_root_dir/services/engine/codec/include/audio/decoder",
526    "$av_codec_root_dir/services/utils/include",
527    "$av_codec_root_dir/services/engine/codec/include/audio",
528  ]
529
530  cflags = [
531    "-fno-exceptions",
532    "-Wall",
533    "-fno-common",
534    "-fstack-protector-strong",
535    "-Wshadow",
536    "-FPIC",
537    "-FS",
538    "-O2",
539    "-D_FORTIFY_SOURCE=2",
540    "-Wformat=2",
541    "-Wdate-time",
542]
543
544  cflags_cc = cflags
545
546  public_configs = []
547
548  if (av_codec_support_test) {
549    sources = [ "./audio_lbvc_unit_test.cpp" ]
550  }
551
552  deps = [
553    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
554    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
555    "$av_codec_root_dir/services/services:av_codec_service",
556    "$av_codec_root_dir/services/utils:av_codec_service_utils",
557  ]
558
559  external_deps = [
560    "c_utils:utils",
561    "media_foundation:media_foundation",
562  ]
563
564  resource_config_file =
565      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
566}
567
568##################################################################################################################
569ohos_unittest("audio_hdi_codec_inner_unit_test") {
570  sanitize = av_codec_test_sanitize
571  module_out_path = module_output_path
572  include_dirs = av_codec_unittest_include_dirs
573  include_dirs += [
574    "./",
575    "$av_codec_root_dir/interfaces/kits/c",
576    "$av_codec_root_dir/services/engine/common/include",
577    "$av_codec_root_dir/services/engine/base/include",
578    "$av_codec_root_dir/services/utils/include",
579    "$av_codec_root_dir/services/engine/codec/include/audio",
580    "$av_codec_root_dir/services/engine/factory",
581    "$av_codec_root_dir/test/nativedemo/include",
582  ]
583
584  cflags = av_codec_unittest_cflags
585
586  cflags_cc = cflags
587
588  public_configs = []
589
590  if (av_codec_support_test) {
591    sources = [ "./audio_hdi_codec_inner_unit_test.cpp" ]
592  }
593
594  deps = [
595    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
596    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
597    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
598    "$av_codec_root_dir/services/services:av_codec_service",
599    "$av_codec_root_dir/services/utils:av_codec_service_utils",
600  ]
601
602  external_deps = [
603    "drivers_interface_codec:libcodec_proxy_4.0",
604    "ffmpeg:libohosffmpeg",
605    "graphic_surface:surface",
606  ]
607
608  if (target_cpu == "arm64") {
609    av_codec_path = "\"/system/lib64\""
610  } else {
611    av_codec_path = "\"/system/lib\""
612  }
613  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
614
615  resource_config_file =
616      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
617}
618
619##################################################################################################################
620ohos_unittest("audio_g711mu_encoder_plugin_unit_test") {
621  sanitize = av_codec_test_sanitize
622  module_out_path = module_output_path
623  include_dirs = av_codec_unittest_include_dirs
624  include_dirs += [
625    "./",
626    "$av_codec_root_dir/interfaces/kits/c",
627    "$av_codec_root_dir/services/engine/common/include",
628    "$av_codec_root_dir/services/engine/base/include",
629    "$av_codec_root_dir/services/utils/include",
630    "$av_codec_root_dir/services/engine/codec/include/audio",
631    "$av_codec_root_dir/services/engine/codec/include/audio/encoder",
632    "$av_codec_root_dir/services/engine/factory",
633    "$av_codec_root_dir/test/nativedemo/include",
634  ]
635
636  cflags = av_codec_unittest_cflags
637
638  cflags_cc = cflags
639
640  public_configs = []
641
642  if (av_codec_support_test) {
643    sources = [ "./audio_g711mu_encoder_plugin_unit_test.cpp" ]
644  }
645
646  deps = [
647    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
648    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
649    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
650    "$av_codec_root_dir/services/services:av_codec_service",
651    "$av_codec_root_dir/services/utils:av_codec_service_utils",
652  ]
653
654  external_deps = [
655    "ffmpeg:libohosffmpeg",
656    "graphic_surface:surface",
657  ]
658
659  if (target_cpu == "arm64") {
660    av_codec_path = "\"/system/lib64\""
661  } else {
662    av_codec_path = "\"/system/lib\""
663  }
664  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
665
666  resource_config_file =
667      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
668}
669
670##################################################################################################################
671ohos_unittest("audio_resample_unit_test") {
672  sanitize = av_codec_test_sanitize
673  module_out_path = module_output_path
674  include_dirs = av_codec_unittest_include_dirs
675  include_dirs += [
676    "./",
677    "$av_codec_root_dir/interfaces/kits/c",
678    "$av_codec_root_dir/services/engine/common/include",
679    "$av_codec_root_dir/services/engine/base/include",
680    "$av_codec_root_dir/services/utils/include",
681    "$av_codec_root_dir/services/engine/codec/include/audio",
682  ]
683
684  cflags = av_codec_unittest_cflags
685
686  cflags_cc = cflags
687
688  public_configs = []
689
690  if (av_codec_support_test) {
691    sources = [ "./audio_resample_unit_test.cpp" ]
692  }
693
694  deps = [
695    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
696    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
697    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
698    "$av_codec_root_dir/services/services:av_codec_service",
699    "$av_codec_root_dir/services/utils:av_codec_service_utils",
700  ]
701
702  external_deps = [
703    "ffmpeg:libohosffmpeg",
704    "graphic_surface:surface",
705  ]
706
707  if (target_cpu == "arm64") {
708    av_codec_path = "\"/system/lib64\""
709  } else {
710    av_codec_path = "\"/system/lib\""
711  }
712  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
713
714  resource_config_file =
715      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
716}
717
718##################################################################################################################
719ohos_unittest("audio_decoder_plugin_unit_test") {
720  sanitize = av_codec_test_sanitize
721  module_out_path = module_output_path
722  include_dirs = av_codec_unittest_include_dirs
723  include_dirs += [
724    "./",
725    "$av_codec_root_dir/interfaces/kits/c",
726    "$av_codec_root_dir/services/engine/common/include",
727    "$av_codec_root_dir/services/engine/base/include",
728    "$av_codec_root_dir/services/engine/codec/include/audio/decoder",
729    "$av_codec_root_dir/services/utils/include",
730    "$av_codec_root_dir/services/engine/codec/include/audio",
731  ]
732
733  cflags = av_codec_unittest_cflags
734
735  cflags_cc = cflags
736
737  public_configs = []
738
739  if (av_codec_support_test) {
740    sources = [ "./audio_decoder_plugin_unit_test.cpp" ]
741  }
742
743  deps = [
744    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
745    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
746    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
747    "$av_codec_root_dir/services/services:av_codec_service",
748    "$av_codec_root_dir/services/utils:av_codec_service_utils",
749  ]
750
751  external_deps = [
752    "ffmpeg:libohosffmpeg",
753    "graphic_surface:surface",
754  ]
755
756  if (target_cpu == "arm64") {
757    av_codec_path = "\"/system/lib64\""
758  } else {
759    av_codec_path = "\"/system/lib\""
760  }
761  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
762
763  resource_config_file =
764      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
765}
766
767##################################################################################################################
768ohos_unittest("audio_encoder_plugin_unit_test") {
769  sanitize = av_codec_test_sanitize
770  module_out_path = module_output_path
771  include_dirs = av_codec_unittest_include_dirs
772  include_dirs += [
773    "./",
774    "$av_codec_root_dir/interfaces/kits/c",
775    "$av_codec_root_dir/services/engine/common/include",
776    "$av_codec_root_dir/services/engine/base/include",
777    "$av_codec_root_dir/services/engine/codec/include/audio/encoder",
778    "$av_codec_root_dir/services/utils/include",
779    "$av_codec_root_dir/services/engine/codec/include/audio",
780  ]
781
782  cflags = av_codec_unittest_cflags
783
784  cflags_cc = cflags
785
786  public_configs = []
787
788  if (av_codec_support_test) {
789    sources = [ "./audio_encoder_plugin_unit_test.cpp" ]
790  }
791
792  deps = [
793    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
794    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
795    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
796    "$av_codec_root_dir/services/services:av_codec_service",
797    "$av_codec_root_dir/services/utils:av_codec_service_utils",
798  ]
799
800  external_deps = [
801    "ffmpeg:libohosffmpeg",
802    "graphic_surface:surface",
803  ]
804
805  if (target_cpu == "arm64") {
806    av_codec_path = "\"/system/lib64\""
807  } else {
808    av_codec_path = "\"/system/lib\""
809  }
810  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
811
812  resource_config_file =
813      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
814}
815
816##################################################################################################################
817ohos_unittest("audio_raw_decoder_plugin_unit_test") {
818  sanitize = av_codec_test_sanitize
819  module_out_path = module_output_path
820  include_dirs = av_codec_unittest_include_dirs
821  include_dirs += [
822    "./",
823    "$av_codec_root_dir/interfaces/kits/c",
824    "$av_codec_root_dir/services/engine/common/include",
825    "$av_codec_root_dir/services/engine/base/include",
826    "$av_codec_root_dir/services/engine/codec/include/audio/decoder",
827    "$av_codec_root_dir/services/utils/include",
828    "$av_codec_root_dir/services/engine/codec/include/audio",
829  ]
830
831  cflags = [
832    "-fno-exceptions",
833    "-Wall",
834    "-fno-common",
835    "-fstack-protector-strong",
836    "-Wshadow",
837    "-FPIC",
838    "-FS",
839    "-O2",
840    "-D_FORTIFY_SOURCE=2",
841    "-Wformat=2",
842    "-Wdate-time",
843]
844
845  cflags_cc = cflags
846
847  public_configs = []
848
849  if (av_codec_support_test) {
850    sources = [ "./audio_raw_decoder_plugin_unit_test.cpp" ]
851  }
852
853  deps = [
854    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
855    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
856    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
857    "$av_codec_root_dir/services/services:av_codec_service",
858    "$av_codec_root_dir/services/utils:av_codec_service_utils",
859  ]
860
861  external_deps = [
862    "ffmpeg:libohosffmpeg",
863    "graphic_surface:surface",
864  ]
865
866  if (target_cpu == "arm64") {
867    av_codec_path = "\"/system/lib64\""
868  } else {
869    av_codec_path = "\"/system/lib\""
870  }
871  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
872
873  resource_config_file =
874      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
875}
876
877##################################################################################################################
878ohos_unittest("audio_ffmpeg_base_codec_unit_test") {
879  sanitize = av_codec_test_sanitize
880  module_out_path = module_output_path
881  include_dirs = av_codec_unittest_include_dirs
882  include_dirs += [
883    "./",
884    "$av_codec_root_dir/interfaces/kits/c",
885    "$av_codec_root_dir/services/engine/common/include",
886    "$av_codec_root_dir/services/engine/base/include",
887    "$av_codec_root_dir/services/engine/codec/include/audio/decoder",
888    "$av_codec_root_dir/services/utils/include",
889    "$av_codec_root_dir/services/engine/codec/include/audio",
890  ]
891
892  cflags = [
893    "-fno-exceptions",
894    "-Wall",
895    "-fno-common",
896    "-fstack-protector-strong",
897    "-Wshadow",
898    "-FPIC",
899    "-FS",
900    "-O2",
901    "-D_FORTIFY_SOURCE=2",
902    "-Wformat=2",
903    "-Wdate-time",
904]
905
906  cflags_cc = cflags
907
908  public_configs = []
909
910  if (av_codec_support_test) {
911    sources = [ "./audio_ffmpeg_base_codec_unit_test.cpp" ]
912  }
913
914  deps = [
915    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
916    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
917    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
918    "$av_codec_root_dir/services/services:av_codec_service",
919    "$av_codec_root_dir/services/utils:av_codec_service_utils",
920  ]
921
922  external_deps = [
923    "ffmpeg:libohosffmpeg",
924    "graphic_surface:surface",
925  ]
926
927  if (target_cpu == "arm64") {
928    av_codec_path = "\"/system/lib64\""
929  } else {
930    av_codec_path = "\"/system/lib\""
931  }
932  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
933
934  resource_config_file =
935      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
936}
937
938##################################################################################################################
939ohos_unittest("audio_g711a_decoder_unit_test") {
940  sanitize = av_codec_test_sanitize
941  module_out_path = module_output_path
942  include_dirs = av_codec_unittest_include_dirs
943  include_dirs += [
944    "./",
945    "$av_codec_root_dir/interfaces/kits/c",
946    "$av_codec_root_dir/services/engine/common/include",
947    "$av_codec_root_dir/services/engine/base/include",
948    "$av_codec_root_dir/services/engine/codec/include/audio/decoder",
949    "$av_codec_root_dir/services/utils/include",
950    "$av_codec_root_dir/services/engine/codec/include/audio",
951  ]
952
953  cflags = [
954    "-fno-exceptions",
955    "-Wall",
956    "-fno-common",
957    "-fstack-protector-strong",
958    "-Wshadow",
959    "-FPIC",
960    "-FS",
961    "-O2",
962    "-D_FORTIFY_SOURCE=2",
963    "-Wformat=2",
964    "-Wdate-time",
965]
966
967  cflags_cc = cflags
968
969  public_configs = []
970
971  if (av_codec_support_test) {
972    sources = [ "./audio_g711a_decoder_unit_test.cpp" ]
973  }
974
975  deps = [
976    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
977    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
978    "$av_codec_root_dir/services/services:av_codec_service",
979    "$av_codec_root_dir/services/utils:av_codec_service_utils",
980  ]
981
982  external_deps = [
983    "c_utils:utils",
984    "media_foundation:media_foundation",
985  ]
986}
987
988##################################################################################################################
989ohos_unittest("audio_sync_codec_adapter_unit_test") {
990  sanitize = av_codec_test_sanitize
991  module_out_path = module_output_path
992  include_dirs = av_codec_unittest_include_dirs
993  include_dirs += [
994    "./",
995    "$av_codec_root_dir/interfaces",
996    "$av_codec_root_dir/interfaces/kits/c",
997    "$av_codec_root_dir/services/drm_decryptor",
998    "$av_codec_root_dir/services/engine/common/include",
999    "$av_codec_root_dir/services/media_engine/modules/media_codec",
1000    "$av_codec_root_dir/framework/native/avcodec"
1001  ]
1002
1003  cflags = [
1004    "-fno-exceptions",
1005    "-Wall",
1006    "-fno-common",
1007    "-fstack-protector-all",
1008    "-Wshadow",
1009    "-FPIC",
1010    "-FS",
1011    "-O2",
1012    "-D_FORTIFY_SOURCE=2",
1013    "-Wformat=2",
1014    "-Wdate-time",
1015  ]
1016
1017  cflags_cc = [
1018    "-std=c++17",
1019    "-fno-rtti",
1020  ]
1021
1022  public_configs = []
1023
1024  sources = [ "./audio_sync_codec_adapter_unit_test.cpp" ]
1025
1026  deps = [
1027    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
1028    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
1029    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
1030    "$av_codec_root_dir/services/media_engine/modules:av_codec_media_engine_modules",
1031    "$av_codec_root_dir/services/services:av_codec_service",
1032    "$av_codec_root_dir/services/utils:av_codec_service_utils",
1033  ]
1034
1035  external_deps = [
1036    "c_utils:utils",
1037    "media_foundation:media_foundation",
1038    "googletest:gmock_main"
1039  ]
1040
1041  resource_config_file =
1042      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
1043}
1044
1045##################################################################################################################
1046ohos_unittest("audio_codec_inner_unit_test") {
1047  sanitize = av_codec_test_sanitize
1048  module_out_path = module_output_path
1049  include_dirs = av_codec_unittest_include_dirs
1050  include_dirs += [
1051    "./",
1052    "$av_codec_root_dir/interfaces",
1053    "$av_codec_root_dir/interfaces/kits/c",
1054    "$av_codec_root_dir/services/drm_decryptor",
1055    "$av_codec_root_dir/services/engine/common/include",
1056    "$av_codec_root_dir/services/media_engine/modules/media_codec",
1057    "$av_codec_root_dir/framework/native/avcodec"
1058  ]
1059
1060  cflags = [
1061    "-fno-exceptions",
1062    "-Wall",
1063    "-fno-common",
1064    "-fstack-protector-all",
1065    "-Wshadow",
1066    "-FPIC",
1067    "-FS",
1068    "-O2",
1069    "-D_FORTIFY_SOURCE=2",
1070    "-Wformat=2",
1071    "-Wdate-time",
1072  ]
1073
1074  cflags_cc = [
1075    "-std=c++17",
1076    "-fno-rtti",
1077  ]
1078
1079  public_configs = []
1080
1081  sources = [ "./audio_codec_inner_unit_test.cpp" ]
1082
1083  deps = [
1084    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
1085    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
1086    "$av_codec_root_dir/services/engine/codec/audio:av_codec_audio_ffmpeg_codec",
1087    "$av_codec_root_dir/services/media_engine/modules:av_codec_media_engine_modules",
1088    "$av_codec_root_dir/services/services:av_codec_service",
1089    "$av_codec_root_dir/services/utils:av_codec_service_utils",
1090  ]
1091
1092  external_deps = [
1093    "c_utils:utils",
1094    "media_foundation:media_foundation",
1095    "googletest:gmock_main"
1096  ]
1097
1098  resource_config_file =
1099      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
1100}
1101
1102ohos_unittest("audio_sync_mode_capi_unit_test") {
1103  sanitize = av_codec_test_sanitize
1104  module_out_path = module_output_path
1105  include_dirs = av_codec_unittest_include_dirs
1106  include_dirs += [
1107    "./",
1108    "$av_codec_root_dir/interfaces/kits/c",
1109    "$av_codec_root_dir/services/engine/common/include",
1110    "$av_codec_root_dir/services/engine/base/include",
1111    "$av_codec_root_dir/services/utils/include",
1112    "$av_codec_root_dir/services/engine/codec/include/audio",
1113    "$av_codec_root_dir/services/engine/factory",
1114  ]
1115
1116  cflags = av_codec_unittest_cflags
1117
1118  cflags_cc = cflags
1119
1120  public_configs = []
1121
1122  if (target_cpu == "arm64") {
1123    av_codec_path = "\"/system/lib64\""
1124  } else {
1125    av_codec_path = "\"/system/lib\""
1126  }
1127  defines = [ "AV_CODEC_PATH=${av_codec_path}" ]
1128
1129  if (av_codec_support_test) {
1130    sources = [ "./audio_sync_mode_capi_unit_test.cpp" ]
1131  }
1132
1133  deps = [
1134    "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client",
1135    "$av_codec_root_dir/interfaces/kits/c:capi_packages",
1136    "$av_codec_root_dir/services/services:av_codec_service",
1137    "$av_codec_root_dir/services/utils:av_codec_service_utils",
1138  ]
1139
1140  external_deps = [
1141    "graphic_surface:surface",
1142    "media_foundation:native_media_core",
1143  ]
1144
1145  resource_config_file =
1146      "$av_codec_root_dir/test/unittest/resources/ohos_test.xml"
1147}
1148