Home | History | Annotate | Download | only in camera
      1 /*
      2  * Copyright (C) 2017 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 #ifndef GUEST_HALS_CAMERA_CAMERACONFIGURATION_H_
     17 #define GUEST_HALS_CAMERA_CAMERACONFIGURATION_H_
     18 
     19 #undef max
     20 #undef min
     21 #include <algorithm>
     22 #include <vector>
     23 
     24 namespace cvd {
     25 
     26 // Camera properties and features.
     27 struct CameraDefinition {
     28   // Camera facing direction.
     29   enum Orientation { kFront, kBack };
     30 
     31   // Camera recognized HAL versions.
     32   enum HalVersion { kHalV1, kHalV2, kHalV3 };
     33 
     34   struct Resolution {
     35     int width;
     36     int height;
     37   };
     38 
     39   Orientation orientation;
     40   HalVersion hal_version;
     41   std::vector<Resolution> resolutions;
     42 };
     43 
     44 class CameraConfiguration {
     45  public:
     46   CameraConfiguration() {}
     47   ~CameraConfiguration() {}
     48 
     49   const std::vector<CameraDefinition>& cameras() const { return cameras_; }
     50 
     51   bool Init();
     52 
     53  private:
     54   std::vector<CameraDefinition> cameras_;
     55 };
     56 
     57 }  // namespace cvd
     58 
     59 #endif  // GUEST_HALS_CAMERA_CAMERACONFIGURATION_H_
     60