summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/com/android/camera/EffectsRecorder.java44
-rwxr-xr-xsrc/com/android/camera/VideoCamera.java21
-rwxr-xr-xsrc/com/android/camera/panorama/PanoramaActivity.java13
-rw-r--r--src/com/android/camera/ui/SharePopup.java5
4 files changed, 69 insertions, 14 deletions
diff --git a/src/com/android/camera/EffectsRecorder.java b/src/com/android/camera/EffectsRecorder.java
index bd0aff5a..8b63cebf 100644
--- a/src/com/android/camera/EffectsRecorder.java
+++ b/src/com/android/camera/EffectsRecorder.java
@@ -80,6 +80,7 @@ public class EffectsRecorder {
private Camera mCameraDevice;
private CamcorderProfile mProfile;
+ private double mCaptureRate = 0;
private SurfaceHolder mPreviewSurfaceHolder;
private int mPreviewWidth;
private int mPreviewHeight;
@@ -222,9 +223,31 @@ public class EffectsRecorder {
* disable the limit
*/
public synchronized void setMaxFileSize(long maxFileSize) {
+ switch (mState) {
+ case STATE_RECORD:
+ throw new RuntimeException("setMaxFileSize cannot be called while recording!");
+ case STATE_RELEASED:
+ throw new RuntimeException("setMaxFileSize called on an already released recorder!");
+ default:
+ break;
+ }
mMaxFileSize = maxFileSize;
}
+ public void setCaptureRate(double fps) {
+ switch (mState) {
+ case STATE_RECORD:
+ throw new RuntimeException("setCaptureRate cannot be called while recording!");
+ case STATE_RELEASED:
+ throw new RuntimeException("setCaptureRate called on an already released recorder!");
+ default:
+ break;
+ }
+
+ if (mLogVerbose) Log.v(TAG, "Setting time lapse capture rate to " + fps + " fps");
+ mCaptureRate = fps;
+ }
+
public void setPreviewDisplay(SurfaceHolder previewSurfaceHolder,
int previewWidth,
int previewHeight) {
@@ -382,10 +405,8 @@ public class EffectsRecorder {
"recordingWidth", mProfile.videoFrameWidth,
"recordingHeight", mProfile.videoFrameHeight,
"recordingProfile", mProfile,
- "audioSource", MediaRecorder.AudioSource.CAMCORDER,
"learningDoneListener", mLearningDoneListener,
"recordingDoneListener", mRecordingDoneListener);
-
mRunner = null;
mGraphId = -1;
mCurrentEffect = EFFECT_NONE;
@@ -592,17 +613,34 @@ public class EffectsRecorder {
} else {
recorder.setInputValue("outputFile", mOutputFile);
}
+ // It is ok to set the audiosource without checking for timelapse here
+ // since that check will be done in the MediaEncoderFilter itself
+ recorder.setInputValue("audioSource", MediaRecorder.AudioSource.CAMCORDER);
+ recorder.setInputValue("recordingProfile", mProfile);
recorder.setInputValue("orientationHint", mOrientationHint);
+ // Important to set the timelapseinterval to 0 if the capture rate is not >0
+ // since the recorder does not get created every time the recording starts.
+ // The recorder infers whether the capture is timelapsed based on the value of
+ // this interval
+ boolean captureTimeLapse = mCaptureRate > 0;
+ if (captureTimeLapse) {
+ double timeBetweenFrameCapture = 1 / mCaptureRate;
+ recorder.setInputValue("timelapseRecordingIntervalUs",
+ (long) (1000000 * timeBetweenFrameCapture));
+ } else {
+ recorder.setInputValue("timelapseRecordingIntervalUs", 0L);
+ }
+
if (mInfoListener != null) {
recorder.setInputValue("infoListener", mInfoListener);
}
if (mErrorListener != null) {
recorder.setInputValue("errorListener", mErrorListener);
}
+ recorder.setInputValue("maxFileSize", mMaxFileSize);
recorder.setInputValue("recording", true);
if (mRecordSound != null) mRecordSound.play();
- recorder.setInputValue("maxFileSize", mMaxFileSize);
mState = STATE_RECORD;
}
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 6b1ed1d8..89603113 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -720,8 +720,10 @@ public class VideoCamera extends ActivityBase
null);
}
} else {
- // Set quality to 480p for effects
- quality = CamcorderProfile.QUALITY_480P;
+ // Set quality to 480p for effects, unless intent is overriding it
+ if (!intent.hasExtra(MediaStore.EXTRA_VIDEO_QUALITY)) {
+ quality = CamcorderProfile.QUALITY_480P;
+ }
// On initial startup, can get here before indicator control is
// enabled. In that case, UI quality override handled in
// initializeIndicatorControl.
@@ -1240,6 +1242,8 @@ public class VideoCamera extends ActivityBase
mEffectsRecorder = new EffectsRecorder(this);
+ // TODO: Confirm none of the foll need to go to initializeEffectsRecording()
+ // and none of these change even when the preview is not refreshed.
mEffectsRecorder.setCamera(mCameraDevice);
mEffectsRecorder.setCameraFacing(info.facing);
mEffectsRecorder.setProfile(mProfile);
@@ -1291,7 +1295,15 @@ public class VideoCamera extends ActivityBase
requestedSizeLimit = myExtras.getLong(MediaStore.EXTRA_SIZE_LIMIT);
}
- // TODO: Timelapse
+ mEffectsRecorder.setProfile(mProfile);
+ // important to set the capture rate to zero if not timelapsed, since the
+ // effectsrecorder object does not get created again for each recording
+ // session
+ if (mCaptureTimeLapse) {
+ mEffectsRecorder.setCaptureRate((1000 / (double) mTimeBetweenTimeLapseFrameCaptureMs));
+ } else {
+ mEffectsRecorder.setCaptureRate(0);
+ }
// Set output file
if (mVideoFileDescriptor != null) {
@@ -1667,6 +1679,9 @@ public class VideoCamera extends ActivityBase
if (!mIsVideoCaptureIntent) {
enableCameraControls(true);
}
+ // The orientation was fixed during video recording. Now make it
+ // reflect the device orientation as video recording is stopped.
+ setOrientationIndicator(mOrientationCompensation);
keepScreenOnAwhile();
if (shouldAddToMediaStoreNow) {
addVideoToMediaStore();
diff --git a/src/com/android/camera/panorama/PanoramaActivity.java b/src/com/android/camera/panorama/PanoramaActivity.java
index c28cc2e8..0e055e5b 100755
--- a/src/com/android/camera/panorama/PanoramaActivity.java
+++ b/src/com/android/camera/panorama/PanoramaActivity.java
@@ -772,11 +772,14 @@ public class PanoramaActivity extends ActivityBase implements
int orientation = Exif.getOrientation(jpeg.data);
Uri uri = savePanorama(jpeg.data, jpeg.width, jpeg.height, orientation);
if (uri != null) {
- // Create a thumbnail whose width is equal or bigger
- // than the entire screen.
- int ratio = (int) Math.ceil((double) jpeg.width /
- mPanoLayout.getWidth());
- int inSampleSize = Integer.highestOneBit(ratio);
+ // Create a thumbnail whose width or height is equal or bigger
+ // than the screen's width or height.
+ int widthRatio = (int) Math.ceil((double) jpeg.width
+ / mPanoLayout.getWidth());
+ int heightRatio = (int) Math.ceil((double) jpeg.height
+ / mPanoLayout.getHeight());
+ int inSampleSize = Integer.highestOneBit(
+ Math.max(widthRatio, heightRatio));
mThumbnail = Thumbnail.createThumbnail(
jpeg.data, orientation, inSampleSize, uri);
}
diff --git a/src/com/android/camera/ui/SharePopup.java b/src/com/android/camera/ui/SharePopup.java
index 84bada41..3917c548 100644
--- a/src/com/android/camera/ui/SharePopup.java
+++ b/src/com/android/camera/ui/SharePopup.java
@@ -198,10 +198,9 @@ public class SharePopup extends PopupWindow implements View.OnClickListener,
new RelativeLayout.LayoutParams(lpOld.width, lpOld.height);
mRootView.setBackgroundDrawable(null);
- if (mBitmapWidth > mBitmapHeight*2) {
+ if (mBitmapWidth > mBitmapHeight * 2 || mBitmapHeight > mBitmapWidth * 2) {
// panorama image
- lpNew.addRule(RelativeLayout.ALIGN_PARENT_LEFT);
- lpNew.addRule(RelativeLayout.ALIGN_PARENT_RIGHT);
+ lpNew.addRule(RelativeLayout.CENTER_HORIZONTAL);
lpNew.addRule(RelativeLayout.CENTER_VERTICAL);
// panorama images block the preview from showing in the background