mirror of
https://gitlab.linphone.org/BC/public/linphone-iphone.git
synced 2026-02-07 14:18:25 +00:00
Portrait mode.
This commit is contained in:
parent
03b80b879e
commit
8f406c5706
4 changed files with 26 additions and 7 deletions
|
|
@ -77,7 +77,11 @@ public abstract class AndroidCameraRecord {
|
|||
}
|
||||
|
||||
parameters.set("camera-id", params.cameraId);
|
||||
parameters.setPreviewSize(params.width, params.height);
|
||||
if (!params.videoDimensionsInverted) {
|
||||
parameters.setPreviewSize(params.width, params.height);
|
||||
} else {
|
||||
parameters.setPreviewSize(params.height, params.width);
|
||||
}
|
||||
parameters.setPreviewFrameRate(Math.round(params.fps));
|
||||
if (parameters.getSupportedFocusModes().contains(Camera.Parameters.FOCUS_MODE_AUTO)) {
|
||||
Log.w(tag, "Auto Focus supported by camera device");
|
||||
|
|
@ -182,6 +186,7 @@ public abstract class AndroidCameraRecord {
|
|||
int cameraId;
|
||||
int rotation;
|
||||
public SurfaceView surfaceView;
|
||||
boolean videoDimensionsInverted;
|
||||
|
||||
public RecorderParams(long ptr) {
|
||||
filterDataNativePtr = ptr;
|
||||
|
|
|
|||
|
|
@ -35,17 +35,19 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev
|
|||
private double timeElapsedBetweenFrames = 0;
|
||||
private long lastFrameTime = 0;
|
||||
private final double expectedTimeBetweenFrames;
|
||||
private boolean videoDimensionsInverted;
|
||||
|
||||
public AndroidCameraRecordImpl(RecorderParams parameters) {
|
||||
super(parameters);
|
||||
expectedTimeBetweenFrames = 1d / Math.round(parameters.fps);
|
||||
filterCtxPtr = parameters.filterDataNativePtr;
|
||||
videoDimensionsInverted = parameters.videoDimensionsInverted;
|
||||
|
||||
storePreviewCallBack(this);
|
||||
}
|
||||
|
||||
|
||||
private native void putImage(long filterCtxPtr, byte[] buffer, int orientation);
|
||||
private native void putImage(long filterCtxPtr, byte[] buffer, int orientation, boolean videoDimensionsInverted);
|
||||
|
||||
|
||||
public void onPreviewFrame(byte[] data, Camera camera) {
|
||||
|
|
@ -69,7 +71,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev
|
|||
long curTime = System.currentTimeMillis();
|
||||
if (lastFrameTime == 0) {
|
||||
lastFrameTime = curTime;
|
||||
putImage(filterCtxPtr, data, getOrientationCode());
|
||||
putImage(filterCtxPtr, data, getOrientationCode(), videoDimensionsInverted);
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
@ -82,7 +84,7 @@ public class AndroidCameraRecordImpl extends AndroidCameraRecord implements Prev
|
|||
timeElapsedBetweenFrames = currentTimeElapsed;
|
||||
|
||||
// Log.d("onPreviewFrame: ", Integer.toString(data.length));
|
||||
putImage(filterCtxPtr, data, getOrientationCode());
|
||||
putImage(filterCtxPtr, data, getOrientationCode(), videoDimensionsInverted);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
|||
|
|
@ -44,7 +44,7 @@ public class AndroidCameraRecordManager {
|
|||
public static final int CAMERA_ID_FIXME_USE_PREFERENCE = 0;
|
||||
private static final int version = Integer.parseInt(Build.VERSION.SDK);
|
||||
private static Map<Integer, AndroidCameraRecordManager> instances = new HashMap<Integer, AndroidCameraRecordManager>();
|
||||
|
||||
|
||||
|
||||
// singleton
|
||||
private AndroidCameraRecordManager(int cameraId) {
|
||||
|
|
@ -83,16 +83,19 @@ public class AndroidCameraRecordManager {
|
|||
|
||||
private List<Size> supportedVideoSizes;
|
||||
private int rotation;
|
||||
private static final String tag = "Linphone";
|
||||
|
||||
|
||||
public void setParametersFromFilter(long filterDataPtr, int height, int width, float fps) {
|
||||
stopVideoRecording();
|
||||
RecorderParams p = new RecorderParams(filterDataPtr);
|
||||
p.fps = fps;
|
||||
p.width = width;
|
||||
p.height = height;
|
||||
p.cameraId = cameraId;
|
||||
p.videoDimensionsInverted = width < height;
|
||||
parameters = p;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public final void setSurfaceView(final SurfaceView sv, final int rotation) {
|
||||
|
|
@ -103,16 +106,20 @@ public class AndroidCameraRecordManager {
|
|||
holder.addCallback(new Callback() {
|
||||
public void surfaceDestroyed(SurfaceHolder holder) {
|
||||
surfaceView = null;
|
||||
Log.d(tag , "Video capture surface destroyed");
|
||||
stopVideoRecording();
|
||||
}
|
||||
|
||||
public void surfaceCreated(SurfaceHolder holder) {
|
||||
surfaceView = sv;
|
||||
Log.d(tag , "Video capture surface created");
|
||||
tryToStartVideoRecording();
|
||||
}
|
||||
|
||||
public void surfaceChanged(SurfaceHolder holder, int format, int width,
|
||||
int height) {}
|
||||
int height) {
|
||||
Log.d(tag , "Video capture surface changed");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -30,6 +30,7 @@ class LinphoneCallImpl implements LinphoneCall {
|
|||
native private long getRemoteAddress(long nativePtr);
|
||||
native private int getState(long nativePtr);
|
||||
private native long getCurrentParams(long nativePtr);
|
||||
private native void enableCamera(long nativePtr, boolean enabled);
|
||||
|
||||
protected LinphoneCallImpl(long aNativePtr) {
|
||||
nativePtr = aNativePtr;
|
||||
|
|
@ -66,4 +67,8 @@ class LinphoneCallImpl implements LinphoneCall {
|
|||
public LinphoneCallParams getCurrentParamsReadWrite() {
|
||||
return getCurrentParamsReadOnly().copy();
|
||||
}
|
||||
|
||||
public void enableCamera(boolean enabled) {
|
||||
enableCamera(nativePtr, enabled);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue