summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEino-Ville Talvala <etalvala@google.com>2011-10-20 13:54:00 -0700
committerEino-Ville Talvala <etalvala@google.com>2011-10-26 10:34:49 -0700
commit14a3ffc328740e8fd4734dfa124e4682df8bdd4a (patch)
tree132725c605f1d8ef2f5fb77707cf398231b3495b
parentb8bd7ee0f8b0c3e0381ae6364bbeca4f28bdf7a4 (diff)
downloadLegacyCamera-14a3ffc328740e8fd4734dfa124e4682df8bdd4a.zip
LegacyCamera-14a3ffc328740e8fd4734dfa124e4682df8bdd4a.tar.gz
LegacyCamera-14a3ffc328740e8fd4734dfa124e4682df8bdd4a.tar.bz2
Add portrait support to effects pipeline in VideoCamera.
Needed to enable app to switch to portrait for startup speed. Still supports landscape for landscape-native devices. Bug: 5446617 Change-Id: I9853ff50d9fcd8cf53cc6e65d6c16319c1b27f76
-rw-r--r--src/com/android/camera/EffectsRecorder.java18
-rwxr-xr-xsrc/com/android/camera/VideoCamera.java6
2 files changed, 23 insertions, 1 deletions
diff --git a/src/com/android/camera/EffectsRecorder.java b/src/com/android/camera/EffectsRecorder.java
index a561011..73c5a92 100644
--- a/src/com/android/camera/EffectsRecorder.java
+++ b/src/com/android/camera/EffectsRecorder.java
@@ -93,6 +93,7 @@ public class EffectsRecorder {
private long mMaxFileSize = 0;
private int mMaxDurationMs = 0;
private int mCameraFacing = Camera.CameraInfo.CAMERA_FACING_BACK;
+ private boolean mAppIsLandscape;
private int mEffect = EFFECT_NONE;
private int mCurrentEffect = EFFECT_NONE;
@@ -376,6 +377,16 @@ public class EffectsRecorder {
setRecordingOrientation();
}
+ /** Passes the native orientation of the Camera app (device dependent)
+ * to allow for correct output aspect ratio. Defaults to portrait */
+ public void setAppToLandscape(boolean landscape) {
+ if (mState != STATE_CONFIGURE) {
+ throw new RuntimeException(
+ "setAppToLandscape called after configuration!");
+ }
+ mAppIsLandscape = landscape;
+ }
+
public void setCameraFacing(int facing) {
switch (mState) {
case STATE_RELEASED:
@@ -420,7 +431,12 @@ public class EffectsRecorder {
Log.v(TAG, "Effects framework initializing. Recording size "
+ mProfile.videoFrameWidth + ", " + mProfile.videoFrameHeight);
}
-
+ if (!mAppIsLandscape) {
+ int tmp;
+ tmp = mProfile.videoFrameWidth;
+ mProfile.videoFrameWidth = mProfile.videoFrameHeight;
+ mProfile.videoFrameHeight = tmp;
+ }
mGraphEnv.addReferences(
"textureSourceCallback", mSourceReadyCallback,
"recordingWidth", mProfile.videoFrameWidth,
diff --git a/src/com/android/camera/VideoCamera.java b/src/com/android/camera/VideoCamera.java
index 4d09fee..ba189ca 100755
--- a/src/com/android/camera/VideoCamera.java
+++ b/src/com/android/camera/VideoCamera.java
@@ -32,6 +32,7 @@ import android.content.ContentValues;
import android.content.Context;
import android.content.Intent;
import android.content.IntentFilter;
+import android.content.pm.ActivityInfo;
import android.content.res.Configuration;
import android.graphics.Bitmap;
import android.hardware.Camera.CameraInfo;
@@ -1234,12 +1235,17 @@ public class VideoCamera extends ActivityBase
// If the mCameraDevice is null, then this activity is going to finish
if (mCameraDevice == null) return;
+ boolean inLandscape =
+ (getRequestedOrientation() ==
+ ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
+
CameraInfo info = CameraHolder.instance().getCameraInfo()[mCameraId];
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.setAppToLandscape(inLandscape);
mEffectsRecorder.setCamera(mCameraDevice);
mEffectsRecorder.setCameraFacing(info.facing);
mEffectsRecorder.setProfile(mProfile);