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/ohos.gni") 15import("//foundation/multimedia/av_codec/config.gni") 16 17ohos_executable("av_codec_demo") { 18 include_dirs = [ 19 "$av_codec_root_dir/frameworks/native/capi/common", 20 "$av_codec_root_dir/interfaces/inner_api/native", 21 "$av_codec_root_dir/interfaces/kits/c", 22 "$av_codec_root_dir/interfaces/plugin", 23 "$av_codec_root_dir/services/dfx/include", 24 "$av_codec_root_dir/services/engine/base/include", 25 "$av_codec_root_dir/services/engine/codec/include/video", 26 "$av_codec_root_dir/services/engine/common/include", 27 "$av_codec_root_dir/services/utils/include", 28 "$av_codec_root_dir/../../graphic/graphic_2d/interfaces/inner_api", 29 "$av_codec_root_dir/../../window/window_manager/interfaces/innerkits", 30 "$drm_framework_root_dir/interfaces/kits/c/drm_capi/common", 31 "$drm_framework_root_dir/interfaces/kits/c/drm_capi/include", 32 "./audio_demo", 33 "./video_demo", 34 "./avmuxer", 35 "./avdemuxer", 36 "./codeclist_demo", 37 "./include", 38 "./e2e_demo", 39 ] 40 41 if (target_cpu == "arm64" || is_emulator) { 42 av_codec_plugin_path = "\"/system/lib64/media/av_codec_plugins\"" 43 } else { 44 av_codec_plugin_path = "\"/system/lib/media/av_codec_plugins\"" 45 } 46 47 defines = [ "AV_CODEC_PLUGIN_PATH=${av_codec_plugin_path}" ] 48 defines += av_codec_defines 49 50 cflags = [ 51 "-Wall", 52 "-fno-rtti", 53 "-fno-exceptions", 54 "-fno-common", 55 "-fstack-protector-strong", 56 "-Wshadow", 57 "-FPIC", 58 "-FS", 59 "-O2", 60 "-D_FORTIFY_SOURCE=2", 61 "-fvisibility=hidden", 62 "-Wformat=2", 63 "-Wdate-time", 64 "-Werror", 65 "-Wextra", 66 "-Wimplicit-fallthrough", 67 "-Wsign-compare", 68 "-Wno-unused-parameter", 69 "-Wno-deprecated-declarations", 70 ] 71 72 cflags_cc = cflags 73 cflags_cc += [ "-std=c++17" ] 74 75 sources = [ 76 "./audio_demo/avcodec_audio_aac_encoder_demo.cpp", 77 "./audio_demo/avcodec_audio_avbuffer_aac_encoder_demo.cpp", 78 "./audio_demo/avcodec_audio_avbuffer_amrnb_encoder_demo.cpp", 79 "./audio_demo/avcodec_audio_avbuffer_amrwb_encoder_demo.cpp", 80 "./audio_demo/avcodec_audio_avbuffer_decoder_demo.cpp", 81 "./audio_demo/avcodec_audio_avbuffer_decoder_inner_demo.cpp", 82 "./audio_demo/avcodec_audio_avbuffer_flac_encoder_demo.cpp", 83 "./audio_demo/avcodec_audio_avbuffer_g711mu_encoder_demo.cpp", 84 "./audio_demo/avcodec_audio_avbuffer_lbvc_decoder_inner_demo.cpp", 85 "./audio_demo/avcodec_audio_avbuffer_lbvc_encoder_inner_demo.cpp", 86 "./audio_demo/avcodec_audio_avbuffer_mp3_encoder_demo.cpp", 87 "./audio_demo/avcodec_audio_decoder_demo.cpp", 88 "./audio_demo/avcodec_audio_decoder_inner_demo.cpp", 89 "./audio_demo/avcodec_audio_encoder_inner_demo.cpp", 90 "./audio_demo/avcodec_audio_flac_encoder_demo.cpp", 91 "./audio_demo/avcodec_audio_g711mu_encoder_demo.cpp", 92 "./audio_demo/avcodec_audio_opus_encoder_demo.cpp", 93 "./av_codec_demo.cpp", 94 "./avdemuxer/avdemuxer_demo_runner.cpp", 95 "./avdemuxer/capi_demo/avdemuxer_demo.cpp", 96 "./avdemuxer/capi_demo/avsource_demo.cpp", 97 "./avdemuxer/inner_demo/inner_demuxer_demo.cpp", 98 "./avdemuxer/inner_demo/inner_source_demo.cpp", 99 "./avdemuxer/server_demo/file_server_demo.cpp", 100 "./codeclist_demo/codeclist_demo.cpp", 101 "./e2e_demo/avcodec_e2e_demo.cpp", 102 "./e2e_demo/avcodec_e2e_demo_api10.cpp", 103 "./video_demo/avcodec_video_decoder_demo.cpp", 104 "./video_demo/avcodec_video_decoder_inner_demo.cpp", 105 ] 106 107 deps = [ 108 "$av_codec_root_dir/interfaces/inner_api/native:av_codec_client", 109 "$av_codec_root_dir/interfaces/kits/c:capi_packages", 110 "$av_codec_root_dir/services/services:av_codec_service", 111 "$av_codec_root_dir/test/nativedemo/avmuxer:av_codec_demo_muxer", 112 ] 113 114 external_deps = [ 115 "c_utils:utils", 116 "ffmpeg:libohosffmpeg", 117 "graphic_2d:libgraphic_utils", 118 "graphic_2d:librender_service_client", 119 "graphic_surface:surface", 120 "graphic_surface:sync_fence", 121 "hilog:libhilog", 122 "ipc:ipc_core", 123 "media_foundation:media_foundation", 124 "media_foundation:native_media_core", 125 "window_manager:libwm", 126 ] 127 128 if (av_codec_support_drm) { 129 external_deps += [ 130 "drm_framework:drm_framework", 131 "drm_framework:native_drm", 132 ] 133 } 134 135 install_enable = false 136 137 part_name = "av_codec" 138 subsystem_name = "multimedia" 139} 140