Merge branch 'master' of ssh://android-git:29418/platform/frameworks/base
This commit is contained in:
@@ -78,6 +78,12 @@ public:
|
||||
int getCamcorderProfileParamByName(const char *name, int cameraId,
|
||||
camcorder_quality quality) const;
|
||||
|
||||
/**
|
||||
* Returns true if a profile for the given camera at the given quality exists,
|
||||
* or false if not.
|
||||
*/
|
||||
bool hasCamcorderProfile(int cameraId, camcorder_quality quality) const;
|
||||
|
||||
/**
|
||||
* Returns the output file formats supported.
|
||||
*/
|
||||
@@ -263,6 +269,8 @@ private:
|
||||
Vector<int> mLevels;
|
||||
};
|
||||
|
||||
int getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const;
|
||||
|
||||
// Debug
|
||||
static void logVideoCodec(const VideoCodec& codec);
|
||||
static void logAudioCodec(const AudioCodec& codec);
|
||||
|
||||
@@ -173,7 +173,7 @@ public class CamcorderProfile
|
||||
* @see #get(int, int)
|
||||
*/
|
||||
public static CamcorderProfile get(int quality) {
|
||||
return get(0, quality);
|
||||
return get(android.hardware.Camera.CAMERA_ID_DEFAULT, quality);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -205,6 +205,27 @@ public class CamcorderProfile
|
||||
return native_get_camcorder_profile(cameraId, quality);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if camcorder profile exists for the default camera at
|
||||
* the given quality level.
|
||||
* @param quality the target quality level for the camcorder profile
|
||||
* @hide
|
||||
*/
|
||||
public static boolean hasProfile(int quality) {
|
||||
return hasProfile(android.hardware.Camera.CAMERA_ID_DEFAULT, quality);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns true if camcorder profile exists for the given camera at
|
||||
* the given quality level.
|
||||
* @param cameraId the id for the camera
|
||||
* @param quality the target quality level for the camcorder profile
|
||||
* @hide
|
||||
*/
|
||||
public static boolean hasProfile(int cameraId, int quality) {
|
||||
return native_has_camcorder_profile(cameraId, quality);
|
||||
}
|
||||
|
||||
static {
|
||||
System.loadLibrary("media_jni");
|
||||
native_init();
|
||||
@@ -242,4 +263,6 @@ public class CamcorderProfile
|
||||
private static native final void native_init();
|
||||
private static native final CamcorderProfile native_get_camcorder_profile(
|
||||
int cameraId, int quality);
|
||||
private static native final boolean native_has_camcorder_profile(
|
||||
int cameraId, int quality);
|
||||
}
|
||||
|
||||
@@ -212,6 +212,20 @@ android_media_MediaProfiles_native_get_camcorder_profile(JNIEnv *env, jobject th
|
||||
audioChannels);
|
||||
}
|
||||
|
||||
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))) {
|
||||
return false;
|
||||
}
|
||||
|
||||
camcorder_quality q = static_cast<camcorder_quality>(quality);
|
||||
return sProfiles->hasCamcorderProfile(id, q);
|
||||
}
|
||||
|
||||
static jint
|
||||
android_media_MediaProfiles_native_get_num_video_decoders(JNIEnv *env, jobject thiz)
|
||||
{
|
||||
@@ -291,6 +305,8 @@ static JNINativeMethod gMethodsForCamcorderProfileClass[] = {
|
||||
{"native_init", "()V", (void *)android_media_MediaProfiles_native_init},
|
||||
{"native_get_camcorder_profile", "(II)Landroid/media/CamcorderProfile;",
|
||||
(void *)android_media_MediaProfiles_native_get_camcorder_profile},
|
||||
{"native_has_camcorder_profile", "(II)Z",
|
||||
(void *)android_media_MediaProfiles_native_has_camcorder_profile},
|
||||
};
|
||||
|
||||
static JNINativeMethod gMethodsForDecoderCapabilitiesClass[] = {
|
||||
|
||||
@@ -715,13 +715,8 @@ Vector<audio_decoder> MediaProfiles::getAudioDecoders() const
|
||||
return decoders; // copy out
|
||||
}
|
||||
|
||||
int MediaProfiles::getCamcorderProfileParamByName(const char *name,
|
||||
int cameraId,
|
||||
camcorder_quality quality) const
|
||||
int MediaProfiles::getCamcorderProfileIndex(int cameraId, camcorder_quality quality) const
|
||||
{
|
||||
LOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d",
|
||||
name, cameraId, quality);
|
||||
|
||||
int index = -1;
|
||||
for (size_t i = 0, n = mCamcorderProfiles.size(); i < n; ++i) {
|
||||
if (mCamcorderProfiles[i]->mCameraId == cameraId &&
|
||||
@@ -730,6 +725,17 @@ int MediaProfiles::getCamcorderProfileParamByName(const char *name,
|
||||
break;
|
||||
}
|
||||
}
|
||||
return index;
|
||||
}
|
||||
|
||||
int MediaProfiles::getCamcorderProfileParamByName(const char *name,
|
||||
int cameraId,
|
||||
camcorder_quality quality) const
|
||||
{
|
||||
LOGV("getCamcorderProfileParamByName: %s for camera %d, quality %d",
|
||||
name, cameraId, quality);
|
||||
|
||||
int index = getCamcorderProfileIndex(cameraId, quality);
|
||||
if (index == -1) {
|
||||
LOGE("The given camcorder profile camera %d quality %d is not found",
|
||||
cameraId, quality);
|
||||
@@ -752,6 +758,11 @@ int MediaProfiles::getCamcorderProfileParamByName(const char *name,
|
||||
return -1;
|
||||
}
|
||||
|
||||
bool MediaProfiles::hasCamcorderProfile(int cameraId, camcorder_quality quality) const
|
||||
{
|
||||
return (getCamcorderProfileIndex(cameraId, quality) != -1);
|
||||
}
|
||||
|
||||
Vector<int> MediaProfiles::getImageEncodingQualityLevels(int cameraId) const
|
||||
{
|
||||
Vector<int> result;
|
||||
|
||||
Reference in New Issue
Block a user