Home | History | Annotate | Download | only in camera2
      1 /*
      2  * Copyright (C) 2015 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 #ifndef ANDROID_HARDWARE_CAMERA2_OUTPUTCONFIGURATION_H
     18 #define ANDROID_HARDWARE_CAMERA2_OUTPUTCONFIGURATION_H
     19 
     20 #include <utils/RefBase.h>
     21 #include <gui/IGraphicBufferProducer.h>
     22 
     23 namespace android {
     24 
     25 class Surface;
     26 
     27 class OutputConfiguration : public virtual RefBase {
     28 public:
     29 
     30     static const int INVALID_ROTATION;
     31     sp<IGraphicBufferProducer> getGraphicBufferProducer() const;
     32     int                        getRotation() const;
     33 
     34     /**
     35      * Keep impl up-to-date with OutputConfiguration.java in frameworks/base
     36      */
     37     status_t                   writeToParcel(Parcel& parcel) const;
     38     // getGraphicBufferProducer will be NULL if error occurred
     39     // getRotation will be INVALID_ROTATION if error occurred
     40     OutputConfiguration(const Parcel& parcel);
     41 
     42     OutputConfiguration(sp<IGraphicBufferProducer>& gbp, int rotation);
     43 
     44 private:
     45     sp<IGraphicBufferProducer> mGbp;
     46     int                        mRotation;
     47 
     48     // helper function
     49     static String16 readMaybeEmptyString16(const Parcel& parcel);
     50 };
     51 }; // namespace android
     52 
     53 #endif
     54