OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include <deque> | 5 #include <deque> |
6 #include <iomanip> | 6 #include <iomanip> |
7 #include <iostream> | 7 #include <iostream> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "examples/media_test/keystroke.h" | 10 #include "examples/media_test/keystroke.h" |
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 | 55 |
56 if (paint_) { | 56 if (paint_) { |
57 std::cout << " duration <none>" << std::endl; | 57 std::cout << " duration <none>" << std::endl; |
58 std::cout << " title <none>" << std::endl; | 58 std::cout << " title <none>" << std::endl; |
59 std::cout << " artist <none>" << std::endl; | 59 std::cout << " artist <none>" << std::endl; |
60 std::cout << " album <none>" << std::endl; | 60 std::cout << " album <none>" << std::endl; |
61 std::cout << " publisher <none>" << std::endl; | 61 std::cout << " publisher <none>" << std::endl; |
62 std::cout << " genre <none>" << std::endl; | 62 std::cout << " genre <none>" << std::endl; |
63 std::cout << " composer <none>" << std::endl << std::endl; | 63 std::cout << " composer <none>" << std::endl << std::endl; |
64 std::cout << std::endl << std::endl << kUp << std::flush; | 64 std::cout << std::endl << std::endl << kUp << std::flush; |
65 } else { | |
66 std::cout << std::endl; | |
67 } | 65 } |
68 | 66 |
69 CreateNewMediaTest(); | 67 CreateNewMediaTest(); |
70 Poll(); | 68 Poll(); |
71 } | 69 } |
72 | 70 |
73 bool ConfigureIncomingConnection( | 71 bool ConfigureIncomingConnection( |
74 mojo::ApplicationConnection* connection) override { | 72 mojo::ApplicationConnection* connection) override { |
75 return true; | 73 return true; |
76 } | 74 } |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // Move the cursor up the terminal so we paint over the old metadata | 127 // Move the cursor up the terminal so we paint over the old metadata |
130 // (7 lines) a blank line and the state line (total of 9 lines). | 128 // (7 lines) a blank line and the state line (total of 9 lines). |
131 std::cout << kHome << kUp << kUp << kUp << kUp << kUp << kUp << kUp << kUp | 129 std::cout << kHome << kUp << kUp << kUp << kUp << kUp << kUp << kUp << kUp |
132 << kUp; | 130 << kUp; |
133 } | 131 } |
134 | 132 |
135 if (!paint_ && metadata_shown_) { | 133 if (!paint_ && metadata_shown_) { |
136 // Do nothing. | 134 // Do nothing. |
137 } else if (metadata) { | 135 } else if (metadata) { |
138 metadata_shown_ = true; | 136 metadata_shown_ = true; |
139 std::cout << " duration " << std::setprecision(1) | 137 std::cout << " duration " << std::fixed << std::setprecision(1) |
140 << double(metadata->duration) / ns_per_second << " seconds" | 138 << double(metadata->duration) / ns_per_second << " seconds" |
141 << clear_line() << std::endl; | 139 << clear_line() << std::endl; |
142 std::cout << " title " | 140 std::cout << " title " |
143 << (metadata->title ? metadata->title : "<none>") | 141 << (metadata->title ? metadata->title : "<none>") |
144 << clear_line() << std::endl; | 142 << clear_line() << std::endl; |
145 std::cout << " artist " | 143 std::cout << " artist " |
146 << (metadata->artist ? metadata->artist : "<none>") | 144 << (metadata->artist ? metadata->artist : "<none>") |
147 << clear_line() << std::endl; | 145 << clear_line() << std::endl; |
148 std::cout << " album " | 146 std::cout << " album " |
149 << (metadata->album ? metadata->album : "<none>") | 147 << (metadata->album ? metadata->album : "<none>") |
150 << clear_line() << std::endl; | 148 << clear_line() << std::endl; |
151 std::cout << " publisher " | 149 std::cout << " publisher " |
152 << (metadata->publisher ? metadata->publisher : "<none>") | 150 << (metadata->publisher ? metadata->publisher : "<none>") |
153 << clear_line() << std::endl; | 151 << clear_line() << std::endl; |
154 std::cout << " genre " | 152 std::cout << " genre " |
155 << (metadata->genre ? metadata->genre : "<none>") | 153 << (metadata->genre ? metadata->genre : "<none>") |
156 << clear_line() << std::endl; | 154 << clear_line() << std::endl; |
157 std::cout << " composer " | 155 std::cout << " composer " |
158 << (metadata->composer ? metadata->composer : "<none>") | 156 << (metadata->composer ? metadata->composer : "<none>") |
159 << clear_line() << std::endl | 157 << clear_line() << std::endl |
160 << std::endl; | 158 << std::endl; |
161 } else { | 159 } else if (paint_) { |
162 std::cout << " duration <none>" << kClearLine << std::endl; | 160 std::cout << " duration <none>" << kClearLine << std::endl; |
163 std::cout << " title <none>" << kClearLine << std::endl; | 161 std::cout << " title <none>" << kClearLine << std::endl; |
164 std::cout << " artist <none>" << kClearLine << std::endl; | 162 std::cout << " artist <none>" << kClearLine << std::endl; |
165 std::cout << " album <none>" << kClearLine << std::endl; | 163 std::cout << " album <none>" << kClearLine << std::endl; |
166 std::cout << " publisher <none>" << kClearLine << std::endl; | 164 std::cout << " publisher <none>" << kClearLine << std::endl; |
167 std::cout << " genre <none>" << kClearLine << std::endl; | 165 std::cout << " genre <none>" << kClearLine << std::endl; |
168 std::cout << " composer <none>" << kClearLine << std::endl; | 166 std::cout << " composer <none>" << kClearLine << std::endl; |
169 std::cout << std::endl; | 167 std::cout << std::endl; |
170 } | 168 } |
171 std::cout << " " << state_string() << clear_line() << std::endl; | 169 std::cout << " " << state_string() << clear_line() << std::endl; |
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
321 | 319 |
322 } // namespace examples | 320 } // namespace examples |
323 } // namespace media | 321 } // namespace media |
324 } // namespace mojo | 322 } // namespace mojo |
325 | 323 |
326 MojoResult MojoMain(MojoHandle application_request) { | 324 MojoResult MojoMain(MojoHandle application_request) { |
327 mojo::ApplicationRunnerChromium runner( | 325 mojo::ApplicationRunnerChromium runner( |
328 new mojo::media::examples::MediaTestApp); | 326 new mojo::media::examples::MediaTestApp); |
329 return runner.Run(application_request); | 327 return runner.Run(application_request); |
330 } | 328 } |
OLD | NEW |