summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNipun Kwatra <nkwatra@google.com>2010-09-10 14:26:45 -0700
committerAndroid (Google) Code Review <android-gerrit@google.com>2010-09-10 14:26:45 -0700
commit35c8b532e576abc50fe7cdb42db0e22ccb1c7390 (patch)
tree40bec899e72afc0f48ea1fdcccf0fbdf101704ca
parentbcd3387eed8910c540d92f26fb6680e9e0ce0588 (diff)
parent4af0dfd6cbc13fa6a89ec1430cbe6f619cd64d8a (diff)
downloadframeworks_base-35c8b532e576abc50fe7cdb42db0e22ccb1c7390.zip
frameworks_base-35c8b532e576abc50fe7cdb42db0e22ccb1c7390.tar.gz
frameworks_base-35c8b532e576abc50fe7cdb42db0e22ccb1c7390.tar.bz2
Merge "Added specific resolution and time lapse profiles."
-rw-r--r--include/media/MediaProfiles.h15
-rw-r--r--media/java/android/media/CamcorderProfile.java88
-rw-r--r--media/jni/android_media_MediaProfiles.cpp4
-rw-r--r--media/libmedia/MediaProfiles.cpp49
4 files changed, 141 insertions, 15 deletions
diff --git a/include/media/MediaProfiles.h b/include/media/MediaProfiles.h
index c3cd361..df64ce8 100644
--- a/include/media/MediaProfiles.h
+++ b/include/media/MediaProfiles.h
@@ -25,7 +25,18 @@ namespace android {
enum camcorder_quality {
CAMCORDER_QUALITY_LOW = 0,
- CAMCORDER_QUALITY_HIGH = 1
+ CAMCORDER_QUALITY_HIGH = 1,
+ CAMCORDER_QUALITY_QCIF = 2,
+ CAMCORDER_QUALITY_480P = 3,
+ CAMCORDER_QUALITY_720P = 4,
+ CAMCORDER_QUALITY_1080P = 5,
+
+ CAMCORDER_QUALITY_TIME_LAPSE_LOW = 1000,
+ CAMCORDER_QUALITY_TIME_LAPSE_HIGH = 1001,
+ CAMCORDER_QUALITY_TIME_LAPSE_QCIF = 1002,
+ CAMCORDER_QUALITY_TIME_LAPSE_480P = 1003,
+ CAMCORDER_QUALITY_TIME_LAPSE_720P = 1004,
+ CAMCORDER_QUALITY_TIME_LAPSE_1080P = 1005
};
enum video_decoder {
@@ -283,6 +294,8 @@ private:
static MediaProfiles* createDefaultInstance();
static CamcorderProfile *createDefaultCamcorderLowProfile();
static CamcorderProfile *createDefaultCamcorderHighProfile();
+ static CamcorderProfile *createDefaultCamcorderTimeLapseLowProfile();
+ static CamcorderProfile *createDefaultCamcorderTimeLapseHighProfile();
static void createDefaultCamcorderProfiles(MediaProfiles *profiles);
static void createDefaultVideoEncoders(MediaProfiles *profiles);
static void createDefaultAudioEncoders(MediaProfiles *profiles);
diff --git a/media/java/android/media/CamcorderProfile.java b/media/java/android/media/CamcorderProfile.java
index a27df57..4a59166 100644
--- a/media/java/android/media/CamcorderProfile.java
+++ b/media/java/android/media/CamcorderProfile.java
@@ -39,22 +39,70 @@ package android.media;
*/
public class CamcorderProfile
{
+ // Do not change these values/ordinals without updating their counterpart
+ // in include/media/MediaProfiles.h!
+
/**
- * The output from camcorder recording sessions can have different quality levels.
- *
- * Currently, we define two quality levels: high quality and low quality.
- * A camcorder recording session with high quality level usually has higher output bit
- * rate, better video and/or audio recording quality, larger video frame
- * resolution and higher audio sampling rate, etc, than those with low quality
- * level.
- *
- * Do not change these values/ordinals without updating their counterpart
- * in include/media/MediaProfiles.h!
+ * Quality level corresponding to the lowest available resolution.
*/
public static final int QUALITY_LOW = 0;
+
+ /**
+ * Quality level corresponding to the highest available resolution.
+ */
public static final int QUALITY_HIGH = 1;
/**
+ * Quality level corresponding to the qcif (176 × 144) resolution.
+ */
+ private static final int QUALITY_QCIF = 2;
+
+ /**
+ * Quality level corresponding to the 480p (720 x 480) resolution.
+ */
+ private static final int QUALITY_480P = 3;
+
+ /**
+ * Quality level corresponding to the 720p (1280 x 720) resolution.
+ */
+ private static final int QUALITY_720P = 4;
+
+ /**
+ * Quality level corresponding to the 1080p (1920 x 1088) resolution.
+ */
+ private static final int QUALITY_1080P = 5;
+
+ /**
+ * Time lapse quality level corresponding to the lowest available resolution.
+ */
+ private static final int QUALITY_TIME_LAPSE_LOW = 1000;
+
+ /**
+ * Time lapse quality level corresponding to the highest available resolution.
+ */
+ private static final int QUALITY_TIME_LAPSE_HIGH = 1001;
+
+ /**
+ * Time lapse quality level corresponding to the qcif (176 × 144) resolution.
+ */
+ private static final int QUALITY_TIME_LAPSE_QCIF = 1002;
+
+ /**
+ * Time lapse quality level corresponding to the 480p (720 x 480) resolution.
+ */
+ private static final int QUALITY_TIME_LAPSE_480P = 1003;
+
+ /**
+ * Time lapse quality level corresponding to the 720p (1280 x 720) resolution.
+ */
+ private static final int QUALITY_TIME_LAPSE_720P = 1004;
+
+ /**
+ * Time lapse quality level corresponding to the 1080p (1920 x 1088) resolution.
+ */
+ private static final int QUALITY_TIME_LAPSE_1080P = 1005;
+
+ /**
* Default recording duration in seconds before the session is terminated.
* This is useful for applications like MMS has limited file size requirement.
*/
@@ -122,6 +170,7 @@ public class CamcorderProfile
* Returns the camcorder profile for the default camera at the given
* quality level.
* @param quality the target quality level for the camcorder profile
+ * @see #get(int, int)
*/
public static CamcorderProfile get(int quality) {
return get(0, quality);
@@ -130,11 +179,26 @@ public class CamcorderProfile
/**
* Returns the camcorder profile for the given camera at the given
* quality level.
+ *
+ * Quality levels QUALITY_LOW, QUALITY_HIGH are guaranteed to be supported, while
+ * other levels may or may not be supported.
+ * 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, 480p, 720p, or 1080p.
+ * E.g. if the device supports 480p, 720p, and 1080p, then low is 480p and high is
+ * 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
+ * resolution and higher audio sampling rate, etc, than those with lower quality
+ * level.
+ *
* @param cameraId the id for the camera
- * @param quality the target quality level for the camcorder profile
+ * @param quality the target quality level for the camcorder profile.
*/
public static CamcorderProfile get(int cameraId, int quality) {
- if (quality < QUALITY_LOW || quality > QUALITY_HIGH) {
+ if (!((quality >= QUALITY_LOW && quality <= QUALITY_1080P) ||
+ (quality >= QUALITY_TIME_LAPSE_LOW && quality <= QUALITY_TIME_LAPSE_1080P))) {
String errMessage = "Unsupported quality level: " + quality;
throw new IllegalArgumentException(errMessage);
}
diff --git a/media/jni/android_media_MediaProfiles.cpp b/media/jni/android_media_MediaProfiles.cpp
index cce9fd0..5aae853 100644
--- a/media/jni/android_media_MediaProfiles.cpp
+++ b/media/jni/android_media_MediaProfiles.cpp
@@ -165,7 +165,9 @@ 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_HIGH && quality != CAMCORDER_QUALITY_LOW) {
+ if (!((quality >= CAMCORDER_QUALITY_LOW && quality <= CAMCORDER_QUALITY_1080P) ||
+ (quality >= CAMCORDER_QUALITY_TIME_LAPSE_LOW &&
+ quality <= CAMCORDER_QUALITY_TIME_LAPSE_1080P))) {
jniThrowException(env, "java/lang/RuntimeException", "Unknown camcorder profile quality");
return NULL;
}
diff --git a/media/libmedia/MediaProfiles.cpp b/media/libmedia/MediaProfiles.cpp
index 3869389..37a33ed 100644
--- a/media/libmedia/MediaProfiles.cpp
+++ b/media/libmedia/MediaProfiles.cpp
@@ -59,8 +59,19 @@ const MediaProfiles::NameToTagMap MediaProfiles::sAudioDecoderNameMap[] = {
};
const MediaProfiles::NameToTagMap MediaProfiles::sCamcorderQualityNameMap[] = {
+ {"low", CAMCORDER_QUALITY_LOW},
{"high", CAMCORDER_QUALITY_HIGH},
- {"low", CAMCORDER_QUALITY_LOW}
+ {"qcif", CAMCORDER_QUALITY_QCIF},
+ {"480p", CAMCORDER_QUALITY_480P},
+ {"720p", CAMCORDER_QUALITY_720P},
+ {"1080p", CAMCORDER_QUALITY_1080P},
+
+ {"timelapselow", CAMCORDER_QUALITY_TIME_LAPSE_LOW},
+ {"timelapsehigh", CAMCORDER_QUALITY_TIME_LAPSE_HIGH},
+ {"timelapseqcif", CAMCORDER_QUALITY_TIME_LAPSE_QCIF},
+ {"timelapse480p", CAMCORDER_QUALITY_TIME_LAPSE_480P},
+ {"timelapse720p", CAMCORDER_QUALITY_TIME_LAPSE_720P},
+ {"timelapse1080p", CAMCORDER_QUALITY_TIME_LAPSE_1080P}
};
/*static*/ void
@@ -411,6 +422,40 @@ MediaProfiles::createDefaultVideoEncoders(MediaProfiles *profiles)
}
/*static*/ MediaProfiles::CamcorderProfile*
+MediaProfiles::createDefaultCamcorderTimeLapseHighProfile()
+{
+ MediaProfiles::VideoCodec *videoCodec =
+ new MediaProfiles::VideoCodec(VIDEO_ENCODER_H263, 20000000, 720, 480, 20);
+
+ AudioCodec *audioCodec = new AudioCodec(AUDIO_ENCODER_AMR_NB, 12200, 8000, 1);
+ CamcorderProfile *profile = new MediaProfiles::CamcorderProfile;
+ profile->mCameraId = 0;
+ profile->mFileFormat = OUTPUT_FORMAT_THREE_GPP;
+ profile->mQuality = CAMCORDER_QUALITY_TIME_LAPSE_HIGH;
+ profile->mDuration = 60;
+ profile->mVideoCodec = videoCodec;
+ profile->mAudioCodec = audioCodec;
+ return profile;
+}
+
+/*static*/ MediaProfiles::CamcorderProfile*
+MediaProfiles::createDefaultCamcorderTimeLapseLowProfile()
+{
+ MediaProfiles::VideoCodec *videoCodec =
+ new MediaProfiles::VideoCodec(VIDEO_ENCODER_H263, 1000000, 176, 144, 20);
+
+ AudioCodec *audioCodec = new AudioCodec(AUDIO_ENCODER_AMR_NB, 12200, 8000, 1);
+ CamcorderProfile *profile = new MediaProfiles::CamcorderProfile;
+ profile->mCameraId = 0;
+ profile->mFileFormat = OUTPUT_FORMAT_THREE_GPP;
+ profile->mQuality = CAMCORDER_QUALITY_TIME_LAPSE_LOW;
+ profile->mDuration = 60;
+ profile->mVideoCodec = videoCodec;
+ profile->mAudioCodec = audioCodec;
+ return profile;
+}
+
+/*static*/ MediaProfiles::CamcorderProfile*
MediaProfiles::createDefaultCamcorderHighProfile()
{
MediaProfiles::VideoCodec *videoCodec =
@@ -449,6 +494,8 @@ MediaProfiles::createDefaultCamcorderLowProfile()
/*static*/ void
MediaProfiles::createDefaultCamcorderProfiles(MediaProfiles *profiles)
{
+ profiles->mCamcorderProfiles.add(createDefaultCamcorderTimeLapseHighProfile());
+ profiles->mCamcorderProfiles.add(createDefaultCamcorderTimeLapseLowProfile());
profiles->mCamcorderProfiles.add(createDefaultCamcorderHighProfile());
profiles->mCamcorderProfiles.add(createDefaultCamcorderLowProfile());
}