Merge "Add YV12 preview format to camera parameter constants."
diff --git a/core/java/android/hardware/Camera.java b/core/java/android/hardware/Camera.java
index d8a5b45..958bf08 100644
--- a/core/java/android/hardware/Camera.java
+++ b/core/java/android/hardware/Camera.java
@@ -1362,6 +1362,7 @@
private static final String PIXEL_FORMAT_YUV422SP = "yuv422sp";
private static final String PIXEL_FORMAT_YUV420SP = "yuv420sp";
private static final String PIXEL_FORMAT_YUV422I = "yuv422i-yuyv";
+ private static final String PIXEL_FORMAT_YUV420P = "yuv420p";
private static final String PIXEL_FORMAT_RGB565 = "rgb565";
private static final String PIXEL_FORMAT_JPEG = "jpeg";
@@ -1882,6 +1883,7 @@
case ImageFormat.NV16: return PIXEL_FORMAT_YUV422SP;
case ImageFormat.NV21: return PIXEL_FORMAT_YUV420SP;
case ImageFormat.YUY2: return PIXEL_FORMAT_YUV422I;
+ case ImageFormat.YV12: return PIXEL_FORMAT_YUV420P;
case ImageFormat.RGB_565: return PIXEL_FORMAT_RGB565;
case ImageFormat.JPEG: return PIXEL_FORMAT_JPEG;
default: return null;
@@ -1901,6 +1903,9 @@
if (format.equals(PIXEL_FORMAT_YUV422I))
return ImageFormat.YUY2;
+ if (format.equals(PIXEL_FORMAT_YUV420P))
+ return ImageFormat.YV12;
+
if (format.equals(PIXEL_FORMAT_RGB565))
return ImageFormat.RGB_565;
diff --git a/include/camera/CameraParameters.h b/include/camera/CameraParameters.h
index 431aaa47..da2f049 100644
--- a/include/camera/CameraParameters.h
+++ b/include/camera/CameraParameters.h
@@ -417,11 +417,10 @@
// Pixel color formats for KEY_PREVIEW_FORMAT, KEY_PICTURE_FORMAT,
// and KEY_VIDEO_FRAME_FORMAT
- // Planar variant of the YUV420 color format
- static const char PIXEL_FORMAT_YUV420P[];
static const char PIXEL_FORMAT_YUV422SP[];
static const char PIXEL_FORMAT_YUV420SP[]; // NV21
static const char PIXEL_FORMAT_YUV422I[]; // YUY2
+ static const char PIXEL_FORMAT_YUV420P[]; // YV12
static const char PIXEL_FORMAT_RGB565[];
static const char PIXEL_FORMAT_JPEG[];
diff --git a/libs/camera/CameraParameters.cpp b/libs/camera/CameraParameters.cpp
index e9a5f8c..0fd79a4 100644
--- a/libs/camera/CameraParameters.cpp
+++ b/libs/camera/CameraParameters.cpp
@@ -132,10 +132,10 @@
const char CameraParameters::SCENE_MODE_CANDLELIGHT[] = "candlelight";
const char CameraParameters::SCENE_MODE_BARCODE[] = "barcode";
-const char CameraParameters::PIXEL_FORMAT_YUV420P[] = "yuv420p";
const char CameraParameters::PIXEL_FORMAT_YUV422SP[] = "yuv422sp";
const char CameraParameters::PIXEL_FORMAT_YUV420SP[] = "yuv420sp";
const char CameraParameters::PIXEL_FORMAT_YUV422I[] = "yuv422i-yuyv";
+const char CameraParameters::PIXEL_FORMAT_YUV420P[] = "yuv420p";
const char CameraParameters::PIXEL_FORMAT_RGB565[] = "rgb565";
const char CameraParameters::PIXEL_FORMAT_JPEG[] = "jpeg";