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" |
11 #include "base/command_line.h" | 11 #include "base/command_line.h" |
12 #include "base/file_path.h" | 12 #include "base/file_path.h" |
13 #include "base/memory/scoped_ptr.h" | 13 #include "base/memory/scoped_ptr.h" |
14 #include "base/threading/platform_thread.h" | 14 #include "base/threading/platform_thread.h" |
15 #include "base/threading/thread.h" | 15 #include "base/threading/thread.h" |
16 #include "media/base/callback.h" | 16 #include "media/base/callback.h" |
17 #include "media/base/filter_collection.h" | 17 #include "media/base/filter_collection.h" |
18 #include "media/base/media.h" | 18 #include "media/base/media.h" |
| 19 #include "media/base/media_log.h" |
19 #include "media/base/media_switches.h" | 20 #include "media/base/media_switches.h" |
20 #include "media/base/message_loop_factory_impl.h" | 21 #include "media/base/message_loop_factory_impl.h" |
21 #include "media/base/pipeline_impl.h" | 22 #include "media/base/pipeline_impl.h" |
22 #include "media/filters/audio_renderer_impl.h" | 23 #include "media/filters/audio_renderer_impl.h" |
23 #include "media/filters/ffmpeg_audio_decoder.h" | 24 #include "media/filters/ffmpeg_audio_decoder.h" |
24 #include "media/filters/ffmpeg_demuxer_factory.h" | 25 #include "media/filters/ffmpeg_demuxer_factory.h" |
25 #include "media/filters/ffmpeg_video_decoder.h" | 26 #include "media/filters/ffmpeg_video_decoder.h" |
26 #include "media/filters/file_data_source_factory.h" | 27 #include "media/filters/file_data_source_factory.h" |
27 #include "media/filters/null_audio_renderer.h" | 28 #include "media/filters/null_audio_renderer.h" |
28 #include "media/tools/player_x11/gl_video_renderer.h" | 29 #include "media/tools/player_x11/gl_video_renderer.h" |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 collection->AddVideoRenderer( | 102 collection->AddVideoRenderer( |
102 new X11VideoRenderer(g_display, g_window, paint_message_loop)); | 103 new X11VideoRenderer(g_display, g_window, paint_message_loop)); |
103 } | 104 } |
104 | 105 |
105 if (enable_audio) | 106 if (enable_audio) |
106 collection->AddAudioRenderer(new media::AudioRendererImpl()); | 107 collection->AddAudioRenderer(new media::AudioRendererImpl()); |
107 else | 108 else |
108 collection->AddAudioRenderer(new media::NullAudioRenderer()); | 109 collection->AddAudioRenderer(new media::NullAudioRenderer()); |
109 | 110 |
110 // Create the pipeline and start it. | 111 // Create the pipeline and start it. |
111 *pipeline = new media::PipelineImpl(message_loop); | 112 *pipeline = new media::PipelineImpl(message_loop, new media::MediaLog()); |
112 media::PipelineStatusNotification note; | 113 media::PipelineStatusNotification note; |
113 (*pipeline)->Start(collection.release(), filename, note.Callback()); | 114 (*pipeline)->Start(collection.release(), filename, note.Callback()); |
114 | 115 |
115 // Wait until the pipeline is fully initialized. | 116 // Wait until the pipeline is fully initialized. |
116 note.Wait(); | 117 note.Wait(); |
117 if (note.status() != media::PIPELINE_OK) { | 118 if (note.status() != media::PIPELINE_OK) { |
118 std::cout << "InitPipeline: " << note.status() << std::endl; | 119 std::cout << "InitPipeline: " << note.status() << std::endl; |
119 (*pipeline)->Stop(NULL); | 120 (*pipeline)->Stop(NULL); |
120 return false; | 121 return false; |
121 } | 122 } |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
256 } | 257 } |
257 | 258 |
258 // Cleanup tasks. | 259 // Cleanup tasks. |
259 message_loop_factory.reset(); | 260 message_loop_factory.reset(); |
260 | 261 |
261 thread->Stop(); | 262 thread->Stop(); |
262 XDestroyWindow(g_display, g_window); | 263 XDestroyWindow(g_display, g_window); |
263 XCloseDisplay(g_display); | 264 XCloseDisplay(g_display); |
264 return 0; | 265 return 0; |
265 } | 266 } |
OLD | NEW |