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

Commit c2f33167 authored by Zhijun He's avatar Zhijun He Committed by Android (Google) Code Review
Browse files

Merge "CamcorderProfiles: add high speed profile constants" into lmp-dev

parents 5c8b7898 f7badff8
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -14369,6 +14369,11 @@ package android.media {
    field public static final int QUALITY_720P = 5; // 0x5
    field public static final int QUALITY_CIF = 3; // 0x3
    field public static final int QUALITY_HIGH = 1; // 0x1
    field public static final int QUALITY_HIGH_SPEED_1080P = 2004; // 0x7d4
    field public static final int QUALITY_HIGH_SPEED_480P = 2002; // 0x7d2
    field public static final int QUALITY_HIGH_SPEED_720P = 2003; // 0x7d3
    field public static final int QUALITY_HIGH_SPEED_HIGH = 2001; // 0x7d1
    field public static final int QUALITY_HIGH_SPEED_LOW = 2000; // 0x7d0
    field public static final int QUALITY_LOW = 0; // 0x0
    field public static final int QUALITY_QCIF = 2; // 0x2
    field public static final int QUALITY_QVGA = 7; // 0x7
+52 −6
Original line number Diff line number Diff line
@@ -148,6 +148,39 @@ public class CamcorderProfile
    private static final int QUALITY_TIME_LAPSE_LIST_START = QUALITY_TIME_LAPSE_LOW;
    private static final int QUALITY_TIME_LAPSE_LIST_END = QUALITY_TIME_LAPSE_2160P;

    /**
     * High speed ( >= 100fps) quality level corresponding to the lowest available resolution.
     */
    public static final int QUALITY_HIGH_SPEED_LOW = 2000;

    /**
     * High speed ( >= 100fps) quality level corresponding to the highest available resolution.
     */
    public static final int QUALITY_HIGH_SPEED_HIGH = 2001;

    /**
     * High speed ( >= 100fps) quality level corresponding to the 480p (720 x 480) resolution.
     *
     * Note that the horizontal resolution for 480p can also be other
     * values, such as 640 or 704, instead of 720.
     */
    public static final int QUALITY_HIGH_SPEED_480P = 2002;

    /**
     * High speed ( >= 100fps) quality level corresponding to the 720p (1280 x 720) resolution.
     */
    public static final int QUALITY_HIGH_SPEED_720P = 2003;

    /**
     * High speed ( >= 100fps) quality level corresponding to the 1080p (1920 x 1080 or 1920x1088)
     * resolution.
     */
    public static final int QUALITY_HIGH_SPEED_1080P = 2004;

    // Start and end of high speed quality list
    private static final int QUALITY_HIGH_SPEED_LIST_START = QUALITY_HIGH_SPEED_LOW;
    private static final int QUALITY_HIGH_SPEED_LIST_END = QUALITY_HIGH_SPEED_1080P;

    /**
     * Default recording duration in seconds before the session is terminated.
     * This is useful for applications like MMS has limited file size requirement.
@@ -240,13 +273,17 @@ public class CamcorderProfile
     * {@link #hasProfile(int, int)}.
     * QUALITY_LOW refers to the lowest quality available, while QUALITY_HIGH refers to
     * the highest quality available.
     * QUALITY_LOW/QUALITY_HIGH have to match one of qcif, cif, 480p, 720p, or 1080p.
     * E.g. if the device supports 480p, 720p, and 1080p, then low is 480p and high is
     * 1080p.
     * QUALITY_LOW/QUALITY_HIGH have to match one of qcif, cif, 480p, 720p, 1080p or 2160p.
     * E.g. if the device supports 480p, 720p, 1080p and 2160p, then low is 480p and high is
     * 2160p.
     *
     * The same is true for time lapse quality levels, i.e. QUALITY_TIME_LAPSE_LOW,
     * QUALITY_TIME_LAPSE_HIGH are guaranteed to be supported and have to match one of
     * qcif, cif, 480p, 720p, or 1080p.
     * qcif, cif, 480p, 720p, 1080p, or 2160p.
     *
     * For high speed quality levels, they may or may not be supported. If a subset of the levels
     * are supported, QUALITY_HIGH_SPEED_LOW and QUALITY_HIGH_SPEED_HIGH are guaranteed to be
     * supported and have to match one of 480p, 720p, or 1080p.
     *
     * A camcorder recording session with higher quality level usually has higher output
     * bit rate, better video and/or audio recording quality, larger video frame
@@ -262,6 +299,7 @@ public class CamcorderProfile
     * @see #QUALITY_480P
     * @see #QUALITY_720P
     * @see #QUALITY_1080P
     * @see #QUALITY_2160P
     * @see #QUALITY_TIME_LAPSE_LOW
     * @see #QUALITY_TIME_LAPSE_HIGH
     * @see #QUALITY_TIME_LAPSE_QCIF
@@ -269,12 +307,20 @@ public class CamcorderProfile
     * @see #QUALITY_TIME_LAPSE_480P
     * @see #QUALITY_TIME_LAPSE_720P
     * @see #QUALITY_TIME_LAPSE_1080P
     * @see #QUALITY_TIME_LAPSE_2160P
     * @see #QUALITY_HIGH_SPEED_LOW
     * @see #QUALITY_HIGH_SPEED_HIGH
     * @see #QUALITY_HIGH_SPEED_480P
     * @see #QUALITY_HIGH_SPEED_720P
     * @see #QUALITY_HIGH_SPEED_1080P
    */
    public static CamcorderProfile get(int cameraId, int quality) {
        if (!((quality >= QUALITY_LIST_START &&
               quality <= QUALITY_LIST_END) ||
              (quality >= QUALITY_TIME_LAPSE_LIST_START &&
               quality <= QUALITY_TIME_LAPSE_LIST_END))) {
               quality <= QUALITY_TIME_LAPSE_LIST_END) ||
               (quality >= QUALITY_HIGH_SPEED_LIST_START &&
               quality <= QUALITY_HIGH_SPEED_LIST_END))) {
            String errMessage = "Unsupported quality level: " + quality;
            throw new IllegalArgumentException(errMessage);
        }
+3 −1
Original line number Diff line number Diff line
@@ -166,7 +166,9 @@ static bool isCamcorderQualityKnown(int quality)
    return ((quality >= CAMCORDER_QUALITY_LIST_START &&
             quality <= CAMCORDER_QUALITY_LIST_END) ||
            (quality >= CAMCORDER_QUALITY_TIME_LAPSE_LIST_START &&
             quality <= CAMCORDER_QUALITY_TIME_LAPSE_LIST_END));
             quality <= CAMCORDER_QUALITY_TIME_LAPSE_LIST_END) ||
             (quality >= CAMCORDER_QUALITY_HIGH_SPEED_LIST_START &&
              quality <= CAMCORDER_QUALITY_HIGH_SPEED_LIST_END));
}

static jobject