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

Commit dd0b16c2 authored by James Dong's avatar James Dong
Browse files

Add two methods to Camera.java

o getSupportedVideoSizes() allows us to retrieve the list of the supported
  video sizes from the camera

o getPreferredPreviewSizeForVideoRecording() allows us to retrieve the
  preferred/recommended preview size for camcorder applications

bug - 3237021

Change-Id: I52fc9938d389bb411406320b0309775b6f44f4dc
parent 407b4e91
Loading
Loading
Loading
Loading
+22 −0
Original line number Diff line number Diff line
@@ -89752,6 +89752,17 @@
 visibility="public"
>
</method>
<method name="getPreferredPreviewSizeForVideo"
 return="android.hardware.Camera.Size"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getPreviewFormat"
 return="int"
 abstract="false"
@@ -89941,6 +89952,17 @@
 visibility="public"
>
</method>
<method name="getSupportedVideoSizes"
 return="java.util.List&lt;android.hardware.Camera.Size&gt;"
 abstract="false"
 native="false"
 synchronized="false"
 static="false"
 final="false"
 deprecated="not deprecated"
 visibility="public"
>
</method>
<method name="getSupportedWhiteBalance"
 return="java.util.List&lt;java.lang.String&gt;"
 abstract="false"
+44 −1
Original line number Diff line number Diff line
@@ -1021,6 +1021,9 @@ public class Camera {
        private static final String KEY_ZOOM_SUPPORTED = "zoom-supported";
        private static final String KEY_SMOOTH_ZOOM_SUPPORTED = "smooth-zoom-supported";
        private static final String KEY_FOCUS_DISTANCES = "focus-distances";
        private static final String KEY_VIDEO_SIZE = "video-size";
        private static final String KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO =
                                            "preferred-preview-size-for-video";

        // Parameter key suffix for supported values.
        private static final String SUPPORTED_VALUES_SUFFIX = "-values";
@@ -1398,7 +1401,7 @@ public class Camera {
        /**
         * Returns the dimensions setting for preview pictures.
         *
         * @return a Size object with the height and width setting
         * @return a Size object with the width and height setting
         *          for the preview picture
         */
        public Size getPreviewSize() {
@@ -1417,6 +1420,46 @@ public class Camera {
            return splitSize(str);
        }

        /**
         * Gets the supported video frame sizes that can be used by
         * MediaRecorder.
         *
         * If the returned list is not null, the returned list will contain at
         * least one Size and one of the sizes in the returned list must be
         * passed to MediaRecorder.setVideoSize() for camcorder application if
         * camera is used as the video source. In this case, the size of the
         * preview can be different from the resolution of the recorded video
         * during video recording.
         *
         * @return a list of Size object if camera has separate preview and
         *         video output; otherwise, null is returned.
         * @see #getPreferredPreviewSizeForVideo()
         */
        public List<Size> getSupportedVideoSizes() {
            String str = get(KEY_VIDEO_SIZE + SUPPORTED_VALUES_SUFFIX);
            return splitSize(str);
        }

        /**
         * Returns the preferred or recommended preview size (width and height)
         * in pixels for video recording. Camcorder applications should
         * set the preview size to a value that is not larger than the
         * preferred preview size. In other words, the product of the width
         * and height of the preview size should not be larger than that of
         * the preferred preview size. In addition, we recommend to choose a
         * preview size that has the same aspect ratio as the resolution of
         * video to be recorded.
         *
         * @return the preferred preview size (width and height) in pixels for
         *         video recording if getSupportedVideoSizes() does not return
         *         null; otherwise, null is returned.
         * @see #getSupportedVideoSizes()
         */
        public Size getPreferredPreviewSizeForVideo() {
            String pair = get(KEY_PREFERRED_PREVIEW_SIZE_FOR_VIDEO);
            return strToSize(pair);
        }

        /**
         * Sets the dimensions for EXIF thumbnail in Jpeg picture. If
         * applications set both width and height to 0, EXIF will not contain