【高通平台】安卓平板,使用QQ 视频通话,视频旋转90度问题修改

 

 

修改过来的方向

Z:\smd450_8953pro\frameworks\base\core\java\android\hardware\Camera.java

//270 行
public static void getCameraInfo(int cameraId, CameraInfo cameraInfo) {
......


	//Log.e(TAG, "sssssssssss Audio sssssssssssssssss22 302,cameraInfo.orientation =" +cameraInfo.orientation );
		if(!(ActivityThread.currentOpPackageName().equalsIgnoreCase("org.codeaurora.snapcam") ) 
			  && !(ActivityThread.currentOpPackageName().equalsIgnoreCase("org.codeaurora.gallery") )){
			if(cameraInfo.facing == CameraInfo.CAMERA_FACING_BACK  ) {
				cameraInfo.orientation =0;
			}else if(cameraInfo.facing == CameraInfo.CAMERA_FACING_FRONT){
				cameraInfo.orientation =180;
			}
	//	Log.e(TAG, "sssssssssss Audio sssssssssssssssss33 309,cameraInfo.orientation =" +cameraInfo.orientation );
			
		}

Z:\smd450_8953pro\frameworks\base\core\java\android\view\OrientationEventListener.java

修改本地的方向

 class SensorEventListenerImpl implements SensorEventListener {
        private static final int _DATA_X = 0;
        private static final int _DATA_Y = 1;
        private static final int _DATA_Z = 2;
        
        public void onSensorChanged(SensorEvent event) {
            float[] values = event.values;
            int orientation = ORIENTATION_UNKNOWN;
            float X = -values[_DATA_X];
            float Y = -values[_DATA_Y];
            float Z = -values[_DATA_Z];        
            float magnitude = X*X + Y*Y;
            // Don't trust the angle if the magnitude is small compared to the y value
            if (magnitude * 4 >= Z*Z) {
                float OneEightyOverPi = 57.29577957855f;
                float angle = (float)Math.atan2(-Y, X) * OneEightyOverPi;
                orientation = 90 - (int)Math.round(angle);
                // normalize to 0 - 359 range
                while (orientation >= 360) {
                    orientation -= 360;
                } 
                while (orientation < 0) {
                    orientation += 360;
                }
            }
            if (mOldListener != null) {
                mOldListener.onSensorChanged(Sensor.TYPE_ACCELEROMETER, event.values);
            }
            if (orientation != mOrientation) {
                mOrientation = orientation;
				// oudelin add	
				if(ActivityThread.currentOpPackageName().equalsIgnoreCase("com.tencent.mobileqq")) {
					orientation=orientation+90;
			//		Log.w(TAG, "ssssss22  1256 orientation ="+orientation);
				}

 

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值