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

Unified Diff: media/capture/video/android/tango_client_api_glue.h

Issue 2983473002: Android Tango depth camera capture support.
Patch Set: rename tango_api files to tango_client_api_glue Created 3 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: media/capture/video/android/tango_client_api_glue.h
diff --git a/media/capture/video/android/tango_client_api_glue.h b/media/capture/video/android/tango_client_api_glue.h
new file mode 100644
index 0000000000000000000000000000000000000000..f607732d82bba765a57b99aff3f958f16bc87c9b
--- /dev/null
+++ b/media/capture/video/android/tango_client_api_glue.h
@@ -0,0 +1,95 @@
+// Copyright 2017 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#ifndef MEDIA_CAPTURE_VIDEO_ANDROID_TANGO_CLIENT_API_GLUE_H_
+#define MEDIA_CAPTURE_VIDEO_ANDROID_TANGO_CLIENT_API_GLUE_H_
+
+#include <stdint.h>
+
+#include <memory>
+
+namespace media {
+
+// A helper class for dynamic loading of symbols from libtango_client_api.so and
+// invoking them. We load only a set of symbols required for capture.
+// libtango_client_api.so is present only on Android Tango devices.
+class TangoClientApiGlue {
+ public:
+ using TangoConfig = void*;
+ enum TangoCameraId {
+ TANGO_CAMERA_COLOR = 0, ///< Back-facing color camera
+ TANGO_CAMERA_RGBIR, ///< Back-facing camera producing IR-sensitive images
+ TANGO_CAMERA_FISHEYE, ///< Back-facing fisheye wide-angle camera
+ TANGO_CAMERA_DEPTH, ///< Depth camera
+ TANGO_MAX_CAMERA_ID ///< Maximum camera allowable
+ };
+
+ enum TangoConfigType {
+ TANGO_CONFIG_DEFAULT = 0, ///< Default, motion tracking only.
+ TANGO_CONFIG_CURRENT, ///< Current
+ TANGO_CONFIG_MOTION_TRACKING, ///< Motion tracking
+ TANGO_CONFIG_AREA_LEARNING, ///< Area learning
+ TANGO_CONFIG_RUNTIME, ///< Runtime settable configuration
+ TANGO_MAX_CONFIG_TYPE ///< Maximum number allowable
+ };
+
+ enum TangoErrorType {
+ TANGO_METHOD_NOT_FOUND = -8,
+ TANGO_NO_DATASET_PERMISSION = -7,
+ TANGO_NO_IMPORT_EXPORT_PERMISSION = -6,
+ TANGO_NO_CAMERA_PERMISSION = -5,
+ TANGO_NO_ADF_PERMISSION = -4,
+ TANGO_NO_MOTION_TRACKING_PERMISSION = -3,
+ TANGO_INVALID = -2,
+ TANGO_ERROR = -1,
+ TANGO_SUCCESS = 0,
+ };
+
+ struct TangoCameraIntrinsics {
+ TangoCameraId camera_id;
+ enum {
+ UNUSED,
+ } calibration_type;
+ uint32_t width;
+ uint32_t height;
+ double fx;
+ double fy;
+ double cx;
+ double cy;
+ double distortion[5];
+ };
+
+ struct TangoPointCloud {
+ uint32_t version;
+ double timestamp;
+ uint32_t num_points;
+ float (*points)[4];
+ };
+
+ static TangoErrorType TangoService_setBinder(void* jni_env, void* iBinder);
+ static TangoConfig TangoService_getConfig(TangoConfigType config_type);
+ static TangoErrorType TangoService_connect(void* context, TangoConfig config);
+ static void TangoService_disconnect();
+ static TangoErrorType TangoService_connectOnPointCloudAvailable(
+ void (*TangoService_onPointCloudAvailable)(void* context,
+ const TangoPointCloud* cloud),
+ ...);
+ static TangoErrorType TangoService_getCameraIntrinsics(
+ TangoCameraId camera_id,
+ TangoCameraIntrinsics* intrinsics);
+ static TangoErrorType TangoConfig_setBool(TangoConfig config,
+ const char* key,
+ bool value);
+ static TangoErrorType TangoConfig_setInt32(TangoConfig config,
+ const char* key,
+ int32_t value);
+
+ private:
+ static void* handle();
+ friend class VideoCaptureDeviceTangoAndroidTest;
+};
+
+} // namespace media
+
+#endif /* MEDIA_CAPTURE_VIDEO_ANDROID_TANGO_CLIENT_API_GLUE_H_ */

Powered by Google App Engine
This is Rietveld 408576698