| 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/bind.h" | 11 #include "base/bind.h" |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/file_path.h" | 13 #include "base/file_path.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/threading/platform_thread.h" | 15 #include "base/threading/platform_thread.h" |
| 16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.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_log.h" |
| 20 #include "media/base/media_switches.h" | 20 #include "media/base/media_switches.h" |
| 21 #include "media/base/message_loop_factory_impl.h" | 21 #include "media/base/message_loop_factory_impl.h" |
| 22 #include "media/base/pipeline_impl.h" | 22 #include "media/base/pipeline_impl.h" |
| 23 #include "media/filters/audio_renderer_impl.h" | |
| 24 #include "media/filters/ffmpeg_audio_decoder.h" | 23 #include "media/filters/ffmpeg_audio_decoder.h" |
| 25 #include "media/filters/ffmpeg_demuxer_factory.h" | 24 #include "media/filters/ffmpeg_demuxer_factory.h" |
| 26 #include "media/filters/ffmpeg_video_decoder.h" | 25 #include "media/filters/ffmpeg_video_decoder.h" |
| 27 #include "media/filters/file_data_source_factory.h" | 26 #include "media/filters/file_data_source_factory.h" |
| 28 #include "media/filters/null_audio_renderer.h" | 27 #include "media/filters/null_audio_renderer.h" |
| 28 #include "media/filters/reference_audio_renderer.h" |
| 29 #include "media/tools/player_x11/gl_video_renderer.h" | 29 #include "media/tools/player_x11/gl_video_renderer.h" |
| 30 #include "media/tools/player_x11/x11_video_renderer.h" | 30 #include "media/tools/player_x11/x11_video_renderer.h" |
| 31 | 31 |
| 32 static Display* g_display = NULL; | 32 static Display* g_display = NULL; |
| 33 static Window g_window = 0; | 33 static Window g_window = 0; |
| 34 static bool g_running = false; | 34 static bool g_running = false; |
| 35 | 35 |
| 36 class MessageLoopQuitter { | 36 class MessageLoopQuitter { |
| 37 public: | 37 public: |
| 38 explicit MessageLoopQuitter(MessageLoop* loop) : loop_(loop) {} | 38 explicit MessageLoopQuitter(MessageLoop* loop) : loop_(loop) {} |
| (...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 | 97 |
| 98 if (use_gl) { | 98 if (use_gl) { |
| 99 collection->AddVideoRenderer( | 99 collection->AddVideoRenderer( |
| 100 new GlVideoRenderer(g_display, g_window, paint_message_loop)); | 100 new GlVideoRenderer(g_display, g_window, paint_message_loop)); |
| 101 } else { | 101 } else { |
| 102 collection->AddVideoRenderer( | 102 collection->AddVideoRenderer( |
| 103 new X11VideoRenderer(g_display, g_window, paint_message_loop)); | 103 new X11VideoRenderer(g_display, g_window, paint_message_loop)); |
| 104 } | 104 } |
| 105 | 105 |
| 106 if (enable_audio) | 106 if (enable_audio) |
| 107 collection->AddAudioRenderer(new media::AudioRendererImpl()); | 107 collection->AddAudioRenderer(new media::ReferenceAudioRenderer()); |
| 108 else | 108 else |
| 109 collection->AddAudioRenderer(new media::NullAudioRenderer()); | 109 collection->AddAudioRenderer(new media::NullAudioRenderer()); |
| 110 | 110 |
| 111 // Create the pipeline and start it. | 111 // Create the pipeline and start it. |
| 112 *pipeline = new media::PipelineImpl(message_loop, new media::MediaLog()); | 112 *pipeline = new media::PipelineImpl(message_loop, new media::MediaLog()); |
| 113 media::PipelineStatusNotification note; | 113 media::PipelineStatusNotification note; |
| 114 (*pipeline)->Start(collection.release(), filename, note.Callback()); | 114 (*pipeline)->Start(collection.release(), filename, note.Callback()); |
| 115 | 115 |
| 116 // Wait until the pipeline is fully initialized. | 116 // Wait until the pipeline is fully initialized. |
| 117 note.Wait(); | 117 note.Wait(); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 } | 258 } |
| 259 | 259 |
| 260 // Cleanup tasks. | 260 // Cleanup tasks. |
| 261 message_loop_factory.reset(); | 261 message_loop_factory.reset(); |
| 262 | 262 |
| 263 thread->Stop(); | 263 thread->Stop(); |
| 264 XDestroyWindow(g_display, g_window); | 264 XDestroyWindow(g_display, g_window); |
| 265 XCloseDisplay(g_display); | 265 XCloseDisplay(g_display); |
| 266 return 0; | 266 return 0; |
| 267 } | 267 } |
| OLD | NEW |