OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 92 |
93 // Load media libraries. | 93 // Load media libraries. |
94 if (!media::InitializeMediaLibrary(FilePath())) { | 94 if (!media::InitializeMediaLibrary(FilePath())) { |
95 std::cout << "Unable to initialize the media library." << std::endl; | 95 std::cout << "Unable to initialize the media library." << std::endl; |
96 return false; | 96 return false; |
97 } | 97 } |
98 | 98 |
99 // Create our filter factories. | 99 // Create our filter factories. |
100 scoped_ptr<media::MediaFilterCollection> collection( | 100 scoped_ptr<media::MediaFilterCollection> collection( |
101 new media::MediaFilterCollection()); | 101 new media::MediaFilterCollection()); |
102 collection->AddDataSource(new media::FileDataSource()); | 102 collection->AddFilter(new media::FileDataSource()); |
103 collection->AddDemuxer(new media::FFmpegDemuxer()); | 103 collection->AddFilter(new media::FFmpegDemuxer()); |
104 collection->AddAudioDecoder(new media::FFmpegAudioDecoder()); | 104 collection->AddFilter(new media::FFmpegAudioDecoder()); |
105 if (CommandLine::ForCurrentProcess()->HasSwitch( | 105 if (CommandLine::ForCurrentProcess()->HasSwitch( |
106 switches::kEnableOpenMax)) { | 106 switches::kEnableOpenMax)) { |
107 collection->AddVideoDecoder(new media::OmxVideoDecoder(NULL)); | 107 collection->AddFilter(new media::OmxVideoDecoder(NULL)); |
108 } else { | 108 } else { |
109 collection->AddVideoDecoder(new media::FFmpegVideoDecoder(NULL)); | 109 collection->AddFilter(new media::FFmpegVideoDecoder(NULL)); |
110 } | 110 } |
111 collection->AddVideoRenderer(new Renderer(g_display, | 111 collection->AddFilter(new Renderer(g_display, g_window, paint_message_loop)); |
112 g_window, | |
113 paint_message_loop)); | |
114 | 112 |
115 if (enable_audio) | 113 if (enable_audio) |
116 collection->AddAudioRenderer(new media::AudioRendererImpl()); | 114 collection->AddFilter(new media::AudioRendererImpl()); |
117 else | 115 else |
118 collection->AddAudioRenderer(new media::NullAudioRenderer()); | 116 collection->AddFilter(new media::NullAudioRenderer()); |
119 | 117 |
120 // Creates the pipeline and start it. | 118 // Creates the pipeline and start it. |
121 *pipeline = new media::PipelineImpl(message_loop); | 119 *pipeline = new media::PipelineImpl(message_loop); |
122 (*pipeline)->Start(collection.release(), filename, NULL); | 120 (*pipeline)->Start(collection.release(), filename, NULL); |
123 | 121 |
124 // Wait until the pipeline is fully initialized. | 122 // Wait until the pipeline is fully initialized. |
125 while (true) { | 123 while (true) { |
126 PlatformThread::Sleep(100); | 124 PlatformThread::Sleep(100); |
127 if ((*pipeline)->IsInitialized()) | 125 if ((*pipeline)->IsInitialized()) |
128 break; | 126 break; |
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 } else{ | 260 } else{ |
263 std::cout << "Pipeline initialization failed..." << std::endl; | 261 std::cout << "Pipeline initialization failed..." << std::endl; |
264 } | 262 } |
265 | 263 |
266 // Cleanup tasks. | 264 // Cleanup tasks. |
267 thread->Stop(); | 265 thread->Stop(); |
268 XDestroyWindow(g_display, g_window); | 266 XDestroyWindow(g_display, g_window); |
269 XCloseDisplay(g_display); | 267 XCloseDisplay(g_display); |
270 return 0; | 268 return 0; |
271 } | 269 } |
OLD | NEW |