1 /* 2 * Copyright 2015 The Chromium OS Authors. All rights reserved. 3 * Use of this source code is governed by a BSD-style license that can be 4 * found in the LICENSE file. 5 */ 6 7 #ifndef COMMON_TYPES_H_ 8 #define COMMON_TYPES_H_ 9 10 #include <string> 11 #include <vector> 12 13 // The types in this file should match Android camera HAL. 14 15 struct DeviceInfo { 16 std::string device_path; 17 std::string usb_vid; // USB vender id 18 std::string usb_pid; // USB product id 19 uint32_t lens_facing; // Direction the camera faces relative to device screen. 20 // Clockwise angle through which the output image needs to be rotated to be 21 // upright on the device screen in its native orientation. 22 int32_t sensor_orientation; 23 uint32_t frames_to_skip_after_streamon; 24 float horizontal_view_angle_16_9; 25 float horizontal_view_angle_4_3; 26 std::vector<float> lens_info_available_focal_lengths; 27 float lens_info_minimum_focus_distance; 28 float lens_info_optimal_focus_distance; 29 float vertical_view_angle_16_9; 30 float vertical_view_angle_4_3; 31 // The camera doesn't support 1280x960 resolution when the maximum resolution 32 // of the camear is larger than 1080p. 33 bool resolution_1280x960_unsupported; 34 // The camera doesn't support 1600x1200 resolution. 35 bool resolution_1600x1200_unsupported; 36 // The camera doesn't support constant frame rate. That means HAL cannot set 37 // V4L2_CID_EXPOSURE_AUTO_PRIORITY to 0 to have constant frame rate in low 38 // light environment. 39 bool constant_framerate_unsupported; 40 uint32_t sensor_info_pixel_array_size_width; 41 uint32_t sensor_info_pixel_array_size_height; 42 }; 43 44 typedef std::vector<DeviceInfo> DeviceInfos; 45 46 struct SupportedFormat { SupportedFormatSupportedFormat47 SupportedFormat() {} SupportedFormatSupportedFormat48 SupportedFormat(uint32_t w, uint32_t h, uint32_t fmt, uint32_t fps) 49 : width(w), height(h), fourcc(fmt) { 50 frame_rates.push_back(fps); 51 } 52 uint32_t width; 53 uint32_t height; 54 uint32_t fourcc; 55 // All the supported frame rates in fps with given width, height, and 56 // pixelformat. This is not sorted. For example, suppose width, height, and 57 // fourcc are 640x480 YUYV. If frameRates are 15.0 and 30.0, the camera 58 // supports outputting 640X480 YUYV in 15fps or 30fps. 59 std::vector<float> frame_rates; 60 }; 61 62 typedef std::vector<SupportedFormat> SupportedFormats; 63 64 // The definition should be match camera_metadata_enum_android_lens_facing_t 65 // in camera_metadata_tags.h. 66 enum lens_facing { 67 FACING_FRONT, 68 FACING_BACK, 69 }; 70 71 #endif 72