Chromium Code Reviews| 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 "media/tools/player_wtl/movie.h" | 5 #include "media/tools/player_wtl/movie.h" |
| 6 | 6 |
| 7 #include "base/memory/singleton.h" | 7 #include "base/memory/singleton.h" |
| 8 #include "base/threading/platform_thread.h" | 8 #include "base/threading/platform_thread.h" |
| 9 #include "base/utf_string_conversions.h" | 9 #include "base/utf_string_conversions.h" |
| 10 #include "media/audio/audio_manager.h" | 10 #include "media/audio/audio_manager.h" |
| (...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 65 } | 65 } |
| 66 | 66 |
| 67 message_loop_factory_.reset(new media::MessageLoopFactoryImpl()); | 67 message_loop_factory_.reset(new media::MessageLoopFactoryImpl()); |
| 68 | 68 |
| 69 MessageLoop* pipeline_loop = | 69 MessageLoop* pipeline_loop = |
| 70 message_loop_factory_->GetMessageLoop("PipelineThread"); | 70 message_loop_factory_->GetMessageLoop("PipelineThread"); |
| 71 pipeline_ = new PipelineImpl(pipeline_loop, new media::MediaLog()); | 71 pipeline_ = new PipelineImpl(pipeline_loop, new media::MediaLog()); |
| 72 | 72 |
| 73 // Create filter collection. | 73 // Create filter collection. |
| 74 scoped_ptr<FilterCollection> collection(new FilterCollection()); | 74 scoped_ptr<FilterCollection> collection(new FilterCollection()); |
| 75 collection->SetDemuxerFactory(new FFmpegDemuxerFactory( | 75 // TODO(fischman): replace the extra scoped_ptr's when |
| 76 new FileDataSourceFactory(), pipeline_loop)); | 76 // http://crbug.com/109026 is fixed. |
| 77 collection->SetDemuxerFactory( | |
|
acolwell GONE FROM CHROMIUM
2012/01/03 22:46:40
Remove comment per discussion
Ami GONE FROM CHROMIUM
2012/01/03 22:52:02
Done.
| |
| 78 scoped_ptr<DemuxerFactory>(new FFmpegDemuxerFactory( | |
| 79 scoped_ptr<DataSourceFactory>(new FileDataSourceFactory()), | |
| 80 pipeline_loop))); | |
| 77 collection->AddAudioDecoder(new FFmpegAudioDecoder( | 81 collection->AddAudioDecoder(new FFmpegAudioDecoder( |
| 78 message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); | 82 message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); |
| 79 collection->AddVideoDecoder(new FFmpegVideoDecoder( | 83 collection->AddVideoDecoder(new FFmpegVideoDecoder( |
| 80 message_loop_factory_->GetMessageLoop("VideoDecoderThread"))); | 84 message_loop_factory_->GetMessageLoop("VideoDecoderThread"))); |
| 81 | 85 |
| 82 if (enable_audio_) { | 86 if (enable_audio_) { |
| 83 collection->AddAudioRenderer( | 87 collection->AddAudioRenderer( |
| 84 new ReferenceAudioRenderer(audio_manager_)); | 88 new ReferenceAudioRenderer(audio_manager_)); |
| 85 } else { | 89 } else { |
| 86 collection->AddAudioRenderer(new media::NullAudioRenderer()); | 90 collection->AddAudioRenderer(new media::NullAudioRenderer()); |
| 87 } | 91 } |
| 88 collection->AddVideoRenderer(video_renderer); | 92 collection->AddVideoRenderer(video_renderer); |
| 89 | 93 |
| 90 // Create and start our pipeline. | 94 // Create and start our pipeline. |
| 91 media::PipelineStatusNotification note; | 95 media::PipelineStatusNotification note; |
| 92 pipeline_->Start(collection.release(), WideToUTF8(std::wstring(url)), | 96 pipeline_->Start(collection.Pass(), WideToUTF8(std::wstring(url)), |
| 93 note.Callback()); | 97 note.Callback()); |
| 94 // Wait until the pipeline is fully initialized. | 98 // Wait until the pipeline is fully initialized. |
| 95 note.Wait(); | 99 note.Wait(); |
| 96 if (note.status() != PIPELINE_OK) | 100 if (note.status() != PIPELINE_OK) |
| 97 return false; | 101 return false; |
| 98 pipeline_->SetPlaybackRate(play_rate_); | 102 pipeline_->SetPlaybackRate(play_rate_); |
| 99 return true; | 103 return true; |
| 100 } | 104 } |
| 101 | 105 |
| 102 void Movie::Play(float rate) { | 106 void Movie::Play(float rate) { |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 176 void Movie::Close() { | 180 void Movie::Close() { |
| 177 if (pipeline_) { | 181 if (pipeline_) { |
| 178 pipeline_->Stop(media::PipelineStatusCB()); | 182 pipeline_->Stop(media::PipelineStatusCB()); |
| 179 pipeline_ = NULL; | 183 pipeline_ = NULL; |
| 180 } | 184 } |
| 181 | 185 |
| 182 message_loop_factory_.reset(); | 186 message_loop_factory_.reset(); |
| 183 } | 187 } |
| 184 | 188 |
| 185 } // namespace media | 189 } // namespace media |
| OLD | NEW |