public class CaptureCollector extends Object
CaptureRequest
as it passes through
the Legacy camera pipeline.Constructor and Description |
---|
CaptureCollector(int maxInFlight,
CameraDeviceState deviceState)
Create a new
CaptureCollector that can modify the given CameraDeviceState . |
Modifier and Type | Method and Description |
---|---|
void |
failAll()
Called to alert the
CaptureCollector all pending captures have failed. |
void |
failNextJpeg()
Called to alert the
CaptureCollector that the next pending jpeg capture has failed. |
void |
failNextPreview()
Called to alert the
CaptureCollector that the next pending preview capture has failed. |
boolean |
hasPendingPreviewCaptures()
Check if there are any pending capture requests that use the Camera1 API preview output.
|
RequestHolder |
jpegCaptured(long timestamp)
Called to alert the
CaptureCollector that the jpeg capture has begun. |
Pair<RequestHolder,Long> |
jpegProduced()
Called to alert the
CaptureCollector that the jpeg capture has completed. |
Pair<RequestHolder,Long> |
previewCaptured(long timestamp)
Called to alert the
CaptureCollector that the preview capture has begun. |
RequestHolder |
previewProduced()
Called to alert the
CaptureCollector that the preview capture has completed. |
boolean |
queueRequest(RequestHolder holder,
LegacyRequest legacy,
long timeout,
TimeUnit unit)
Queue a new request.
|
boolean |
waitForEmpty(long timeout,
TimeUnit unit)
Wait all queued requests to complete.
|
boolean |
waitForPreviewsEmpty(long timeout,
TimeUnit unit)
Wait all queued requests that use the Camera1 API preview output to complete.
|
boolean |
waitForRequestCompleted(RequestHolder holder,
long timeout,
TimeUnit unit,
MutableLong timestamp)
Wait for the specified request to be completed (all buffers available).
|
public CaptureCollector(int maxInFlight, CameraDeviceState deviceState)
CaptureCollector
that can modify the given CameraDeviceState
.maxInFlight
- max allowed in-flight requests.deviceState
- the CameraDeviceState
to update as requests are processed.public boolean queueRequest(RequestHolder holder, LegacyRequest legacy, long timeout, TimeUnit unit) throws InterruptedException
For requests that use the Camera1 API preview output stream, this will block if there are
already maxInFlight
requests in progress (until at least one prior request has
completed). For requests that use the Camera1 API jpeg callbacks, this will block until
all prior requests have been completed to avoid stopping preview for
Camera.takePicture(android.hardware.Camera.ShutterCallback, android.hardware.Camera.PictureCallback, android.hardware.Camera.PictureCallback)
before prior preview requests have been
completed.
holder
- the RequestHolder
for this request.legacy
- the LegacyRequest
for this request; this will not be mutated.timeout
- a timeout to use for this call.unit
- the units to use for the timeout.false
if this method timed out.InterruptedException
- if this thread is interrupted.public boolean waitForEmpty(long timeout, TimeUnit unit) throws InterruptedException
timeout
- a timeout to use for this call.unit
- the units to use for the timeout.false
if this method timed out.InterruptedException
- if this thread is interrupted.public boolean waitForPreviewsEmpty(long timeout, TimeUnit unit) throws InterruptedException
timeout
- a timeout to use for this call.unit
- the units to use for the timeout.false
if this method timed out.InterruptedException
- if this thread is interrupted.public boolean waitForRequestCompleted(RequestHolder holder, long timeout, TimeUnit unit, MutableLong timestamp) throws InterruptedException
May not wait for the same request more than once, since a successful wait will erase the history of that request.
holder
- the RequestHolder
for this request.timeout
- a timeout to use for this call.unit
- the units to use for the timeout.timestamp
- the timestamp of the request will be written out to here, in nsfalse
if this method timed out.InterruptedException
- if this thread is interrupted.public RequestHolder jpegCaptured(long timestamp)
CaptureCollector
that the jpeg capture has begun.timestamp
- the time of the jpeg capture.RequestHolder
for the request associated with this capture.public Pair<RequestHolder,Long> jpegProduced()
CaptureCollector
that the jpeg capture has completed.RequestHolder
and the timestamp of the capture.public boolean hasPendingPreviewCaptures()
true
if there are pending preview requests.public Pair<RequestHolder,Long> previewCaptured(long timestamp)
CaptureCollector
that the preview capture has begun.timestamp
- the time of the preview capture.RequestHolder
and the timestamp of the capture.public RequestHolder previewProduced()
CaptureCollector
that the preview capture has completed.RequestHolder
for the request associated with this capture.public void failNextPreview()
CaptureCollector
that the next pending preview capture has failed.public void failNextJpeg()
CaptureCollector
that the next pending jpeg capture has failed.public void failAll()
CaptureCollector
all pending captures have failed.