Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(245)

Side by Side Diff: media/capture/video/android/tango_api.h

Issue 2983473002: Android Tango depth camera capture support.
Patch Set: third party replaced by dlsym Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef MEDIA_CAPTURE_VIDEO_ANDROID_TANGO_API_H_
6 #define MEDIA_CAPTURE_VIDEO_ANDROID_TANGO_API_H_
7
8 #include <stdint.h>
9
10 #include <memory>
11
12 namespace media {
13
14 // A helper class for dynamic loading of symbols from libtango_client_api.so and
15 // invoking them. We load only a set of symbols required for capture.
16 // libtango_client_api.so is present only on Android Tango devices.
17 class TangoApi {
18 public:
19 using TangoConfig = void*;
20 enum TangoCameraId {
21 TANGO_CAMERA_COLOR = 0, ///< Back-facing color camera
22 TANGO_CAMERA_RGBIR, ///< Back-facing camera producing IR-sensitive images
23 TANGO_CAMERA_FISHEYE, ///< Back-facing fisheye wide-angle camera
24 TANGO_CAMERA_DEPTH, ///< Depth camera
25 TANGO_MAX_CAMERA_ID ///< Maximum camera allowable
26 };
27
28 enum TangoConfigType {
29 TANGO_CONFIG_DEFAULT = 0, ///< Default, motion tracking only.
30 TANGO_CONFIG_CURRENT, ///< Current
31 TANGO_CONFIG_MOTION_TRACKING, ///< Motion tracking
32 TANGO_CONFIG_AREA_LEARNING, ///< Area learning
33 TANGO_CONFIG_RUNTIME, ///< Runtime settable configuration
34 TANGO_MAX_CONFIG_TYPE ///< Maximum number allowable
35 };
36
37 enum TangoErrorType {
38 TANGO_METHOD_NOT_FOUND = -8,
39 TANGO_NO_DATASET_PERMISSION = -7,
40 TANGO_NO_IMPORT_EXPORT_PERMISSION = -6,
41 TANGO_NO_CAMERA_PERMISSION = -5,
42 TANGO_NO_ADF_PERMISSION = -4,
43 TANGO_NO_MOTION_TRACKING_PERMISSION = -3,
44 TANGO_INVALID = -2,
45 TANGO_ERROR = -1,
46 TANGO_SUCCESS = 0,
47 };
48
49 struct TangoCameraIntrinsics {
50 TangoCameraId camera_id;
51 enum {
52 UNUSED,
53 } calibration_type;
54 uint32_t width;
55 uint32_t height;
56 double fx;
57 double fy;
58 double cx;
59 double cy;
60 double distortion[5];
61 };
62
63 struct TangoPointCloud {
64 uint32_t version;
65 double timestamp;
66 uint32_t num_points;
67 float (*points)[4];
68 };
69
70 // Returns nullptr if there is no library.
71 static std::unique_ptr<TangoApi> loadAndCreate();
72
73 TangoErrorType TangoService_setBinder(void* jni_env, void* iBinder);
74 TangoConfig TangoService_getConfig(TangoConfigType config_type);
75 TangoErrorType TangoService_connect(void* context, TangoConfig config);
76 void TangoService_disconnect();
77 TangoErrorType TangoService_connectOnPointCloudAvailable(
78 void (*TangoService_onPointCloudAvailable)(void* context,
79 const TangoPointCloud* cloud),
80 ...);
81 TangoErrorType TangoService_getCameraIntrinsics(
82 TangoCameraId camera_id,
83 TangoCameraIntrinsics* intrinsics);
84 TangoErrorType TangoConfig_setBool(TangoConfig config,
85 const char* key,
86 bool value);
87 TangoErrorType TangoConfig_setInt32(TangoConfig config,
88 const char* key,
89 int32_t value);
90
91 private:
92 friend class VideoCaptureDeviceTangoAndroidTest;
93 explicit TangoApi(void* lib_client_api);
94 void* lib_ = nullptr;
95 };
96
97 } // namespace media
98
99 #endif /* MEDIA_CAPTURE_VIDEO_ANDROID_TANGO_API_H_ */
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698