Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit c0df3a47 authored by Android (Google) Code Review's avatar Android (Google) Code Review
Browse files

Merge change 25746 into eclair

* changes:
  Fix 2092386: Support yuyv for camera preview format.
parents b7da7dd0 eb68c46a
Loading
Loading
Loading
Loading
+11 −0
Original line number Diff line number Diff line
@@ -61135,6 +61135,17 @@
 visibility="public"
>
</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"
 type="int"
 transient="false"
+12 −1
Original line number Diff line number Diff line
@@ -673,6 +673,7 @@ public class Camera {
        // Formats for setPreviewFormat and setPictureFormat.
        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_RGB565 = "rgb565";
        private static final String PIXEL_FORMAT_JPEG = "jpeg";

@@ -957,7 +958,13 @@ public class Camera {
         */
        public List<Integer> getSupportedPreviewFormats() {
            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) {
            case PixelFormat.YCbCr_422_SP: return PIXEL_FORMAT_YUV422SP;
            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.JPEG:         return PIXEL_FORMAT_JPEG;
            default:                       return null;
@@ -1052,6 +1060,9 @@ public class Camera {
            if (format.equals(PIXEL_FORMAT_YUV420SP))
                return PixelFormat.YCbCr_420_SP;

            if (format.equals(PIXEL_FORMAT_YUV422I))
                return PixelFormat.YCbCr_422_I;

            if (format.equals(PIXEL_FORMAT_RGB565))
                return PixelFormat.RGB_565;

+7 −0
Original line number Diff line number Diff line
@@ -60,6 +60,13 @@ public class PixelFormat
     */
    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.
     */