1# Copyright (C) 2023-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/ohos.gni") 15import("//foundation/multimedia/av_codec/config.gni") 16 17config("av_codec_media_engine_modules_pts_and_index_convert_config") { 18 include_dirs = [ "$av_codec_root_dir/services/media_engine/modules/demuxer" ] 19} 20 21config("av_codec_media_engine_modules_config") { 22 defines = [ 23 "HST_ANY_WITH_NO_RTTI", 24 "MEDIA_OHOS", 25 ] 26 27 if (defined(av_codec_support_video_processing_engine) && 28 av_codec_support_video_processing_engine) { 29 defines += [ "USE_VIDEO_PROCESSING_ENGINE" ] 30 } 31 32 if (av_codec_enable_start_stop_on_demand) { 33 defines += [ "SUPPORT_START_STOP_ON_DEMAND" ] 34 } 35 36 cflags = [ 37 "-fno-exceptions", 38 "-Wall", 39 "-fno-common", 40 "-fstack-protector-all", 41 "-Wshadow", 42 "-FPIC", 43 "-FS", 44 "-O2", 45 "-D_FORTIFY_SOURCE=2", 46 "-Wformat=2", 47 "-Wdate-time", 48 ] 49 50 cflags_cc = [ 51 "-std=c++17", 52 "-fno-rtti", 53 ] 54 55 include_dirs = [ 56 "$av_codec_root_dir/interfaces", 57 "$av_codec_root_dir/interfaces/inner_api/native", 58 "$av_codec_root_dir/services/drm_decryptor", 59 "$av_codec_root_dir/services/media_engine/modules", 60 ] 61} 62 63ohos_shared_library("av_codec_media_engine_modules") { 64 branch_protector_ret = "pac_ret" 65 install_enable = true 66 67 sanitize = av_codec_sanitize 68 69 configs = [ 70 ":av_codec_media_engine_modules_config", 71 "$av_codec_root_dir/services/dfx:av_codec_service_log_dfx_public_config", 72 ] 73 74 sources = [ 75 "$av_codec_root_dir/services/drm_decryptor/codec_drm_decrypt.cpp", 76 "demuxer/base_stream_demuxer.cpp", 77 "demuxer/demuxer_plugin_manager.cpp", 78 "demuxer/media_demuxer.cpp", 79 "demuxer/pts_and_index_conversion.cpp", 80 "demuxer/sample_queue.cpp", 81 "demuxer/stream_demuxer.cpp", 82 "demuxer/type_finder.cpp", 83 "media_codec/media_codec.cpp", 84 "muxer/data_sink_fd.cpp", 85 "muxer/data_sink_file.cpp", 86 "muxer/media_muxer.cpp", 87 "post_processor/video_post_processor_factory.cpp", 88 "sink/audio_sampleformat.cpp", 89 "sink/audio_sink.cpp", 90 "sink/calc_max_amplitude.cpp", 91 "sink/media_sync_manager.cpp", 92 "sink/media_synchronous_sink.cpp", 93 "sink/subtitle_sink.cpp", 94 "sink/video_sink.cpp", 95 "source/audio_capture/audio_capture_module.cpp", 96 "source/audio_capture/audio_type_translate.cpp", 97 "source/source.cpp", 98 ] 99 100 if (defined(av_codec_support_video_processing_engine) && 101 av_codec_support_video_processing_engine) { 102 sources += [ "post_processor/super_resolution_post_processor.cpp" ] 103 } 104 105 deps = [ "$av_codec_root_dir/services/engine/base:av_codec_codec_base" ] 106 107 public_configs = [ 108 "$audio_framework_root_dir/frameworks/native/audiocapturer:audio_capturer_config", 109 ":av_codec_media_engine_modules_pts_and_index_convert_config", 110 ] 111 112 external_deps = [ 113 "audio_framework:audio_capturer", 114 "bundle_framework:appexecfwk_base", 115 "bundle_framework:appexecfwk_core", 116 "c_utils:utils", 117 "ffmpeg:libohosffmpeg", 118 "graphic_surface:surface", 119 "graphic_surface:sync_fence", 120 "hilog:libhilog", 121 "hisysevent:libhisysevent", 122 "hitrace:libhitracechain", 123 "init:libbegetutil", 124 "ipc:ipc_single", 125 "media_foundation:media_foundation", 126 "safwk:system_ability_fwk", 127 "samgr:samgr_proxy", 128 ] 129 130 if (defined(av_codec_support_video_processing_engine) && 131 av_codec_support_video_processing_engine) { 132 external_deps += [ "video_processing_engine:videoprocessingengine" ] 133 } 134 135 if (av_codec_support_drm) { 136 defines = [ "SUPPORT_DRM" ] 137 } 138 if (av_codec_support_drm) { 139 external_deps += [ "drm_framework:drm_framework" ] 140 } 141 142 subsystem_name = "multimedia" 143 part_name = "av_codec" 144} 145