Index: extensions/common/api/media_perception_private.idl |
diff --git a/extensions/common/api/media_perception_private.idl b/extensions/common/api/media_perception_private.idl |
new file mode 100644 |
index 0000000000000000000000000000000000000000..7c0734cfbef8f8a78c35d25972c2d0b4b53e148d |
--- /dev/null |
+++ b/extensions/common/api/media_perception_private.idl |
@@ -0,0 +1,111 @@ |
+// 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. |
+ |
+// Private API for communicating with and receiving real-time media perception |
+// information from an computer vision + machine intelligence binary. |
+[implemented_in = "extensions/browser/api/media_perception_private/media_perception_private_api.h"] |
+ |
+namespace mediaPerceptionPrivate { |
+ enum Status { |
+ UNKNOWN_ERROR, |
+ TIMEOUT, // Unable to reach media analysis process. |
+ INITIALIZED, // Analysis process running but not recieving frames. |
+ RUNNING, // Analysis process running and injesting frames. |
+ SUSPENDED |
+ }; |
+ |
+ // The system and configuration state of the analysis process and v4lplugin. |
+ dictionary State { |
+ Status? status; |
+ }; |
+ |
+ dictionary Point { |
+ // x represents the horizontal distance from the top left corner of the |
+ // image to the point. |
+ double? x; |
+ // y represents the vertical distance from the top left corner of the |
+ // image to the point. |
+ double? y; |
+ }; |
+ |
+ dictionary BoundingBox { |
+ // The two points that define the corners of a bounding box. |
+ Point? topLeft; |
+ Point? bottomRight; |
+ }; |
+ |
+ enum EntityType { |
+ UNSPECIFIED, |
+ FACE, |
+ PERSON |
+ }; |
+ |
+ dictionary Entity { |
+ // A unique id associated with the detected entity, which can be used to track |
+ // the entity over time. |
+ long? entityId; |
+ |
+ EntityType? entityType; |
+ // Marks whether this entity is believed to be currently occluded. Likely |
+ // wasn't detected in this frame but still has a bounding box. |
+ boolean? occluded; |
+ // Marks whether this entity is believed to be outside of frame. Was not |
+ // detected in this frame and does not have a bounding box. |
+ boolean? outside; |
+ |
+ // The estimated depth of the entity in meters. |
+ double? estimatedDepthInMeters; |
+ |
+ // Minimum box which captures entire detected entity. |
+ BoundingBox? boundingBox; |
+ |
+ // A list of entity ids for associated entities. For example, a face entity |
+ // would point to the associated person and vice-versa. |
+ long[]? associatedEntities; |
+ }; |
+ |
+ // The set of computer vision metadata for an image frame. |
+ dictionary FramePerception { |
+ long? frameId; |
+ |
+ long? frameWidthInPx; |
+ long? frameHeightInPx; |
+ // The timestamp associated with the frame (when its recieved by the |
+ // analysis process). |
+ long? timestamp; |
+ |
+ // The list of entities detected in this frame. |
+ Entity[]? entities; |
+ }; |
+ |
+ dictionary MediaPerception { |
+ // The timestamp attached with when this data originated from the analysis |
+ // process. |
+ long? timestamp; |
+ // A single framePerception or possibly array of framePerceptions. |
+ (FramePerception or FramePerception[])? framePerceptions; |
+ }; |
+ |
+ callback StateCallback = void(State state); |
+ |
+ interface Functions { |
+ // Get the status of the media perception process. |
+ // |callback| : The current State of the system. |
+ static void getState(StateCallback callback); |
+ // Set the desired state of the system. |
+ // |state| : A dictionary with the desired new state. |
+ // |callback| : The State of the system after setting it. Verifies that |
+ // the state was set as desired. |
+ static void setState(State state, StateCallback callback); |
+ }; |
+ |
+ interface Events { |
+ // Fired when the analysis process has passed back to Chrome the current |
+ // mediaPerception information. |
+ // |mediaPerception| : The dictionary which contains a dump of everything |
+ // the analysis process has detected or determined from the incoming media |
+ // streams. |
+ static void onMediaPerception(MediaPerception mediaPerception); |
+ }; |
+}; |