Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(205)

Side by Side Diff: media/tools/player_wtl/movie.cc

Issue 9015015: Take advantage of the new Pass() machinery on scoped_ptr{,_malloc}. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased & removed unnecessary include of ffmpeg_common.h from ffmpeg_demuxer.h Created 8 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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
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): hopefully the extra scoped_ptr<>'s will be
76 new FileDataSourceFactory(), pipeline_loop)); 76 // unnecessary once http://codereview.chromium.org/8968032/ lands
77 // properly.
78 collection->SetDemuxerFactory(
79 scoped_ptr<DemuxerFactory>(new FFmpegDemuxerFactory(
80 scoped_ptr<DataSourceFactory>(new FileDataSourceFactory()),
81 pipeline_loop)));
77 collection->AddAudioDecoder(new FFmpegAudioDecoder( 82 collection->AddAudioDecoder(new FFmpegAudioDecoder(
78 message_loop_factory_->GetMessageLoop("AudioDecoderThread"))); 83 message_loop_factory_->GetMessageLoop("AudioDecoderThread")));
79 collection->AddVideoDecoder(new FFmpegVideoDecoder( 84 collection->AddVideoDecoder(new FFmpegVideoDecoder(
80 message_loop_factory_->GetMessageLoop("VideoDecoderThread"))); 85 message_loop_factory_->GetMessageLoop("VideoDecoderThread")));
81 86
82 if (enable_audio_) { 87 if (enable_audio_) {
83 collection->AddAudioRenderer( 88 collection->AddAudioRenderer(
84 new ReferenceAudioRenderer(audio_manager_)); 89 new ReferenceAudioRenderer(audio_manager_));
85 } else { 90 } else {
86 collection->AddAudioRenderer(new media::NullAudioRenderer()); 91 collection->AddAudioRenderer(new media::NullAudioRenderer());
87 } 92 }
88 collection->AddVideoRenderer(video_renderer); 93 collection->AddVideoRenderer(video_renderer);
89 94
90 // Create and start our pipeline. 95 // Create and start our pipeline.
91 media::PipelineStatusNotification note; 96 media::PipelineStatusNotification note;
92 pipeline_->Start(collection.release(), WideToUTF8(std::wstring(url)), 97 pipeline_->Start(collection.Pass(), WideToUTF8(std::wstring(url)),
93 note.Callback()); 98 note.Callback());
94 // Wait until the pipeline is fully initialized. 99 // Wait until the pipeline is fully initialized.
95 note.Wait(); 100 note.Wait();
96 if (note.status() != PIPELINE_OK) 101 if (note.status() != PIPELINE_OK)
97 return false; 102 return false;
98 pipeline_->SetPlaybackRate(play_rate_); 103 pipeline_->SetPlaybackRate(play_rate_);
99 return true; 104 return true;
100 } 105 }
101 106
102 void Movie::Play(float rate) { 107 void Movie::Play(float rate) {
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 void Movie::Close() { 181 void Movie::Close() {
177 if (pipeline_) { 182 if (pipeline_) {
178 pipeline_->Stop(media::PipelineStatusCB()); 183 pipeline_->Stop(media::PipelineStatusCB());
179 pipeline_ = NULL; 184 pipeline_ = NULL;
180 } 185 }
181 186
182 message_loop_factory_.reset(); 187 message_loop_factory_.reset();
183 } 188 }
184 189
185 } // namespace media 190 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698