Home | History | Annotate | Download | only in burst
      1 /*
      2  * Copyright (C) 2014 The Android Open Source Project
      3  *
      4  * Licensed under the Apache License, Version 2.0 (the "License");
      5  * you may not use this file except in compliance with the License.
      6  * You may obtain a copy of the License at
      7  *
      8  *      http://www.apache.org/licenses/LICENSE-2.0
      9  *
     10  * Unless required by applicable law or agreed to in writing, software
     11  * distributed under the License is distributed on an "AS IS" BASIS,
     12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     13  * See the License for the specific language governing permissions and
     14  * limitations under the License.
     15  */
     16 
     17 package com.android.camera.burst;
     18 
     19 import android.hardware.camera2.TotalCaptureResult;
     20 
     21 /**
     22  * The eviction strategy of the internal Camera image buffer.
     23  * <p/>
     24  * For a burst the Camera maintains an internal image buffer. This image buffer
     25  * has limited memory and old images need to be evicted for storing new images.
     26  * The eviction handler encapsulates the eviction strategy that the Camera uses
     27  * to evict frames.
     28  */
     29 public interface EvictionHandler {
     30     /**
     31      * Return the timestamp of the image that should be dropped.
     32      * <p/>
     33      * This method is called when the internal image buffer is out of capacity
     34      * and needs to drop an image from the buffer.
     35      * <p/>
     36      * This should return one of the timestamps passed into
     37      * {@link #onFrameInserted(long)}, and which has not yet
     38      * been dropped.
     39      *
     40      * @return the timestamp of the frame to drop.
     41      */
     42     long selectFrameToDrop();
     43 
     44     /**
     45      * Called when the capture result for a frame is available.
     46      *
     47      * @param timestamp the timestamp of the frame, this frame may or may not be
     48      *            present in the image buffer.
     49      * @param captureResult the capture result of the image.
     50      */
     51     void onFrameCaptureResultAvailable(long timestamp,
     52             TotalCaptureResult captureResult);
     53 
     54     /**
     55      * Called when an image is inserted in the image buffer.
     56      *
     57      * @param timestamp the timestamp of the inserted frame in the image buffer.
     58      */
     59     void onFrameInserted(long timestamp);
     60 
     61     /**
     62      * Called when a frame is dropped from the image buffer.
     63      *
     64      * @param timestamp the timestamp of the dropped frame.
     65      */
     66     void onFrameDropped(long timestamp);
     67 }
     68