Class CaptureListener2¶
- java.lang.Object
-
- com.iristick.smartglass.core.camera.CaptureListener2
- All Implemented Interfaces:
- CaptureListener
public abstract class CaptureListener2 extends Object implements CaptureListener
CaptureRequests
submitted together to a camera session.
This is an abstract class rather than an interface to provide default implementations for all methods.
When the sequence is processed, the onCaptureCompleted
or
onCaptureFailed
methods are called for each request in the sequence.
When all requests are processed, onCaptureSequenceCompleted
is called. All these methods are also called if the camera is closed during the processing of
the sequence (in which case onCaptureFailed
is called for each remaining request).
If the sequence is flushed from the queue before processing has started, only the
onCaptureSequenceAborted
method is called.
- Since:
- 1.2
Constructor Summary¶
Constructor and Description |
---|
CaptureListener2() |
Method Summary¶
Modifier and Type | Method and Description |
---|---|
void |
onCaptureBufferLost(CaptureSession session,
CaptureRequest request,
Surface surface,
long frameNumber)
Called when a buffer for capture could not be sent to its destination surface.
|
void |
onCaptureCompleted(CaptureSession session,
CaptureRequest request,
CaptureResult result)
Called when an image capture has successfully completed.
|
void |
onCaptureFailed(CaptureSession session,
CaptureRequest request,
CaptureFailure failure)
Called instead of
onCaptureCompleted when the
session failed to produce a CaptureResult for the request. |
void |
onCaptureSequenceAborted(CaptureSession session,
int sequenceId)
Called when a capture sequence aborts before any
CaptureResult
or CaptureFailure for it have been returned via this listener. |
void |
onCaptureSequenceCompleted(CaptureSession session,
int sequenceId,
long frameNumber)
Called when a capture sequence finishes and all
CaptureResult
or CaptureFailure for it have been returned via this listener. |
void |
onCaptureStarted(CaptureSession session,
CaptureRequest request,
long frameNumber)
Called when an image capture is started.
|
void |
onCaptureStarted(CaptureSession session,
CaptureRequest request,
long timestamp,
long frameNumber)
Deprecated.
The
timestamp field has been deprecated.
The onCaptureStarted(CaptureSession, CaptureRequest, long) method should
be overridden instead. |
void |
onPostProcessCompleted(CaptureSession session,
CaptureRequest request,
CaptureResult result)
Called when post processing of a request is completed.
|
Methods inherited from class java.lang.Object¶
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail¶
CaptureListener2¶
public CaptureListener2()
Method Detail¶
onCaptureStarted¶
public void onCaptureStarted(@NonNull CaptureSession session, @NonNull CaptureRequest request, long frameNumber)
Called when an image capture is started.
This callback is invoked when the capture of a frame begins, so it is the most appropriate time for playing a shutter sound or triggering UI indicators.
- Parameters:
session
- The session.request
- The request that was given tosession
.frameNumber
- The frame number for this capture.- Since:
- 1.2
onCaptureStarted¶
@Deprecated public void onCaptureStarted(@NonNull CaptureSession session, @NonNull CaptureRequest request, long timestamp, long frameNumber)
timestamp
field has been deprecated.
The onCaptureStarted(CaptureSession, CaptureRequest, long)
method should
be overridden instead.Called when an image capture is started.
This callback is invoked when the capture of a frame begins, so it is the most appropriate time for playing a shutter sound or triggering UI indicators.
The default implementation calls onCaptureStarted(CaptureSession, CaptureRequest, long)
.
- Specified by:
onCaptureStarted
in interfaceCaptureListener
- Parameters:
session
- The session.request
- The request that was given tosession
.timestamp
- Deprecated! This timestamp should not be used as it is not related to theCaptureResult.SENSOR_TIMESTAMP
value of a completed frame. This argument may be removed in future SDK releases.frameNumber
- The frame number for this capture.
onCaptureBufferLost¶
public void onCaptureBufferLost(@NonNull CaptureSession session, @NonNull CaptureRequest request, @NonNull Surface surface, long frameNumber)
Called when a buffer for capture could not be sent to its destination surface.
When the whole request fails, onCaptureFailed
is called instead.
The default implementation does nothing.
- Specified by:
onCaptureBufferLost
in interfaceCaptureListener
- Parameters:
session
- The session.request
- The request that was given tosession
.surface
- The target output surface for which the capture failed.frameNumber
- The frame number for this capture.
onCaptureCompleted¶
public void onCaptureCompleted(@NonNull CaptureSession session, @NonNull CaptureRequest request, @NonNull CaptureResult result)
Called when an image capture has successfully completed.
The default implementation does nothing.
- Specified by:
onCaptureCompleted
in interfaceCaptureListener
- Parameters:
session
- The session.request
- The request that was given tosession
.result
- The result from the capture, including the frame number.
onCaptureFailed¶
public void onCaptureFailed(@NonNull CaptureSession session, @NonNull CaptureRequest request, @NonNull CaptureFailure failure)
Called instead of onCaptureCompleted
when the
session failed to produce a CaptureResult
for the request.
Other requests are unaffected, and some or all image buffers from the capture may have been pushed to their respective output streams.
The default implementation does nothing.
- Specified by:
onCaptureFailed
in interfaceCaptureListener
- Parameters:
session
- The session.request
- The request that was given tosession
.failure
- The output failure from the capture, including the failure reason and the frame number.
onPostProcessCompleted¶
public void onPostProcessCompleted(@NonNull CaptureSession session, @NonNull CaptureRequest request, @NonNull CaptureResult result)
Called when post processing of a request is completed.
This method is always called after onCaptureCompleted(com.iristick.smartglass.core.camera.CaptureSession, com.iristick.smartglass.core.camera.CaptureRequest, com.iristick.smartglass.core.camera.CaptureResult)
. This method is never called
for failed or aborted requests and for requests that do not require post processing.
The default implementation does nothing.
- Parameters:
session
- The session.request
- The request that was given tosession
.result
- The result from the capture, including the frame number and post processing results.- Since:
- 1.2
onCaptureSequenceCompleted¶
public void onCaptureSequenceCompleted(@NonNull CaptureSession session, int sequenceId, long frameNumber)
Called when a capture sequence finishes and all CaptureResult
or CaptureFailure
for it have been returned via this listener.
If the capture sequence is aborted before any requests have been processed,
onCaptureSequenceAborted
is invoked instead.
The default implementation does nothing.
- Specified by:
onCaptureSequenceCompleted
in interfaceCaptureListener
- Parameters:
session
- The session.sequenceId
- A sequence ID returned by theCameraSession.capture
family of functions.frameNumber
- The last frame number (returned byCaptureResult.getFrameNumber()
orCaptureFailure.getFrameNumber()
) in the capture sequence.
onCaptureSequenceAborted¶
public void onCaptureSequenceAborted(@NonNull CaptureSession session, int sequenceId)
Called when a capture sequence aborts before any CaptureResult
or CaptureFailure
for it have been returned via this listener.
Due to the asynchronous nature of the session device, not all submitted captures
are immediately processed. Pending requests may be cleared out when the session is closed
or gets disconnected. When such an event happens,
onCaptureCompleted
, onCaptureFailed
and
onCaptureSequenceCompleted
will not be called.
The default implementation does nothing.
- Specified by:
onCaptureSequenceAborted
in interfaceCaptureListener
- Parameters:
session
- The session.sequenceId
- A sequence ID returned by theCameraSession.capture
family of functions.