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.graphics.SurfaceTexture;
     20 import android.view.Surface;
     21 
     22 import com.android.camera.app.OrientationManager.DeviceOrientation;
     23 import com.android.camera.one.OneCamera.Facing;
     24 import com.android.camera.session.CaptureSession;
     25 
     26 /**
     27  * Facade for the entire burst acquisition pipeline. Provides a simplified
     28  * interface over the {@link BurstController}.
     29  * <p/>
     30  * The expected usage of BurstFacade can be described by the regular expression
     31  * "<code>initialize (startBurst stopBurst)* release</code>". That is there can
     32  * be multiple calls to
     33  * {@link #startBurst(CaptureSession.CaptureSessionCreator, DeviceOrientation, Facing, int)} and
     34  * {@link #stopBurst()} between {@link #initialize(SurfaceTexture)} and
     35  * {@link #release()} calls.
     36  */
     37 public interface BurstFacade {
     38 
     39     /**
     40      * Starts the burst.
     41      *
     42      * @param captureSessionCreator can create and start empty capture sessions
     43      * @param deviceOrientation the orientation of the device
     44      * @param cameraFacing the camera facing
     45      * @param imageOrientationDegrees the orientation of captured image in
     46      *            degrees
     47      */
     48     public void startBurst(CaptureSession.CaptureSessionCreator captureSessionCreator,
     49             DeviceOrientation deviceOrientation,
     50             Facing cameraFacing,
     51             int imageOrientationDegrees);
     52 
     53     /**
     54      * Stops the burst.
     55      *
     56      * @return Whether a burst was actually stopped. Returns false if no burst
     57      *         was running at the time.
     58      */
     59     public boolean stopBurst();
     60 
     61     /**
     62      * Initialize resources and use the provided {@link SurfaceTexture} for
     63      * streaming low-res preview frames for the burst.
     64      *
     65      * @param surfaceTexture to use for streaming
     66      */
     67     public void initialize(SurfaceTexture surfaceTexture);
     68 
     69     /**
     70      * Release any resources used by the burst.
     71      * <p/>
     72      * {@link #initialize(SurfaceTexture)} should be called in order to start
     73      * capturing bursts again.
     74      */
     75     public void release();
     76 
     77     /**
     78      * Returns the input surface for preview stream used by burst module.
     79      * <p/>
     80      * This is an instance of {@link Surface} that is created for the passed in
     81      * surface texture {@link #initialize(SurfaceTexture)}.
     82      */
     83     public Surface getInputSurface();
     84 
     85     /**
     86      * Sets an instance of {@link BurstTaker}.
     87      * <p/>
     88      * The instance of {@link BurstTaker} is available only when the capture
     89      * session with Camera is complete.
     90      */
     91     public void setBurstTaker(BurstTaker burstTaker);
     92 }
     93