FileDocCategorySizeDatePackage
BlockingCaptureCallback.javaAPI DocAndroid 5.1 API5775Thu Mar 12 22:22:48 GMT 2015com.android.ex.camera2.blocking

BlockingCaptureCallback

public class BlockingCaptureCallback extends CameraCaptureSession.CaptureCallback
A camera capture listener that implements blocking operations on state changes for a particular capture request.

Provides a waiter that can be used to block until the next unobserved state of the requested type arrives.

Pass-through all StateListener changes to the proxy.

see
#getStateWaiter

Fields Summary
public static final int
CAPTURE_STARTED
{@link #onCaptureStarted} has been called.
public static final int
CAPTURE_PROGRESSED
{@link #onCaptureProgressed} has been called.
public static final int
CAPTURE_COMPLETED
{@link #onCaptureCompleted} has been called.
public static final int
CAPTURE_FAILED
{@link #onCaptureFailed} has been called.
public static final int
CAPTURE_SEQUENCE_COMPLETED
{@link #onCaptureSequenceCompleted} has been called.
public static final int
CAPTURE_SEQUENCE_ABORTED
{@link #onCaptureSequenceAborted} has been called.
private static final String[]
sStateNames
private static final String
TAG
private static final boolean
VERBOSE
private final CameraCaptureSession.CaptureCallback
mProxy
private final com.android.ex.camera2.utils.StateWaiter
mStateWaiter
private final com.android.ex.camera2.utils.StateChangeListener
mStateChangeListener
Constructors Summary
public BlockingCaptureCallback()
Create a blocking capture listener without forwarding the capture listener invocations to another capture listener.


                        
      
        mProxy = null;
    
public BlockingCaptureCallback(CameraCaptureSession.CaptureCallback listener)
Create a blocking capture listener; forward original listener invocations into {@code listener}.

param
listener a non-{@code null} listener to forward invocations into
throws
NullPointerException if {@code listener} was {@code null}

        if (listener == null) {
            throw new NullPointerException("listener must not be null");
        }
        mProxy = listener;
    
Methods Summary
public com.android.ex.camera2.utils.StateWaitergetStateWaiter()
Acquire the state waiter; can be used to block until a set of state transitions have been reached.

Only one thread should wait at a time.

        return mStateWaiter;
    
public voidonCaptureCompleted(android.hardware.camera2.CameraCaptureSession session, android.hardware.camera2.CaptureRequest request, android.hardware.camera2.TotalCaptureResult result)

        if (mProxy != null) mProxy.onCaptureCompleted(session, request, result);
        mStateChangeListener.onStateChanged(CAPTURE_COMPLETED);
    
public voidonCaptureFailed(android.hardware.camera2.CameraCaptureSession session, android.hardware.camera2.CaptureRequest request, android.hardware.camera2.CaptureFailure failure)

        if (mProxy != null) mProxy.onCaptureFailed(session, request, failure);
        mStateChangeListener.onStateChanged(CAPTURE_FAILED);
    
public voidonCaptureProgressed(android.hardware.camera2.CameraCaptureSession session, android.hardware.camera2.CaptureRequest request, android.hardware.camera2.CaptureResult partialResult)

        if (mProxy != null) mProxy.onCaptureProgressed(session, request, partialResult);
        mStateChangeListener.onStateChanged(CAPTURE_PROGRESSED);
    
public voidonCaptureSequenceAborted(android.hardware.camera2.CameraCaptureSession session, int sequenceId)

        if (mProxy != null) mProxy.onCaptureSequenceAborted(session, sequenceId);
        mStateChangeListener.onStateChanged(CAPTURE_SEQUENCE_ABORTED);
    
public voidonCaptureSequenceCompleted(android.hardware.camera2.CameraCaptureSession session, int sequenceId, long frameNumber)

        if (mProxy != null) mProxy.onCaptureSequenceCompleted(session, sequenceId, frameNumber);
        mStateChangeListener.onStateChanged(CAPTURE_SEQUENCE_COMPLETED);
    
public voidonCaptureStarted(android.hardware.camera2.CameraCaptureSession session, android.hardware.camera2.CaptureRequest request, long timestamp, long frameNumber)

        if (mProxy != null) mProxy.onCaptureStarted(session, request, timestamp, frameNumber);
        mStateChangeListener.onStateChanged(CAPTURE_STARTED);