Chromium Code Reviews| 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->AddFilter(new media::FileDataSource()); | 102 collection->AddDataSource(new media::FileDataSource()); |
|
scherkus (not reviewing)
2010/11/11 19:33:35
wow this code reads much nicer :)
| |
| 103 collection->AddFilter(new media::FFmpegDemuxer()); | 103 collection->AddDemuxer(new media::FFmpegDemuxer()); |
| 104 collection->AddFilter(new media::FFmpegAudioDecoder()); | 104 collection->AddAudioDecoder(new media::FFmpegAudioDecoder()); |
| 105 if (CommandLine::ForCurrentProcess()->HasSwitch( | 105 if (CommandLine::ForCurrentProcess()->HasSwitch( |
| 106 switches::kEnableOpenMax)) { | 106 switches::kEnableOpenMax)) { |
| 107 collection->AddFilter(new media::OmxVideoDecoder(NULL)); | 107 collection->AddVideoDecoder(new media::OmxVideoDecoder(NULL)); |
| 108 } else { | 108 } else { |
| 109 collection->AddFilter(new media::FFmpegVideoDecoder(NULL)); | 109 collection->AddVideoDecoder(new media::FFmpegVideoDecoder(NULL)); |
| 110 } | 110 } |
| 111 collection->AddFilter(new Renderer(g_display, g_window, paint_message_loop)); | 111 collection->AddVideoRenderer(new Renderer(g_display, |
| 112 g_window, | |
| 113 paint_message_loop)); | |
| 112 | 114 |
| 113 if (enable_audio) | 115 if (enable_audio) |
| 114 collection->AddFilter(new media::AudioRendererImpl()); | 116 collection->AddAudioRenderer(new media::AudioRendererImpl()); |
| 115 else | 117 else |
| 116 collection->AddFilter(new media::NullAudioRenderer()); | 118 collection->AddAudioRenderer(new media::NullAudioRenderer()); |
| 117 | 119 |
| 118 // Creates the pipeline and start it. | 120 // Creates the pipeline and start it. |
| 119 *pipeline = new media::PipelineImpl(message_loop); | 121 *pipeline = new media::PipelineImpl(message_loop); |
| 120 (*pipeline)->Start(collection.release(), filename, NULL); | 122 (*pipeline)->Start(collection.release(), filename, NULL); |
| 121 | 123 |
| 122 // Wait until the pipeline is fully initialized. | 124 // Wait until the pipeline is fully initialized. |
| 123 while (true) { | 125 while (true) { |
| 124 PlatformThread::Sleep(100); | 126 PlatformThread::Sleep(100); |
| 125 if ((*pipeline)->IsInitialized()) | 127 if ((*pipeline)->IsInitialized()) |
| 126 break; | 128 break; |
| (...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 260 } else{ | 262 } else{ |
| 261 std::cout << "Pipeline initialization failed..." << std::endl; | 263 std::cout << "Pipeline initialization failed..." << std::endl; |
| 262 } | 264 } |
| 263 | 265 |
| 264 // Cleanup tasks. | 266 // Cleanup tasks. |
| 265 thread->Stop(); | 267 thread->Stop(); |
| 266 XDestroyWindow(g_display, g_window); | 268 XDestroyWindow(g_display, g_window); |
| 267 XCloseDisplay(g_display); | 269 XCloseDisplay(g_display); |
| 268 return 0; | 270 return 0; |
| 269 } | 271 } |
| OLD | NEW |