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)

 

hardware\rockchip\camera\CameraHal\CameraHal.h

#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>"

hardware\rockchip\camera\CameraHal\CameraHal_Module.cpp

通过获取进程名来旋转 camera方向  getCallingProcess()

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
end:
    LOGD("%s(%d): camera_%d facing(%d), orientation(%d)",__FUNCTION__,__LINE__,camera_id,info->facing,info->orientation);
    return rv;
}

  

  

 

上一篇:页面放大缩小 调整比例方法


下一篇:尝试理解Swift中的@escaping