Chromium Code Reviews| 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. | |
|
tbarzic
2017/05/10 23:45:53
How would the app know the state's changed to RUNN
Luke Sorenson
2017/05/11 16:18:22
When the process has changed to state RUNNING, onM
Luke Sorenson
2017/05/11 18:35:06
Done.
| |
| 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; | |
| 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 | |
|
tbarzic
2017/05/10 23:45:53
|status| has to be RUNNING (as it refers to the st
Luke Sorenson
2017/05/11 16:18:22
Done.
Although I copied and pasted this comment e
tbarzic
2017/05/11 17:16:21
s/when the desired status is running/while it's st
Luke Sorenson
2017/05/11 18:35:06
Done.
| |
| 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 enum ImageFormat { | |
| 108 UNSPECIFIED, | |
| 109 RGB, | |
| 110 PNG, | |
| 111 JPEG | |
| 112 }; | |
| 113 | |
| 114 dictionary ImageFrame { | |
| 115 long? width; | |
| 116 long? height; | |
| 117 ImageFormat? format; | |
| 118 long? dataLength; | |
| 119 // The bytes of the image frame. | |
| 120 ArrayBuffer? frame; | |
| 121 }; | |
| 122 | |
| 123 dictionary PerceptionSample { | |
| 124 // The video analytics FramePerception for the associated image frame | |
| 125 // data. | |
| 126 FramePerception? framePerception; | |
| 127 // The image frame data for the associated FramePerception object. | |
| 128 ImageFrame? imageFrame; | |
| 129 }; | |
| 130 | |
| 131 dictionary Diagnostics { | |
| 132 // A buffer of image frames and the associated video analytics information | |
| 133 // that can be used to diagnose a malfunction. | |
| 134 PerceptionSample[]? perceptionSamples; | |
| 135 }; | |
| 136 | |
| 137 callback StateCallback = void(State state); | |
| 138 | |
| 139 callback DiagnosticsCallback = void(Diagnostics diagnostics); | |
| 140 | |
| 141 interface Functions { | |
| 142 // Get the status of the media perception process. | |
| 143 // |callback| : The current State of the system. | |
| 144 static void getState(StateCallback callback); | |
| 145 | |
| 146 // Set the desired state of the system. | |
| 147 // |state| : A dictionary with the desired new state. Settable states are | |
| 148 // RUNNING and SUSPENDED. | |
| 149 // |callback| : The State of the system after setting it. Can be used to | |
| 150 // verify the state was set as desired. | |
| 151 static void setState(State state, StateCallback callback); | |
| 152 | |
| 153 // Get a diagnostics buffer out of the video analytics process. | |
| 154 // |callback| : Returns a Diagnostics dictionary object. | |
| 155 static void getDiagnostics(DiagnosticsCallback callback); | |
| 156 }; | |
| 157 | |
| 158 interface Events { | |
| 159 // Fired when media perception information is received from the media | |
| 160 // analytics process. | |
| 161 // |mediaPerception| : The dictionary which contains a dump of everything | |
| 162 // the analytics process has detected or determined from the incoming media | |
| 163 // streams. | |
| 164 static void onMediaPerception(MediaPerception mediaPerception); | |
| 165 }; | |
| 166 }; | |
| OLD | NEW |