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

Commit 92d0a64b authored by James Dong's avatar James Dong Committed by Android (Google) Code Review
Browse files

Merge "Add QVGA resolution to CamcorderProfile" into ics-factoryrom

parents 3b6377b1 07b9ae33
Loading
Loading
Loading
Loading
+4 −2
Original line number Diff line number Diff line
@@ -32,7 +32,8 @@ enum camcorder_quality {
    CAMCORDER_QUALITY_480P = 4,
    CAMCORDER_QUALITY_720P = 5,
    CAMCORDER_QUALITY_1080P = 6,
    CAMCORDER_QUALITY_LIST_END = 6,
    CAMCORDER_QUALITY_QVGA = 7,
    CAMCORDER_QUALITY_LIST_END = 7,

    CAMCORDER_QUALITY_TIME_LAPSE_LIST_START = 1000,
    CAMCORDER_QUALITY_TIME_LAPSE_LOW  = 1000,
@@ -42,7 +43,8 @@ enum camcorder_quality {
    CAMCORDER_QUALITY_TIME_LAPSE_480P = 1004,
    CAMCORDER_QUALITY_TIME_LAPSE_720P = 1005,
    CAMCORDER_QUALITY_TIME_LAPSE_1080P = 1006,
    CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1006,
    CAMCORDER_QUALITY_TIME_LAPSE_QVGA = 1007,
    CAMCORDER_QUALITY_TIME_LAPSE_LIST_END = 1007,
};

/**
+24 −2
Original line number Diff line number Diff line
@@ -80,6 +80,16 @@ public class CamcorderProfile
     */
    public static final int QUALITY_1080P = 6;

    /**
     * Quality level corresponding to the QVGA (320x240) resolution.
     * {@hide}
     */
    public static final int QUALITY_QVGA = 7;

    // Start and end of quality list
    private static final int QUALITY_LIST_START = QUALITY_LOW;
    private static final int QUALITY_LIST_END = QUALITY_QVGA;

    /**
     * Time lapse quality level corresponding to the lowest available resolution.
     */
@@ -115,6 +125,16 @@ public class CamcorderProfile
     */
    public static final int QUALITY_TIME_LAPSE_1080P = 1006;

    /**
     * Time lapse quality level corresponding to the QVGA (320 x 240) resolution.
     * {@hide}
     */
    public static final int QUALITY_TIME_LAPSE_QVGA = 1007;

    // Start and end of timelapse quality list
    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_QVGA;

    /**
     * Default recording duration in seconds before the session is terminated.
     * This is useful for applications like MMS has limited file size requirement.
@@ -238,8 +258,10 @@ public class CamcorderProfile
     * @see #QUALITY_TIME_LAPSE_1080P
     */
    public static CamcorderProfile get(int cameraId, int quality) {
        if (!((quality >= QUALITY_LOW && quality <= QUALITY_1080P) ||
                (quality >= QUALITY_TIME_LAPSE_LOW && quality <= QUALITY_TIME_LAPSE_1080P))) {
        if (!((quality >= QUALITY_LIST_START &&
               quality <= QUALITY_LIST_END) ||
              (quality >= QUALITY_TIME_LAPSE_LIST_START &&
               quality <= QUALITY_TIME_LAPSE_LIST_END))) {
            String errMessage = "Unsupported quality level: " + quality;
            throw new IllegalArgumentException(errMessage);
        }
+10 −6
Original line number Diff line number Diff line
@@ -161,13 +161,19 @@ android_media_MediaProfiles_native_get_audio_encoder_cap(JNIEnv *env, jobject th
    return cap;
}

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));
}

static jobject
android_media_MediaProfiles_native_get_camcorder_profile(JNIEnv *env, jobject thiz, jint id, jint quality)
{
    LOGV("native_get_camcorder_profile: %d %d", id, quality);
    if (!((quality >= CAMCORDER_QUALITY_LOW && quality <= CAMCORDER_QUALITY_1080P) ||
                (quality >= CAMCORDER_QUALITY_TIME_LAPSE_LOW &&
                quality <= CAMCORDER_QUALITY_TIME_LAPSE_1080P))) {
    if (!isCamcorderQualityKnown(quality)) {
        jniThrowException(env, "java/lang/RuntimeException", "Unknown camcorder profile quality");
        return NULL;
    }
@@ -216,9 +222,7 @@ static jboolean
android_media_MediaProfiles_native_has_camcorder_profile(JNIEnv *env, jobject thiz, jint id, jint quality)
{
    LOGV("native_has_camcorder_profile: %d %d", id, quality);
    if (!((quality >= CAMCORDER_QUALITY_LOW && quality <= CAMCORDER_QUALITY_1080P) ||
                (quality >= CAMCORDER_QUALITY_TIME_LAPSE_LOW &&
                quality <= CAMCORDER_QUALITY_TIME_LAPSE_1080P))) {
    if (!isCamcorderQualityKnown(quality)) {
        return false;
    }

+4 −2
Original line number Diff line number Diff line
@@ -67,6 +67,7 @@ const MediaProfiles::NameToTagMap MediaProfiles::sCamcorderQualityNameMap[] = {
    {"480p", CAMCORDER_QUALITY_480P},
    {"720p", CAMCORDER_QUALITY_720P},
    {"1080p", CAMCORDER_QUALITY_1080P},
    {"qvga", CAMCORDER_QUALITY_QVGA},

    {"timelapselow",  CAMCORDER_QUALITY_TIME_LAPSE_LOW},
    {"timelapsehigh", CAMCORDER_QUALITY_TIME_LAPSE_HIGH},
@@ -74,7 +75,8 @@ const MediaProfiles::NameToTagMap MediaProfiles::sCamcorderQualityNameMap[] = {
    {"timelapsecif", CAMCORDER_QUALITY_TIME_LAPSE_CIF},
    {"timelapse480p", CAMCORDER_QUALITY_TIME_LAPSE_480P},
    {"timelapse720p", CAMCORDER_QUALITY_TIME_LAPSE_720P},
    {"timelapse1080p", CAMCORDER_QUALITY_TIME_LAPSE_1080P}
    {"timelapse1080p", CAMCORDER_QUALITY_TIME_LAPSE_1080P},
    {"timelapseqvga", CAMCORDER_QUALITY_TIME_LAPSE_QVGA},
};

/*static*/ void
@@ -1139,7 +1141,7 @@ int MediaProfiles::getStartTimeOffsetMs(int cameraId) const {
    if (index >= 0) {
        offsetTimeMs = mStartTimeOffsets.valueFor(cameraId);
    }
    LOGV("%s: offsetTime=%d ms and cameraId=%d", offsetTimeMs, cameraId);
    LOGV("offsetTime=%d ms and cameraId=%d", offsetTimeMs, cameraId);
    return offsetTimeMs;
}