From 5be212750ecac735269b33b9a1d20b84a5666973 Mon Sep 17 00:00:00 2001 From: srowen Date: Mon, 2 Nov 2009 23:04:24 +0000 Subject: [PATCH] Issue 263 git-svn-id: https://zxing.googlecode.com/svn/trunk@1094 59b500cc-1b3d-0410-9834-0bbf25fbcc57 --- .../google/zxing/client/android/CameraManager.java | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/android/src/com/google/zxing/client/android/CameraManager.java b/android/src/com/google/zxing/client/android/CameraManager.java index c55bc7058..74f5a5709 100755 --- a/android/src/com/google/zxing/client/android/CameraManager.java +++ b/android/src/com/google/zxing/client/android/CameraManager.java @@ -289,14 +289,19 @@ final class CameraManager { return new PlanarYUVLuminanceSource(data, width, height, rect.left, rect.top, rect.width(), rect.height()); default: + // Handle some non-standard values: // There's no PixelFormat constant for this buffer format yet. if (previewFormatString.equals("yuv422i-yuyv")) { return new InterleavedYUV422LuminanceSource(data, width, height, rect.left, rect.top, 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); previewFormat = parameters.getPreviewFormat(); 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. // TODO: A better solution would be to request the supported preview resolutions