From da51566fbcdec7e57d36889106d950703d8155e1 Mon Sep 17 00:00:00 2001 From: chen0088 Date: Fri, 9 May 2025 10:38:41 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=89=88=E6=9C=AC=E9=9A=94?= =?UTF-8?q?=E7=A6=BB?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: chen0088 --- bundle.json | 3 ++- distributedcamera.gni | 1 + services/cameraservice/cameraoperator/handler/BUILD.gn | 4 ++++ .../cameraoperator/handler/src/dcamera_handler.cpp | 7 +++++++ 4 files changed, 14 insertions(+), 1 deletion(-) diff --git a/bundle.json b/bundle.json index f594c867..4d2f1569 100644 --- a/bundle.json +++ b/bundle.json @@ -16,7 +16,8 @@ "subsystem": "distributedhardware", "syscap": [], "features": [ - "distributed_camera_common" + "distributed_camera_common", + "distributed_camera_filter_front" ], "adapted_system_type": [ "standard" diff --git a/distributedcamera.gni b/distributedcamera.gni index 40b0b515..0b3ebc48 100644 --- a/distributedcamera.gni +++ b/distributedcamera.gni @@ -44,6 +44,7 @@ build_flags = [ "-Werror" ] declare_args() { distributed_camera_common = true device_security_level_camera = true + distributed_camera_filter_front = false if (defined(global_parts_info) && !defined(global_parts_info.security_device_security_level)) { diff --git a/services/cameraservice/cameraoperator/handler/BUILD.gn b/services/cameraservice/cameraoperator/handler/BUILD.gn index cdcac506..3f707432 100644 --- a/services/cameraservice/cameraoperator/handler/BUILD.gn +++ b/services/cameraservice/cameraoperator/handler/BUILD.gn @@ -54,6 +54,10 @@ ohos_shared_library("distributed_camera_handler") { "LOG_DOMAIN=0xD004150", ] + if (distributed_camera_filter_front) { + cflags = [ "-DDCAMERA_FRONT" ] + } + external_deps = [ "av_codec:av_codec_client", "cJSON:cjson", diff --git a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp index 248be2c1..e7a922b6 100644 --- a/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp +++ b/services/cameraservice/cameraoperator/handler/src/dcamera_handler.cpp @@ -96,6 +96,13 @@ std::vector DCameraHandler::Query() DHLOGI("connection type: %{public}d", info->GetConnectionType()); continue; } +#ifdef DCAMERA_FRONT + std::string position = GetCameraPosition(info->GetPosition()); + if (position != CAMERA_POSITION_FRONT) { + DHLOGI("filter camera position is: %{public}s", position.c_str()); + continue; + } +#endif DHLOGI("get %{public}s, position: %{public}d, cameraType: %{public}d", GetAnonyString(info->GetID()).c_str(), info->GetPosition(), info->GetCameraType()); DHItem item; -- Gitee