1 /*
2  * Copyright 2016 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 HAL_USB_COMMON_TYPES_H_
8 #define HAL_USB_COMMON_TYPES_H_
9 
10 #include <string>
11 #include <vector>
12 
13 namespace arc {
14 
15 struct DeviceInfo {
16   // ex: /dev/video0
17   std::string device_path;
18   // USB vender id
19   std::string usb_vid;
20   // USB product id
21   std::string usb_pid;
22   // Some cameras need to wait several frames to output correct images.
23   uint32_t frames_to_skip_after_streamon;
24 
25   // Member definitions can be found in https://developer.android.com/
26   // reference/android/hardware/camera2/CameraCharacteristics.html
27   uint32_t lens_facing;
28   int32_t sensor_orientation;
29   float horizontal_view_angle_16_9;
30   float horizontal_view_angle_4_3;
31   std::vector<float> lens_info_available_focal_lengths;
32   float lens_info_minimum_focus_distance;
33   float lens_info_optimal_focus_distance;
34   float vertical_view_angle_16_9;
35   float vertical_view_angle_4_3;
36 };
37 
38 typedef std::vector<DeviceInfo> DeviceInfos;
39 
40 struct SupportedFormat {
41   uint32_t width;
42   uint32_t height;
43   uint32_t fourcc;
44   // All the supported frame rates in fps with given width, height, and
45   // pixelformat. This is not sorted. For example, suppose width, height, and
46   // fourcc are 640x480 YUYV. If frameRates are 15.0 and 30.0, the camera
47   // supports outputting 640X480 YUYV in 15fps or 30fps.
48   std::vector<float> frameRates;
49 };
50 
51 typedef std::vector<SupportedFormat> SupportedFormats;
52 
53 }  // namespace arc
54 
55 #endif  // HAL_USB_COMMON_TYPES_H_
56