Landscape preview in landscape orientation on sdk>=8

This commit is contained in:
Guillaume Beraudo 2010-12-14 12:58:28 +01:00
parent 013e835343
commit 276874bf64
3 changed files with 9 additions and 6 deletions

View file

@ -167,7 +167,8 @@ public abstract class AndroidCameraRecord {
public void setDisplayOrientation(int rotation) {
displayOrientation = rotation;
}
protected int getDisplayOrientation() {return displayOrientation;}
protected int rotateCapturedFrame() {
if (params.videoDimensionsInverted) {
return 1; // always rotate 90°

View file

@ -30,10 +30,10 @@ import android.util.Log;
* @author Guillaume Beraudo
*
*/
public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5 {
public class AndroidCameraRecordAPI8Impl extends AndroidCameraRecordImplAPI5 {
public AndroidCameraRecordBufferedImpl(RecorderParams parameters) {
public AndroidCameraRecordAPI8Impl(RecorderParams parameters) {
super(parameters);
}
@ -66,8 +66,10 @@ public class AndroidCameraRecordBufferedImpl extends AndroidCameraRecordImplAPI5
protected void onSettingCameraParameters(Parameters parameters) {
super.onSettingCameraParameters(parameters);
// Only on v8 hardware
camera.setDisplayOrientation(90 * rotateCapturedFrame());
camera.setDisplayOrientation(90 * getPreviewCaptureRotation());
}
private int getPreviewCaptureRotation() {
return (4 + 1 - displayOrientation) % 4;
}
}

View file

@ -155,7 +155,7 @@ public class AndroidCameraRecordManager {
parameters.rotation = rotation;
parameters.surfaceView = surfaceView;
if (version >= 8) {
recorder = new AndroidCameraRecordBufferedImpl(parameters);
recorder = new AndroidCameraRecordAPI8Impl(parameters);
} else if (version >= 5) {
recorder = new AndroidCameraRecordImplAPI5(parameters);
} else {