| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. Use of this | 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. |
| 2 // source code is governed by a BSD-style license that can be found in the | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // 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/utf_string_conversions.h" | 7 #include "base/utf_string_conversions.h" |
| 8 #include "media/base/pipeline_impl.h" | 8 #include "media/base/pipeline_impl.h" |
| 9 #include "media/filters/audio_renderer_impl.h" | 9 #include "media/filters/audio_renderer_impl.h" |
| 10 #include "media/filters/ffmpeg_audio_decoder.h" | 10 #include "media/filters/ffmpeg_audio_decoder.h" |
| 11 #include "media/filters/ffmpeg_demuxer.h" | 11 #include "media/filters/ffmpeg_demuxer.h" |
| 12 #include "media/filters/ffmpeg_video_decoder.h" | 12 #include "media/filters/ffmpeg_video_decoder.h" |
| 13 #include "media/filters/file_data_source.h" | 13 #include "media/filters/file_data_source.h" |
| (...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 48 } | 48 } |
| 49 | 49 |
| 50 bool Movie::Open(const wchar_t* url, WtlVideoRenderer* video_renderer) { | 50 bool Movie::Open(const wchar_t* url, WtlVideoRenderer* video_renderer) { |
| 51 // Close previous movie. | 51 // Close previous movie. |
| 52 if (pipeline_) { | 52 if (pipeline_) { |
| 53 Close(); | 53 Close(); |
| 54 } | 54 } |
| 55 | 55 |
| 56 // Create filter collection. | 56 // Create filter collection. |
| 57 scoped_ptr<MediaFilterCollection> collection(new MediaFilterCollection()); | 57 scoped_ptr<MediaFilterCollection> collection(new MediaFilterCollection()); |
| 58 collection->AddFilter(new FileDataSource()); | 58 collection->AddDataSource(new FileDataSource()); |
| 59 collection->AddFilter(new FFmpegAudioDecoder()); | 59 collection->AddAudioDecoder(new FFmpegAudioDecoder()); |
| 60 collection->AddFilter(new FFmpegDemuxer()); | 60 collection->AddDemuxer(new FFmpegDemuxer()); |
| 61 collection->AddFilter(new FFmpegVideoDecoder(NULL)); | 61 collection->AddVideoDecoder(new FFmpegVideoDecoder(NULL)); |
| 62 | 62 |
| 63 if (enable_audio_) { | 63 if (enable_audio_) { |
| 64 collection->AddFilter(new AudioRendererImpl()); | 64 collection->AddAudioRenderer(new AudioRendererImpl()); |
| 65 } else { | 65 } else { |
| 66 collection->AddFilter(new media::NullAudioRenderer()); | 66 collection->AddAudioRenderer(new media::NullAudioRenderer()); |
| 67 } | 67 } |
| 68 collection->AddFilter(video_renderer); | 68 collection->AddVideoRenderer(video_renderer); |
| 69 | 69 |
| 70 thread_.reset(new base::Thread("PipelineThread")); | 70 thread_.reset(new base::Thread("PipelineThread")); |
| 71 thread_->Start(); | 71 thread_->Start(); |
| 72 pipeline_ = new PipelineImpl(thread_->message_loop()); | 72 pipeline_ = new PipelineImpl(thread_->message_loop()); |
| 73 | 73 |
| 74 // Create and start our pipeline. | 74 // Create and start our pipeline. |
| 75 pipeline_->Start(collection.release(), WideToUTF8(std::wstring(url)), NULL); | 75 pipeline_->Start(collection.release(), WideToUTF8(std::wstring(url)), NULL); |
| 76 while (true) { | 76 while (true) { |
| 77 PlatformThread::Sleep(100); | 77 PlatformThread::Sleep(100); |
| 78 if (pipeline_->IsInitialized()) | 78 if (pipeline_->IsInitialized()) |
| (...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 void Movie::Close() { | 161 void Movie::Close() { |
| 162 if (pipeline_) { | 162 if (pipeline_) { |
| 163 pipeline_->Stop(NULL); | 163 pipeline_->Stop(NULL); |
| 164 thread_->Stop(); | 164 thread_->Stop(); |
| 165 pipeline_ = NULL; | 165 pipeline_ = NULL; |
| 166 thread_.reset(); | 166 thread_.reset(); |
| 167 } | 167 } |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace media | 170 } // namespace media |
| OLD | NEW |