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 // When the process has changed to state RUNNING, onMediaPerception events s hould | |
tbarzic
2017/05/11 19:20:03
nit: fix line overflows
actually, I'd just remove
Luke Sorenson
2017/05/11 23:28:17
Done.
Although again, this is just what I copied
tbarzic
2017/05/11 23:42:50
I'm pretty sure you did not :P
You copy-pasted you
Luke Sorenson
2017/05/11 23:50:26
You're right :o
| |
25 // start coming through, so we have that signal. We want to add an onStateCh anged | |
26 // event going forward, but decided it was not expressly necessary for the f irst | |
27 // implementation. | |
28 STARTED, | |
29 | |
30 // Analytics process running and media processing pipeling injesting image | |
31 // frames. At this point, MediaPerception signals should be coming over | |
32 // D-Bus. | |
33 RUNNING, | |
34 | |
35 // Analytics process is running and ready to be set to state RUNNING. | |
36 // The D-Bus communications are enabled but the media processing pipeline | |
37 // is suspended. | |
38 SUSPENDED | |
39 }; | |
40 | |
41 // The system and configuration state of the analytics process and v4lplugin. | |
42 dictionary State { | |
43 Status status; | |
44 | |
45 // Optional $(ref:setState) parameter. Specifies the video device the media | |
46 // analytics process should open while the media processing pipeline is | |
47 // starting. To set this parameter, status has to be RUNNING. | |
48 DOMString? deviceContext; | |
49 }; | |
50 | |
51 dictionary Point { | |
52 // The horizontal distance from the top left corner of the image. | |
53 double? x; | |
54 | |
55 // The vertical distance from the top left corner of the image. | |
56 double? y; | |
57 }; | |
58 | |
59 dictionary BoundingBox { | |
60 // Specifies whether the points are normalized to the size of the image. | |
61 boolean? normalized; | |
62 | |
63 // The two points that define the corners of a bounding box. | |
64 Point? topLeft; | |
65 Point? bottomRight; | |
66 }; | |
67 | |
68 enum EntityType { | |
69 UNSPECIFIED, | |
70 FACE, | |
71 PERSON | |
72 }; | |
73 | |
74 dictionary Entity { | |
75 // A unique id associated with the detected entity, which can be used to | |
76 // track the entity over time. | |
77 long? id; | |
78 | |
79 EntityType? type; | |
80 | |
81 // Minimum box which captures entire detected entity. | |
82 BoundingBox? boundingBox; | |
83 | |
84 // A value for the quality of this detection. | |
85 double? confidence; | |
86 }; | |
87 | |
88 // The set of computer vision metadata for an image frame. | |
89 dictionary FramePerception { | |
90 long? frameId; | |
91 | |
92 long? frameWidthInPx; | |
93 long? frameHeightInPx; | |
94 | |
95 // The timestamp associated with the frame (when its recieved by the | |
96 // analytics process). | |
97 double? timestamp; | |
98 | |
99 // The list of entities detected in this frame. | |
100 Entity[]? entities; | |
101 }; | |
102 | |
103 dictionary MediaPerception { | |
104 // The time the media perception data was emitted by the media processing | |
105 // pipeline. This value will be greater than the timestamp stored within | |
106 // the FramePerception dictionary and the difference between them can be | |
107 // viewed as the processing time for a single frame. | |
108 double? timestamp; | |
109 | |
110 // An array of framePerceptions. | |
111 FramePerception[]? framePerceptions; | |
112 }; | |
113 | |
114 enum ImageFormat { | |
115 UNSPECIFIED, | |
116 RGB, | |
117 PNG, | |
118 JPEG | |
119 }; | |
120 | |
121 dictionary ImageFrame { | |
122 long? width; | |
123 long? height; | |
124 | |
125 ImageFormat? format; | |
126 | |
127 long? dataLength; | |
128 | |
129 // The bytes of the image frame. | |
130 ArrayBuffer? frame; | |
131 }; | |
132 | |
133 dictionary PerceptionSample { | |
134 // The video analytics FramePerception for the associated image frame | |
135 // data. | |
136 FramePerception? framePerception; | |
137 | |
138 // The image frame data for the associated FramePerception object. | |
139 ImageFrame? imageFrame; | |
140 }; | |
141 | |
142 dictionary Diagnostics { | |
143 // A buffer of image frames and the associated video analytics information | |
144 // that can be used to diagnose a malfunction. | |
145 PerceptionSample[]? perceptionSamples; | |
146 }; | |
147 | |
148 callback StateCallback = void(State state); | |
149 | |
150 callback DiagnosticsCallback = void(Diagnostics diagnostics); | |
151 | |
152 interface Functions { | |
153 // Get the status of the media perception process. | |
154 // |callback| : The current state of the system. | |
155 static void getState(StateCallback callback); | |
156 | |
157 // Set the desired state of the system. | |
158 // |state| : A dictionary with the desired new state. Settable states are | |
159 // RUNNING and SUSPENDED. | |
160 // |callback| : The State of the system after setting it. Can be used to | |
161 // verify the state was set as desired. | |
162 static void setState(State state, StateCallback callback); | |
163 | |
164 // Get a diagnostics buffer out of the video analytics process. | |
165 // |callback| : Returns a Diagnostics dictionary object. | |
166 static void getDiagnostics(DiagnosticsCallback callback); | |
167 }; | |
168 | |
169 interface Events { | |
170 // Fired when media perception information is received from the media | |
171 // analytics process. | |
172 // |mediaPerception| : The dictionary which contains a dump of everything | |
173 // the analytics process has detected or determined from the incoming media | |
174 // streams. | |
175 static void onMediaPerception(MediaPerception mediaPerception); | |
176 }; | |
177 }; | |
OLD | NEW |