Issue 263

git-svn-id: https://zxing.googlecode.com/svn/trunk@1094 59b500cc-1b3d-0410-9834-0bbf25fbcc57
This commit is contained in:
srowen 2009-11-02 23:04:24 +00:00
parent e913ff5990
commit 5be212750e

View file

@ -289,14 +289,19 @@ final class CameraManager {
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height()); rect.width(), rect.height());
default: default:
// Handle some non-standard values:
// There's no PixelFormat constant for this buffer format yet. // There's no PixelFormat constant for this buffer format yet.
if (previewFormatString.equals("yuv422i-yuyv")) { if (previewFormatString.equals("yuv422i-yuyv")) {
return new InterleavedYUV422LuminanceSource(data, width, height, rect.left, rect.top, return new InterleavedYUV422LuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height()); rect.width(), rect.height());
} else if (previewFormatString.equals("yuv420p")) {
// Assume this is a synonym for YUV420SP -- note the lack of 's'
return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top,
rect.width(), rect.height());
} }
break; throw new IllegalArgumentException("Unsupported picture format: " +
previewFormat + '/' + previewFormatString);
} }
return null;
} }
/** /**
@ -311,7 +316,7 @@ final class CameraManager {
Log.v(TAG, "Default preview size: " + size.width + ", " + size.height); Log.v(TAG, "Default preview size: " + size.width + ", " + size.height);
previewFormat = parameters.getPreviewFormat(); previewFormat = parameters.getPreviewFormat();
previewFormatString = parameters.get("preview-format"); previewFormatString = parameters.get("preview-format");
Log.v(TAG, "Default preview format: " + previewFormat); Log.v(TAG, "Default preview format: " + previewFormat + '/' + previewFormatString);
// Ensure that the camera resolution is a multiple of 8, as the screen may not be. // Ensure that the camera resolution is a multiple of 8, as the screen may not be.
// TODO: A better solution would be to request the supported preview resolutions // TODO: A better solution would be to request the supported preview resolutions