OLD | NEW |
---|---|
(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 // Private API for receiving real-time media perception information. | |
6 [platforms=("chromeos")] | |
7 namespace mediaPerceptionPrivate { | |
8 enum Status { | |
9 // An error occurred. | |
10 ERROR, | |
11 | |
12 // Attempt to reach media analytics process failed. | |
13 TIMEOUT, | |
14 | |
15 // Media analytics process waiting to be launched. | |
16 UNINITIALIZED, | |
17 | |
18 // Analytics process running and media processing pipeline started, | |
19 // but it is not yet receiving image frames. This is a transitional state | |
20 // between SUSPENDED and RUNNING for the time it takes to warm up the | |
21 // media processing pipeline, which can take anywhere from a few seconds | |
22 // to a minute. | |
23 // Note: STARTED is the initial reply to SetState RUNNING. | |
24 STARTED, | |
25 | |
26 // Analytics process running and media processing pipeling injesting image | |
27 // frames. At this point, MediaPerception signals should be coming over | |
28 // D-Bus. | |
29 RUNNING, | |
30 | |
31 // Analytics process is running and ready to be set to state RUNNING. | |
32 // The D-Bus communications are enabled but the media processing pipeline | |
33 // is suspended. | |
34 SUSPENDED | |
35 }; | |
36 | |
37 // The system and configuration state of the analytics process and v4lplugin. | |
38 dictionary State { | |
39 Status status; | |
tbarzic
2017/05/10 23:45:53
add a new line between different properties (here
Luke Sorenson
2017/05/11 16:18:22
Done.
| |
40 // Optional $(ref:setState) parameter. Specifies the video device the media | |
41 // analytics process should open. | |
42 // Can be set only when |status| of the analytics process is currently | |
43 // set to <code>UNINITIALIZED</code> or <code>SUSPENDED</code> and the | |
44 // desired status is <code>RUNNING</code>. | |
45 DOMString? deviceContext; | |
46 }; | |
47 | |
48 dictionary Point { | |
49 // The horizontal distance from the top left corner of the image. | |
50 double? x; | |
51 // The vertical distance from the top left corner of the image. | |
52 double? y; | |
53 }; | |
54 | |
55 dictionary BoundingBox { | |
56 // Specifies whether the points are normalized to the size of the image. | |
57 boolean? normalized; | |
58 // The two points that define the corners of a bounding box. | |
59 Point? topLeft; | |
60 Point? bottomRight; | |
61 }; | |
62 | |
63 enum EntityType { | |
64 UNSPECIFIED, | |
65 FACE, | |
66 PERSON | |
67 }; | |
68 | |
69 dictionary Entity { | |
70 // A unique id associated with the detected entity, which can be used to | |
71 // track the entity over time. | |
72 long? id; | |
73 | |
74 EntityType? type; | |
75 | |
76 // Minimum box which captures entire detected entity. | |
77 BoundingBox? boundingBox; | |
78 | |
79 // A value for the quality of this detection. | |
80 double? confidence; | |
81 }; | |
82 | |
83 // The set of computer vision metadata for an image frame. | |
84 dictionary FramePerception { | |
85 long? frameId; | |
86 | |
87 long? frameWidthInPx; | |
88 long? frameHeightInPx; | |
89 // The timestamp associated with the frame (when its recieved by the | |
90 // analytics process). | |
91 double? timestamp; | |
92 | |
93 // The list of entities detected in this frame. | |
94 Entity[]? entities; | |
95 }; | |
96 | |
97 dictionary MediaPerception { | |
98 // The time the media perception data was emitted by the media processing | |
99 // pipeline. This value will be greater than the timestamp stored within | |
100 // the FramePerception dictionary and the difference between them can be | |
101 // viewed as the processing time for a single frame. | |
102 double? timestamp; | |
103 // An array of framePerceptions, often just one. | |
104 FramePerception[]? framePerceptions; | |
105 }; | |
106 | |
107 // TODO(lasoren): Change this interface based on the compressed images coming | |
tbarzic
2017/05/10 23:45:53
I'd remove TODOs from here.
Luke Sorenson
2017/05/11 16:18:22
This comment is on an older patch set. TODO no lon
| |
108 // from the media analytics process. | |
109 dictionary ImageFrame { | |
110 long? width; | |
111 long? height; | |
112 | |
113 // TODO(lasoren): Add compression format marker. | |
114 // The bytes of the image frame. | |
115 ArrayBuffer? frame; | |
116 }; | |
117 | |
118 dictionary PerceptionSample { | |
119 // The video analytics FramePerception for the associated image frame | |
120 // data. | |
121 FramePerception? framePerception; | |
122 // The image frame data for the associated FramePerception object. | |
123 ImageFrame? imageFrame; | |
124 }; | |
125 | |
126 dictionary Diagnostics { | |
127 // A buffer of image frames and the associated video analytics information | |
128 // that can be used to diagnose a malfunction. | |
129 PerceptionSample[]? perceptionSamples; | |
130 }; | |
131 | |
132 callback StateCallback = void(State state); | |
133 | |
134 callback DiagnosticsCallback = void(Diagnostics diagnostics); | |
135 | |
136 interface Functions { | |
137 // Get the status of the media perception process. | |
138 // |callback| : The current State of the system. | |
139 static void getState(StateCallback callback); | |
140 | |
141 // Set the desired state of the system. | |
142 // |state| : A dictionary with the desired new state. Settable states are | |
143 // RUNNING and SUSPENDED. | |
144 // |callback| : The State of the system after setting it. Can be used to | |
145 // verify the state was set as desired. | |
146 static void setState(State state, StateCallback callback); | |
147 | |
148 // Get a diagnostics buffer out of the video analytics process. | |
149 // |callback| : Returns a Diagnostics dictionary object. | |
150 static void getDiagnostics(DiagnosticsCallback callback); | |
151 }; | |
152 | |
153 interface Events { | |
154 // Fired when media perception information is received from the media | |
155 // analytics process. | |
156 // |mediaPerception| : The dictionary which contains a dump of everything | |
157 // the analytics process has detected or determined from the incoming media | |
158 // streams. | |
159 static void onMediaPerception(MediaPerception mediaPerception); | |
160 }; | |
161 }; | |
OLD | NEW |