RK 微信视频通话预览倒立
09-01 15:43:01.319 D/CameraHal( 157): Calling process is: com.tencent.mm
09-01 15:43:01.319 D/CameraHal( 157): camera_get_camera_info(1367): camera_get_camera_info(1367): camera_0 facing(0), orientation(180)
Android5.1
一.hardware\rockchip\camera\CameraHal\CameraHal.h
CONFIG_CAMERA_FRONT_MIRROR_MDATACB_APK 左右镜像
CONFIG_CAMERA_FRONT_FLIP_MDATACB_APK 上下翻转
1 2 3 4 5 | #define CONFIG_CAMERA_FRONT_MIRROR_MDATACB 1 #define CONFIG_CAMERA_FRONT_MIRROR_MDATACB_ALL 0 #define CONFIG_CAMERA_FRONT_MIRROR_MDATACB_APK "<com.skype.raider>,<com.yahoo.mobile.client.andro>,<com.tencent.mm>" #define CONFIG_CAMERA_FRONT_FLIP_MDATACB_APK "<com.tencent.mm>,<com.xiaomi.channel>" #define CONFIG_CAMERA_SETVIDEOSIZE 0 |
一些宏开关
1 2 3 | #define CONFIG_CAMERA_ORIENTATION_SKYPE 0 #define CONFIG_CAMERA_FRONT_ORIENTATION_SKYPE 0 #define CONFIG_CAMERA_BACK_ORIENTATION_SKYPE 0 |
CONFIG_CAMERA_ORIENTATION_SKYPE 是宏开关,若要开启,设为 1
CONFIG_CAMERA_BACK_ORIENTATION_SKYPE 是后置摄像头的角度信息,可以设为 0、90、180、270
CONFIG_CAMERA_FRONT_ORIENTATION_SKYPE 是前置摄像头的角度信息,可以设为 0、90、180、270
hardware\rockchip\camera\CameraHal\CameraHal.cpp 镜像
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 | # if CONFIG_CAMERA_FRONT_MIRROR_MDATACB if (gCamInfos[cameraId].facing_info.facing == CAMERA_FACING_FRONT) { # if CONFIG_CAMERA_FRONT_MIRROR_MDATACB_ALL dataCbFrontMirror = true ; # else const char * cameraCallProcess = getCallingProcess(); if (strstr(CONFIG_CAMERA_FRONT_MIRROR_MDATACB_APK,cameraCallProcess)) { dataCbFrontMirror = true ; } else { dataCbFrontMirror = false ; } if (strstr(CONFIG_CAMERA_FRONT_FLIP_MDATACB_APK,cameraCallProcess)) { dataCbFrontFlip = true ; } else { dataCbFrontFlip = false ; } #endif } else { dataCbFrontMirror = false ; dataCbFrontFlip = false ; } # else dataCbFrontMirror = false ; #endif property_get( "persist.sf.Cam_front_filp" , cam_FrontFilp, "0" ); Cam_FrontFlip = strtol(cam_FrontFilp, 0 , 0 ); LOGD( "dataCbFrontMirror22222 = %d \n" ,Cam_FrontFlip); |
二.hardware\rockchip\camera\CameraHal\CameraHal_Module.cpp
配置 camerainfo 中的方向 通过获取进程名来旋转 camera方向 getCallingProcess()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 | int camera_get_camera_info( int camera_id, struct camera_info *info) { int rv = 0 ,fp; int face_value = CAMERA_FACING_BACK; int orientation = 0 ; char process_name[ 30 ]; char cam_hwrotaion[PROPERTY_VALUE_MAX]; int hwrotation = 0 ; const char * xh_cameraCallProcess = getCallingProcess(); if (camera_id > gCamerasNumber) { LOGE( "%s camera_id out of bounds, camera_id = %d, num supported = %d" ,__FUNCTION__, camera_id, gCamerasNumber); rv = -EINVAL; goto end; } # if CONFIG_CAMERA_ORIENTATION_SKYPE //默认不开 process_name[ 0 ] = 0x00 ; sprintf(process_name, "/proc/%d/cmdline" ,getCallingPid()); fp = open(process_name, O_RDONLY); if (fp < 0 ) { memset(process_name, 0x00 ,sizeof(process_name)); LOGE( "%s(%d): Obtain calling process info failed" ,__FUNCTION__,__LINE__); } else { memset(process_name, 0x00 ,sizeof(process_name)); read(fp, process_name, 30 ); close(fp); fp = - 1 ; } info->facing = gCamInfos[camera_id].facing_info.facing; if (strstr(process_name, "com.skype.rover" )) { info->orientation = (info->facing == CAMERA_FACING_BACK)? CONFIG_CAMERA_BACK_ORIENTATION_SKYPE : CONFIG_CAMERA_FRONT_ORIENTATION_SKYPE; } else { info->orientation = gCamInfos[camera_id].facing_info.orientation; } # else info->facing = gCamInfos[camera_id].facing_info.facing; info->orientation = gCamInfos[camera_id].facing_info.orientation; property_get( "persist.sf.CameraRotation" , cam_hwrotaion, "0" ); //add by eric hwrotation = strtol(cam_hwrotaion, 0 , 0 ); //LOGE("hwrotation %d",hwrotation); if (hwrotation == 0 ){ info->orientation = 0 ; } else if (hwrotation == 90 ){ info->orientation = 90 ; } else if (hwrotation == 180 ){ info->orientation = 180 ; } else { info->orientation = 270 ; } if (strstr(CONFIG_CAMERA_FRONT_MIRROR_MDATACB_APK,xh_cameraCallProcess)) { LOGD( "gatsby cam_hwrotaion %d\n" ,hwrotation); if (hwrotation == 0 ){ info->orientation = 180 ; } else if (hwrotation == 90 ){ info->orientation = 270 ; } else if (hwrotation == 180 ){ info->orientation = 0 ; } else { info->orientation = 90 ; } } #endif |
设置camera 预览镜像
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | diff --git a/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp b/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp index 070be2d..0250f92 100755 --- a/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp +++ b/frameworks/av/services/camera/libcameraservice/api1/CameraClient.cpp @@ - 654 , 8 + 654 , 8 @@ status_t CameraClient::sendCommand(int32_t cmd, int32_t arg1, int32_t arg2) { if (cmd == CAMERA_CMD_SET_DISPLAY_ORIENTATION) { // Mirror the preview if the camera is front-facing. // 如果相机是正面的,则镜像预览。 - orientation = getOrientation(arg1, mCameraFacing == CAMERA_FACING_FRONT); + //orientation = getOrientation(arg1, mCameraFacing == CAMERA_FACING_FRONT); + orientation = getOrientation(arg1, 1 ); if (orientation == - 1 ) return BAD_VALUE; if (mOrientation != orientation) { |
分类:
RockChip
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 如何编写易于单元测试的代码
· 10年+ .NET Coder 心语,封装的思维:从隐藏、稳定开始理解其本质意义
· .NET Core 中如何实现缓存的预热?
· 从 HTTP 原因短语缺失研究 HTTP/2 和 HTTP/3 的设计差异
· AI与.NET技术实操系列:向量存储与相似性搜索在 .NET 中的实现
· 地球OL攻略 —— 某应届生求职总结
· 周边上新:园子的第一款马克杯温暖上架
· Open-Sora 2.0 重磅开源!
· 提示词工程——AI应用必不可少的技术
· .NET周刊【3月第1期 2025-03-02】
2020-09-01 RK:Launcher3 禁用快捷方式、禁用壁纸小控件、隐藏指定应用图标