OLD | NEW |
1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 /** | 5 /** |
6 * @fileoverview Keeps track of all the existing PlayerInfo and | 6 * @fileoverview Keeps track of all the existing PlayerInfo and |
7 * audio stream objects and is the entry-point for messages from the backend. | 7 * audio stream objects and is the entry-point for messages from the backend. |
8 * | 8 * |
9 * The events captured by Manager (add, remove, update) are relayed | 9 * The events captured by Manager (add, remove, update) are relayed |
10 * to the clientRenderer which it can choose to use to modify the UI. | 10 * to the clientRenderer which it can choose to use to modify the UI. |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 return; | 104 return; |
105 } | 105 } |
106 | 106 |
107 this.players_[id].addProperty(timestamp, key, value); | 107 this.players_[id].addProperty(timestamp, key, value); |
108 this.clientRenderer_.playerUpdated(this.players_, | 108 this.clientRenderer_.playerUpdated(this.players_, |
109 this.players_[id], | 109 this.players_[id], |
110 key, | 110 key, |
111 value); | 111 value); |
112 }, | 112 }, |
113 | 113 |
| 114 parseVideoCaptureFormat_: function(format) { |
| 115 /** |
| 116 * Example: |
| 117 * |
| 118 * format: |
| 119 * "resolution: 1280x720, fps: 30.000000, pixel format: I420" |
| 120 * |
| 121 * formatDict: |
| 122 * {'resolution':'1280x720', 'fps': '30.00'} |
| 123 */ |
| 124 var parts = format.split(', '); |
| 125 var formatDict = {}; |
| 126 for (var i in parts) { |
| 127 var kv = parts[i].split(': '); |
| 128 formatDict[kv[0]] = kv[1]; |
| 129 } |
| 130 |
| 131 // Round down the FPS to 2 decimals. |
| 132 formatDict['fps'] = parseFloat(formatDict['fps']).toFixed(2); |
| 133 |
| 134 // The camera does not actually output I420 so this info is misleading. |
| 135 delete formatDict['pixel format']; |
| 136 |
| 137 return formatDict; |
| 138 }, |
| 139 |
114 updateVideoCaptureCapabilities: function(videoCaptureCapabilities) { | 140 updateVideoCaptureCapabilities: function(videoCaptureCapabilities) { |
| 141 // Parse the video formats to be structured for the table. |
| 142 for (var i in videoCaptureCapabilities) { |
| 143 for (var j in videoCaptureCapabilities[i]['formats']) { |
| 144 videoCaptureCapabilities[i]['formats'][j] = |
| 145 this.parseVideoCaptureFormat_( |
| 146 videoCaptureCapabilities[i]['formats'][j]); |
| 147 } |
| 148 } |
| 149 |
115 // The keys of each device to be shown in order of appearance. | 150 // The keys of each device to be shown in order of appearance. |
116 var videoCaptureDeviceKeys = ['id','name','formats','captureApi']; | 151 var videoCaptureDeviceKeys = ['name','formats','captureApi','id']; |
| 152 |
117 this.clientRenderer_.redrawVideoCaptureCapabilities( | 153 this.clientRenderer_.redrawVideoCaptureCapabilities( |
118 videoCaptureCapabilities, videoCaptureDeviceKeys); | 154 videoCaptureCapabilities, videoCaptureDeviceKeys); |
119 } | 155 } |
120 }; | 156 }; |
121 | 157 |
122 return Manager; | 158 return Manager; |
123 }()); | 159 }()); |
OLD | NEW |