am 28312293: Merge "Camera2: Add frameNumber to CaptureCallback#onCaptureStarted" into lmp-dev
* commit '28312293a2dfab504e5d1e6102c5392d652b6981': Camera2: Add frameNumber to CaptureCallback#onCaptureStarted
This commit is contained in:
@@ -12682,7 +12682,7 @@ package android.hardware.camera2 {
|
||||
method public void onCaptureProgressed(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, android.hardware.camera2.CaptureResult);
|
||||
method public void onCaptureSequenceAborted(android.hardware.camera2.CameraCaptureSession, int);
|
||||
method public void onCaptureSequenceCompleted(android.hardware.camera2.CameraCaptureSession, int, long);
|
||||
method public void onCaptureStarted(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, long);
|
||||
method public void onCaptureStarted(android.hardware.camera2.CameraCaptureSession, android.hardware.camera2.CaptureRequest, long, long);
|
||||
}
|
||||
|
||||
public static abstract class CameraCaptureSession.StateCallback {
|
||||
|
||||
@@ -483,7 +483,9 @@ public abstract class CameraCaptureSession implements AutoCloseable {
|
||||
* and in the buffers sent to each output Surface. These buffer
|
||||
* timestamps are accessible through, for example,
|
||||
* {@link android.media.Image#getTimestamp() Image.getTimestamp()} or
|
||||
* {@link android.graphics.SurfaceTexture#getTimestamp()}.</p>
|
||||
* {@link android.graphics.SurfaceTexture#getTimestamp()}.
|
||||
* The frame number included is equal to the frame number that will be included in
|
||||
* {@link CaptureResult#getFrameNumber}.</p>
|
||||
*
|
||||
* <p>For the simplest way to play a shutter sound camera shutter or a
|
||||
* video recording start/stop sound, see the
|
||||
@@ -494,9 +496,20 @@ public abstract class CameraCaptureSession implements AutoCloseable {
|
||||
* @param session the session returned by {@link CameraDevice#createCaptureSession}
|
||||
* @param request the request for the capture that just begun
|
||||
* @param timestamp the timestamp at start of capture, in nanoseconds.
|
||||
* @param frameNumber the frame number for this capture
|
||||
*
|
||||
* @see android.media.MediaActionSound
|
||||
*/
|
||||
public void onCaptureStarted(CameraCaptureSession session,
|
||||
CaptureRequest request, long timestamp, long frameNumber) {
|
||||
// Temporary trampoline for API change transition
|
||||
onCaptureStarted(session, request, timestamp);
|
||||
}
|
||||
|
||||
/**
|
||||
* Temporary for API change transition
|
||||
* @hide
|
||||
*/
|
||||
public void onCaptureStarted(CameraCaptureSession session,
|
||||
CaptureRequest request, long timestamp) {
|
||||
// default empty implementation
|
||||
|
||||
@@ -48,7 +48,8 @@ public class MethodNameInvoker<T> {
|
||||
/**
|
||||
* Invoke a method by its name.
|
||||
*
|
||||
* <p>If more than one method exists in {@code targetClass}, the first method will be used.</p>
|
||||
* <p>If more than one method exists in {@code targetClass}, the first method with the right
|
||||
* number of arguments will be used, and later calls will all use that method.</p>
|
||||
*
|
||||
* @param methodName
|
||||
* The name of the method, which will be matched 1:1 to the destination method
|
||||
@@ -68,8 +69,9 @@ public class MethodNameInvoker<T> {
|
||||
Method targetMethod = mMethods.get(methodName);
|
||||
if (targetMethod == null) {
|
||||
for (Method method : mTargetClass.getMethods()) {
|
||||
// TODO future: match by # of params and types of params if possible
|
||||
if (method.getName().equals(methodName)) {
|
||||
// TODO future: match types of params if possible
|
||||
if (method.getName().equals(methodName) &&
|
||||
(params.length == method.getParameterTypes().length) ) {
|
||||
targetMethod = method;
|
||||
mMethods.put(methodName, targetMethod);
|
||||
break;
|
||||
|
||||
@@ -98,8 +98,8 @@ public class CallbackProxies {
|
||||
|
||||
@Override
|
||||
public void onCaptureStarted(CameraDevice camera,
|
||||
CaptureRequest request, long timestamp) {
|
||||
mProxy.invoke("onCaptureStarted", camera, request, timestamp);
|
||||
CaptureRequest request, long timestamp, long frameNumber) {
|
||||
mProxy.invoke("onCaptureStarted", camera, request, timestamp, frameNumber);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -803,7 +803,7 @@ public class CameraDeviceImpl extends CameraDevice {
|
||||
* @see android.media.MediaActionSound
|
||||
*/
|
||||
public void onCaptureStarted(CameraDevice camera,
|
||||
CaptureRequest request, long timestamp) {
|
||||
CaptureRequest request, long timestamp, long frameNumber) {
|
||||
// default empty implementation
|
||||
}
|
||||
|
||||
@@ -1237,8 +1237,10 @@ public class CameraDeviceImpl extends CameraDevice {
|
||||
@Override
|
||||
public void onCaptureStarted(final CaptureResultExtras resultExtras, final long timestamp) {
|
||||
int requestId = resultExtras.getRequestId();
|
||||
final long frameNumber = resultExtras.getFrameNumber();
|
||||
|
||||
if (DEBUG) {
|
||||
Log.d(TAG, "Capture started for id " + requestId);
|
||||
Log.d(TAG, "Capture started for id " + requestId + " frame number " + frameNumber);
|
||||
}
|
||||
final CaptureCallbackHolder holder;
|
||||
|
||||
@@ -1263,7 +1265,7 @@ public class CameraDeviceImpl extends CameraDevice {
|
||||
holder.getCallback().onCaptureStarted(
|
||||
CameraDeviceImpl.this,
|
||||
holder.getRequest(resultExtras.getSubsequenceId()),
|
||||
timestamp);
|
||||
timestamp, frameNumber);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user