OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <iostream> | 5 #include <iostream> |
6 #include <signal.h> | 6 #include <signal.h> |
7 #include <X11/keysym.h> | 7 #include <X11/keysym.h> |
8 #include <X11/Xlib.h> | 8 #include <X11/Xlib.h> |
9 | 9 |
10 #include "base/at_exit.h" | 10 #include "base/at_exit.h" |
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
182 pipeline->SetPlaybackRate(0.0f); | 182 pipeline->SetPlaybackRate(0.0f); |
183 } | 183 } |
184 } | 184 } |
185 break; | 185 break; |
186 default: | 186 default: |
187 break; | 187 break; |
188 } | 188 } |
189 } | 189 } |
190 | 190 |
191 message_loop->PostDelayedTask(FROM_HERE, base::Bind( | 191 message_loop->PostDelayedTask(FROM_HERE, base::Bind( |
192 PeriodicalUpdate, make_scoped_refptr(pipeline), | 192 &PeriodicalUpdate, make_scoped_refptr(pipeline), |
193 message_loop, audio_only), 10); | 193 message_loop, audio_only), 10); |
194 } | 194 } |
195 | 195 |
196 int main(int argc, char** argv) { | 196 int main(int argc, char** argv) { |
197 // Read arguments. | 197 // Read arguments. |
198 if (argc == 1) { | 198 if (argc == 1) { |
199 std::cout << "Usage: " << argv[0] << " --file=FILE" << std::endl | 199 std::cout << "Usage: " << argv[0] << " --file=FILE" << std::endl |
200 << std::endl | 200 << std::endl |
201 << "Optional arguments:" << std::endl | 201 << "Optional arguments:" << std::endl |
202 << " [--audio]" | 202 << " [--audio]" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
243 if (InitPipeline(thread->message_loop(), filename.c_str(), | 243 if (InitPipeline(thread->message_loop(), filename.c_str(), |
244 use_gl, enable_audio, &pipeline, &message_loop, | 244 use_gl, enable_audio, &pipeline, &message_loop, |
245 message_loop_factory.get())) { | 245 message_loop_factory.get())) { |
246 // Main loop of the application. | 246 // Main loop of the application. |
247 g_running = true; | 247 g_running = true; |
248 | 248 |
249 // Check if video is present. | 249 // Check if video is present. |
250 audio_only = !pipeline->HasVideo(); | 250 audio_only = !pipeline->HasVideo(); |
251 | 251 |
252 message_loop.PostTask(FROM_HERE, base::Bind( | 252 message_loop.PostTask(FROM_HERE, base::Bind( |
253 PeriodicalUpdate, pipeline, &message_loop, audio_only)); | 253 &PeriodicalUpdate, pipeline, &message_loop, audio_only)); |
254 message_loop.Run(); | 254 message_loop.Run(); |
255 } else{ | 255 } else{ |
256 std::cout << "Pipeline initialization failed..." << std::endl; | 256 std::cout << "Pipeline initialization failed..." << std::endl; |
257 } | 257 } |
258 | 258 |
259 // Cleanup tasks. | 259 // Cleanup tasks. |
260 message_loop_factory.reset(); | 260 message_loop_factory.reset(); |
261 | 261 |
262 thread->Stop(); | 262 thread->Stop(); |
263 XDestroyWindow(g_display, g_window); | 263 XDestroyWindow(g_display, g_window); |
264 XCloseDisplay(g_display); | 264 XCloseDisplay(g_display); |
265 return 0; | 265 return 0; |
266 } | 266 } |
OLD | NEW |