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/base/filter_collection.h" | 10 #include "media/base/filter_collection.h" |
11 #include "media/base/media_log.h" | 11 #include "media/base/media_log.h" |
12 #include "media/base/message_loop_factory_impl.h" | 12 #include "media/base/message_loop_factory_impl.h" |
13 #include "media/base/pipeline_impl.h" | 13 #include "media/base/pipeline_impl.h" |
14 #include "media/filters/audio_renderer_impl.h" | |
15 #include "media/filters/ffmpeg_audio_decoder.h" | 14 #include "media/filters/ffmpeg_audio_decoder.h" |
16 #include "media/filters/ffmpeg_demuxer_factory.h" | 15 #include "media/filters/ffmpeg_demuxer_factory.h" |
17 #include "media/filters/ffmpeg_video_decoder.h" | 16 #include "media/filters/ffmpeg_video_decoder.h" |
18 #include "media/filters/file_data_source_factory.h" | 17 #include "media/filters/file_data_source_factory.h" |
19 #include "media/filters/null_audio_renderer.h" | 18 #include "media/filters/null_audio_renderer.h" |
| 19 #include "media/filters/reference_audio_renderer.h" |
20 #include "media/tools/player_wtl/wtl_renderer.h" | 20 #include "media/tools/player_wtl/wtl_renderer.h" |
21 | 21 |
22 using media::AudioRendererImpl; | |
23 using media::FFmpegAudioDecoder; | 22 using media::FFmpegAudioDecoder; |
24 using media::FFmpegDemuxerFactory; | 23 using media::FFmpegDemuxerFactory; |
25 using media::FFmpegVideoDecoder; | 24 using media::FFmpegVideoDecoder; |
26 using media::FileDataSourceFactory; | 25 using media::FileDataSourceFactory; |
27 using media::FilterCollection; | 26 using media::FilterCollection; |
28 using media::PipelineImpl; | 27 using media::PipelineImpl; |
| 28 using media::ReferenceAudioRenderer; |
29 | 29 |
30 namespace media { | 30 namespace media { |
31 | 31 |
32 Movie::Movie() | 32 Movie::Movie() |
33 : enable_audio_(true), | 33 : enable_audio_(true), |
34 enable_draw_(true), | 34 enable_draw_(true), |
35 enable_dump_yuv_file_(false), | 35 enable_dump_yuv_file_(false), |
36 enable_pause_(false), | 36 enable_pause_(false), |
37 max_threads_(0), | 37 max_threads_(0), |
38 play_rate_(1.0f), | 38 play_rate_(1.0f), |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 // Create filter collection. | 71 // Create filter collection. |
72 scoped_ptr<FilterCollection> collection(new FilterCollection()); | 72 scoped_ptr<FilterCollection> collection(new FilterCollection()); |
73 collection->SetDemuxerFactory(new FFmpegDemuxerFactory( | 73 collection->SetDemuxerFactory(new FFmpegDemuxerFactory( |
74 new FileDataSourceFactory(), pipeline_loop)); | 74 new FileDataSourceFactory(), pipeline_loop)); |
75 collection->AddAudioDecoder(new FFmpegAudioDecoder( | 75 collection->AddAudioDecoder(new FFmpegAudioDecoder( |
76 message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); | 76 message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); |
77 collection->AddVideoDecoder(new FFmpegVideoDecoder( | 77 collection->AddVideoDecoder(new FFmpegVideoDecoder( |
78 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), NULL)); | 78 message_loop_factory_->GetMessageLoop("VideoDecoderThread"), NULL)); |
79 | 79 |
80 if (enable_audio_) { | 80 if (enable_audio_) { |
81 collection->AddAudioRenderer(new AudioRendererImpl()); | 81 collection->AddAudioRenderer(new ReferenceAudioRenderer()); |
82 } else { | 82 } else { |
83 collection->AddAudioRenderer(new media::NullAudioRenderer()); | 83 collection->AddAudioRenderer(new media::NullAudioRenderer()); |
84 } | 84 } |
85 collection->AddVideoRenderer(video_renderer); | 85 collection->AddVideoRenderer(video_renderer); |
86 | 86 |
87 // Create and start our pipeline. | 87 // Create and start our pipeline. |
88 media::PipelineStatusNotification note; | 88 media::PipelineStatusNotification note; |
89 pipeline_->Start(collection.release(), WideToUTF8(std::wstring(url)), | 89 pipeline_->Start(collection.release(), WideToUTF8(std::wstring(url)), |
90 note.Callback()); | 90 note.Callback()); |
91 // Wait until the pipeline is fully initialized. | 91 // Wait until the pipeline is fully initialized. |
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
173 void Movie::Close() { | 173 void Movie::Close() { |
174 if (pipeline_) { | 174 if (pipeline_) { |
175 pipeline_->Stop(media::PipelineStatusCB()); | 175 pipeline_->Stop(media::PipelineStatusCB()); |
176 pipeline_ = NULL; | 176 pipeline_ = NULL; |
177 } | 177 } |
178 | 178 |
179 message_loop_factory_.reset(); | 179 message_loop_factory_.reset(); |
180 } | 180 } |
181 | 181 |
182 } // namespace media | 182 } // namespace media |
OLD | NEW |