1# Copyright (c) 2022 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("//drivers/hdf_core/adapter/uhdf2/uhdf.gni") 16import("$hdf_framework_path/tools/hc-gen/hc_gen.gni") 17 18hc_gen("build_codec_adapter_capabilities") { 19 sources = [ rebase_path( 20 "//vendor/${product_company}/${product_name}/hdf_config/uhdf/media_codec/codec_adapter_capabilities.hcs") ] 21} 22 23ohos_prebuilt_etc("codec_adapter_capabilities.hcb") { 24 deps = [ ":build_codec_adapter_capabilities" ] 25 hcs_outputs = get_target_outputs(":build_codec_adapter_capabilities") 26 source = hcs_outputs[0] 27 relative_install_dir = "hdfconfig" 28 install_images = [ chipset_base_dir ] 29 subsystem_name = "hdf" 30 part_name = "drivers_peripheral_codec" 31} 32 33ohos_shared_library("libcodec_hdi_passthrough_impl") { 34 include_dirs = [ 35 "//drivers/peripheral/codec/hal/include", 36 "//drivers/peripheral/codec/hal/passthrough/adapter/include", 37 "//drivers/peripheral/codec/hal/passthrough/include", 38 "//drivers/peripheral/codec/hal/v1.0/codec_instance/include", 39 "//drivers/peripheral/codec/hal/v1.0/share_mem/include", 40 "//drivers/peripheral/codec/hal/v1.0/oem_interface/include", 41 "//drivers/peripheral/codec/hal/v1.0/buffer_manager/include", 42 "//drivers/peripheral/codec/interfaces/include", 43 "//third_party/openmax/api/1.1.2", 44 ] 45 sources = [ 46 "../../hdi_service/codec_service_stub/codec_service.c", 47 "../src/codec_component_capability_config.c", 48 "../src/codec_config_parser.c", 49 "../v1.0/codec_instance/src/codec_instance.c", 50 "../v1.0/share_mem/src/ashmem_wrapper.cpp", 51 "../v1.0/share_mem/src/share_mem.c", 52 "adapter/src/component_common.cpp", 53 "adapter/src/component_manager.cpp", 54 "adapter/src/component_node.cpp", 55 "src/codec_adapter.cpp", 56 "src/codec_callback_if.c", 57 "src/codec_capability_parser.c", 58 "src/codec_component_capability.c", 59 "src/codec_component_if.c", 60 "src/codec_component_manager.c", 61 ] 62 defines = [ "CODEC_HAL_PASSTHROUGH" ] 63 64 if (is_standard_system) { 65 external_deps = [ 66 "c_utils:utils", 67 "drivers_peripheral_display:hdi_gralloc_client", 68 "graphic_chipsetsdk:buffer_handle", 69 "hdf_core:libhdf_utils", 70 "hiviewdfx_hilog_native:libhilog", 71 ] 72 } else { 73 external_deps = [ "hilog:libhilog" ] 74 } 75 76 install_images = [ chipset_base_dir ] 77 subsystem_name = "hdf" 78 part_name = "drivers_peripheral_codec" 79} 80 81group("codec_hdi_passthrough") { 82 CODEC_HCS_PATH = rebase_path( 83 "//vendor/${product_company}/${product_name}/hdf_config/uhdf/media_codec") 84 cmd = "if [ -f ${CODEC_HCS_PATH}/codec_adapter_capabilities.hcs ]; then echo true; else echo false; fi" 85 HAVE_CODEC_HCS_PATH = 86 exec_script("//build/lite/run_shell_cmd.py", [ cmd ], "value") 87 if (HAVE_CODEC_HCS_PATH) { 88 deps = [ 89 ":codec_adapter_capabilities.hcb", 90 ":libcodec_hdi_passthrough_impl", 91 ] 92 } 93} 94