am c0df3a47: Merge change 25746 into eclair

Merge commit 'c0df3a473f6973cf32b343a886dd62559a4b93c7' into eclair-plus-aosp

* commit 'c0df3a473f6973cf32b343a886dd62559a4b93c7':
  Fix 2092386: Support yuyv for camera preview format.
This commit is contained in:
Chih-Chung Chang
2009-09-20 13:57:36 -07:00
committed by Android Git Automerger
3 changed files with 30 additions and 1 deletions

View File

@@ -61135,6 +61135,17 @@
visibility="public" visibility="public"
> >
</field> </field>
<field name="YCbCr_422_I"
type="int"
transient="false"
volatile="false"
value="20"
static="true"
final="true"
deprecated="not deprecated"
visibility="public"
>
</field>
<field name="YCbCr_422_SP" <field name="YCbCr_422_SP"
type="int" type="int"
transient="false" transient="false"

View File

@@ -673,6 +673,7 @@ public class Camera {
// Formats for setPreviewFormat and setPictureFormat. // Formats for setPreviewFormat and setPictureFormat.
private static final String PIXEL_FORMAT_YUV422SP = "yuv422sp"; private static final String PIXEL_FORMAT_YUV422SP = "yuv422sp";
private static final String PIXEL_FORMAT_YUV420SP = "yuv420sp"; private static final String PIXEL_FORMAT_YUV420SP = "yuv420sp";
private static final String PIXEL_FORMAT_YUV422I = "yuv422i-yuyv";
private static final String PIXEL_FORMAT_RGB565 = "rgb565"; private static final String PIXEL_FORMAT_RGB565 = "rgb565";
private static final String PIXEL_FORMAT_JPEG = "jpeg"; private static final String PIXEL_FORMAT_JPEG = "jpeg";
@@ -957,7 +958,13 @@ public class Camera {
*/ */
public List<Integer> getSupportedPreviewFormats() { public List<Integer> getSupportedPreviewFormats() {
String str = get(KEY_PREVIEW_FORMAT + SUPPORTED_VALUES_SUFFIX); String str = get(KEY_PREVIEW_FORMAT + SUPPORTED_VALUES_SUFFIX);
return splitInt(str); ArrayList<Integer> formats = new ArrayList<Integer>();
for (String s : split(str)) {
int f = pixelFormatForCameraFormat(s);
if (f == PixelFormat.UNKNOWN) continue;
formats.add(f);
}
return formats;
} }
/** /**
@@ -1036,6 +1043,7 @@ public class Camera {
switch(pixel_format) { switch(pixel_format) {
case PixelFormat.YCbCr_422_SP: return PIXEL_FORMAT_YUV422SP; case PixelFormat.YCbCr_422_SP: return PIXEL_FORMAT_YUV422SP;
case PixelFormat.YCbCr_420_SP: return PIXEL_FORMAT_YUV420SP; case PixelFormat.YCbCr_420_SP: return PIXEL_FORMAT_YUV420SP;
case PixelFormat.YCbCr_422_I: return PIXEL_FORMAT_YUV422I;
case PixelFormat.RGB_565: return PIXEL_FORMAT_RGB565; case PixelFormat.RGB_565: return PIXEL_FORMAT_RGB565;
case PixelFormat.JPEG: return PIXEL_FORMAT_JPEG; case PixelFormat.JPEG: return PIXEL_FORMAT_JPEG;
default: return null; default: return null;
@@ -1052,6 +1060,9 @@ public class Camera {
if (format.equals(PIXEL_FORMAT_YUV420SP)) if (format.equals(PIXEL_FORMAT_YUV420SP))
return PixelFormat.YCbCr_420_SP; return PixelFormat.YCbCr_420_SP;
if (format.equals(PIXEL_FORMAT_YUV422I))
return PixelFormat.YCbCr_422_I;
if (format.equals(PIXEL_FORMAT_RGB565)) if (format.equals(PIXEL_FORMAT_RGB565))
return PixelFormat.RGB_565; return PixelFormat.RGB_565;

View File

@@ -60,6 +60,13 @@ public class PixelFormat
*/ */
public static final int YCbCr_420_SP= 0x11; public static final int YCbCr_420_SP= 0x11;
/** YCbCr format used for images, which uses YUYV (YUY2) encoding format.
* This is an alternative format for camera preview images. Whether this
* format is supported by the camera hardware can be determined by
* {@link android.hardware.Camera.Parameters#getSupportedPreviewFormats()}.
*/
public static final int YCbCr_422_I = 0x14;
/** /**
* Encoded formats. These are not necessarily supported by the hardware. * Encoded formats. These are not necessarily supported by the hardware.
*/ */