public abstract static class SCameraCaptureSession.CaptureCallback extends Object
A callback object for tracking the progress of a SCaptureRequest
submitted to the
camera device.
This callback is invoked when a request triggers a capture to start, and when the capture is complete. In case on an error capturing an image, the error method is triggered instead of the completion method.
SCameraCaptureSession.capture(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.captureBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.setRepeatingRequest(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.setRepeatingBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
Constructor and Description |
---|
CaptureCallback() |
Modifier and Type | Method and Description |
---|---|
void |
onCaptureCompleted(SCameraCaptureSession session,
SCaptureRequest request,
STotalCaptureResult result)
This method is called when an image capture has fully completed and all the
result metadata is available.
|
void |
onCaptureFailed(SCameraCaptureSession session,
SCaptureRequest request,
SCaptureFailure failure)
This method is called instead of
onCaptureCompleted(com.samsung.android.sdk.camera.SCameraCaptureSession, com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.STotalCaptureResult) when the
camera device failed to produce a SCaptureResult for the
request. |
void |
onCaptureProgressed(SCameraCaptureSession session,
SCaptureRequest request,
SCaptureResult partialResult)
This method is called when an image capture makes partial forward progress; some
(but not all) results from an image capture are available.
|
void |
onCaptureSequenceAborted(SCameraCaptureSession session,
int sequenceId)
This method is called independently of the others in CaptureCallback,
when a capture sequence aborts before any
SCaptureResult
or SCaptureFailure for it have been returned via this listener. |
void |
onCaptureSequenceCompleted(SCameraCaptureSession session,
int sequenceId,
long frameNumber)
This method is called independently of the others in CaptureCallback,
when a capture sequence finishes and all
SCaptureResult
or SCaptureFailure for it have been returned via this listener. |
void |
onCaptureStarted(SCameraCaptureSession session,
SCaptureRequest request,
long timestamp,
long frameNumber)
This method is called when the camera device has started capturing
the output image for the request, at the beginning of image exposure, or
when the camera device has started processing an input image for a reprocess
request.
|
public void onCaptureStarted(SCameraCaptureSession session, SCaptureRequest request, long timestamp, long frameNumber)
For a regular capture request, this callback is invoked right as the capture of a frame begins, so it is the most appropriate time for playing a shutter sound, or triggering UI indicators of capture.
The request that is being used for this capture is provided, along
with the actual timestamp for the start of exposure. For a reprocess
request, this timestamp will be the input image's start of exposure
which matches the result timestamp field
of the STotalCaptureResult
that was used to
create the reprocess request
.
This timestamp matches the timestamps that will be
included in the result timestamp field
,
and in the buffers sent to each output Surface. These buffer
timestamps are accessible through, for example,
Image.getTimestamp()
or
SurfaceTexture.getTimestamp()
.
The frame number included is equal to the frame number that will be included in
SCaptureResult.getFrameNumber()
.
For the simplest way to play a shutter sound camera shutter or a
video recording start/stop sound, see the
MediaActionSound
class.
The default implementation of this method does nothing.
session
- the session returned by SCameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.samsung.android.sdk.camera.SCameraCaptureSession.StateCallback, android.os.Handler)
request
- the request for the capture that just beguntimestamp
- the timestamp at start of capture for a regular request, or
the timestamp at the input image's start of capture for a
reprocess request, in nanoseconds.frameNumber
- the frame number for this captureMediaActionSound
public void onCaptureProgressed(SCameraCaptureSession session, SCaptureRequest request, SCaptureResult partialResult)
The result provided here will contain some subset of the fields of
a full result. Multiple onCaptureProgressed(com.samsung.android.sdk.camera.SCameraCaptureSession, com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCaptureResult)
calls may happen per
capture; a given result field will only be present in one partial
capture at most. The final onCaptureCompleted(com.samsung.android.sdk.camera.SCameraCaptureSession, com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.STotalCaptureResult)
call will always
contain all the fields (in particular, the union of all the fields of all
the partial results composing the total result).
For each request, some result data might be available earlier than others. The typical delay between each partial result (per request) is a single frame interval. For performance-oriented use-cases, applications should query the metadata they need to make forward progress from the partial results and avoid waiting for the completed result.
Each request will generate at least 1
partial results, and at most
SCameraCharacteristics.REQUEST_PARTIAL_RESULT_COUNT
partial results.
Depending on the request settings, the number of partial results per request will vary, although typically the partial count could be the same as long as the camera device subsystems enabled stay the same.
The default implementation of this method does nothing.
session
- the session returned by SCameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.samsung.android.sdk.camera.SCameraCaptureSession.StateCallback, android.os.Handler)
request
- The request that was given to the SCameraDevicepartialResult
- The partial output metadata from the capture, which
includes a subset of the STotalCaptureResult
fields.SCameraCaptureSession.capture(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.captureBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.setRepeatingRequest(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.setRepeatingBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
public void onCaptureCompleted(SCameraCaptureSession session, SCaptureRequest request, STotalCaptureResult result)
This callback will always fire after the last onCaptureProgressed(com.samsung.android.sdk.camera.SCameraCaptureSession, com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCaptureResult)
;
in other words, no more partial results will be delivered once the completed result
is available.
For performance-intensive use-cases where latency is a factor, consider
using onCaptureProgressed(com.samsung.android.sdk.camera.SCameraCaptureSession, com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCaptureResult)
instead.
The default implementation of this method does nothing.
session
- the session returned by SCameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.samsung.android.sdk.camera.SCameraCaptureSession.StateCallback, android.os.Handler)
request
- The request that was given to the SCameraDeviceresult
- The total output metadata from the capture, including the
final capture parameters and the state of the camera system during
capture.SCameraCaptureSession.capture(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.captureBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.setRepeatingRequest(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.setRepeatingBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
public void onCaptureFailed(SCameraCaptureSession session, SCaptureRequest request, SCaptureFailure failure)
onCaptureCompleted(com.samsung.android.sdk.camera.SCameraCaptureSession, com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.STotalCaptureResult)
when the
camera device failed to produce a SCaptureResult
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 of this method does nothing.
session
- The session returned by SCameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.samsung.android.sdk.camera.SCameraCaptureSession.StateCallback, android.os.Handler)
request
- The request that was given to the SCameraDevicefailure
- The output failure from the capture, including the failure reason
and the frame number.SCameraCaptureSession.capture(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.captureBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.setRepeatingRequest(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
,
SCameraCaptureSession.setRepeatingBurst(java.util.List<com.samsung.android.sdk.camera.SCaptureRequest>, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
public void onCaptureSequenceCompleted(SCameraCaptureSession session, int sequenceId, long frameNumber)
SCaptureResult
or SCaptureFailure
for it have been returned via this listener.
In total, there will be at least one result/failure returned by this listener
before this callback is invoked. If the capture sequence is aborted before any
requests have been processed, onCaptureSequenceAborted(com.samsung.android.sdk.camera.SCameraCaptureSession, int)
is invoked instead.
The default implementation does nothing.
session
- The session returned by SCameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.samsung.android.sdk.camera.SCameraCaptureSession.StateCallback, android.os.Handler)
sequenceId
- A sequence ID returned by the SCameraCaptureSession.capture(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
family of functions.frameNumber
- The last frame number (returned by SCaptureResult.getFrameNumber()
or SCaptureFailure.getFrameNumber()
) in the capture sequence.SCaptureResult.getFrameNumber()
,
SCaptureFailure.getFrameNumber()
,
SCaptureResult.getSequenceId()
,
SCaptureFailure.getSequenceId()
,
onCaptureSequenceAborted(com.samsung.android.sdk.camera.SCameraCaptureSession, int)
public void onCaptureSequenceAborted(SCameraCaptureSession session, int sequenceId)
SCaptureResult
or SCaptureFailure
for it have been returned via this listener.
Due to the asynchronous nature of the camera device, not all submitted captures
are immediately processed. It is possible to clear out the pending requests
by a variety of operations such as SCameraCaptureSession.stopRepeating()
or
SCameraCaptureSession.abortCaptures()
. When such an event happens,
onCaptureSequenceCompleted(com.samsung.android.sdk.camera.SCameraCaptureSession, int, long)
will not be called.
The default implementation does nothing.
session
- The session returned by SCameraDevice.createCaptureSession(java.util.List<android.view.Surface>, com.samsung.android.sdk.camera.SCameraCaptureSession.StateCallback, android.os.Handler)
sequenceId
- A sequence ID returned by the SCameraCaptureSession.capture(com.samsung.android.sdk.camera.SCaptureRequest, com.samsung.android.sdk.camera.SCameraCaptureSession.CaptureCallback, android.os.Handler)
family of functions.SCaptureResult.getFrameNumber()
,
SCaptureFailure.getFrameNumber()
,
SCaptureResult.getSequenceId()
,
SCaptureFailure.getSequenceId()
,
onCaptureSequenceCompleted(com.samsung.android.sdk.camera.SCameraCaptureSession, int, long)
Copyright © Samsung Electronics, Co., Ltd. All rights reserved.