3) 在CameraConfigurationManager.java中void setDesiredCameraParameters(Camera camera)方法
在setParameters之前增加
camera.setDisplayOrientation(90);
4) 在DecodeHandler.java中的 decode(byte[] data, int width, int height)方法在
PlanarYUVLuminanceSource source = CameraManager.get().buildLuminanceSource(data, width, height);
之前添加:
byte[] rotatedData = new byte[data.length];
for (int y = 0; y < height; y++) {
for (int x = 0; x < width; x++)
rotatedData[x * height + height - y - 1] = data[x + y * width];
}
int tmp = width; // Here we are swapping, that’s the difference to #11
width = height;
height = tmp;
data = rotatedData;
5) 将CameraConfigurationManager的 initFromCameraParameters(Camera camera)方法整个替换如下
该方法防止竖屏后屏幕拉伸
/**
- Reads, one time, values from the camera that are needed by the