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

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

Issue 10854151: Allow transitioning to HAVE_METADATA before pipeline initialization completes. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Rebase and address final comments Created 8 years, 4 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
« no previous file with comments | « media/filters/pipeline_integration_test_base.cc ('k') | media/tools/player_x11/player_x11.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/bind.h" 7 #include "base/bind.h"
8 #include "base/memory/singleton.h" 8 #include "base/memory/singleton.h"
9 #include "base/threading/platform_thread.h" 9 #include "base/threading/platform_thread.h"
10 #include "base/utf_string_conversions.h" 10 #include "base/utf_string_conversions.h"
11 #include "media/audio/audio_manager.h" 11 #include "media/audio/audio_manager.h"
12 #include "media/audio/null_audio_sink.h" 12 #include "media/audio/null_audio_sink.h"
13 #include "media/base/filter_collection.h" 13 #include "media/base/filter_collection.h"
14 #include "media/base/media_log.h" 14 #include "media/base/media_log.h"
15 #include "media/base/message_loop_factory.h" 15 #include "media/base/message_loop_factory.h"
16 #include "media/base/pipeline.h" 16 #include "media/base/pipeline.h"
17 #include "media/filters/audio_renderer_impl.h" 17 #include "media/filters/audio_renderer_impl.h"
18 #include "media/filters/ffmpeg_audio_decoder.h" 18 #include "media/filters/ffmpeg_audio_decoder.h"
19 #include "media/filters/ffmpeg_demuxer.h" 19 #include "media/filters/ffmpeg_demuxer.h"
20 #include "media/filters/ffmpeg_video_decoder.h" 20 #include "media/filters/ffmpeg_video_decoder.h"
21 #include "media/filters/file_data_source.h" 21 #include "media/filters/file_data_source.h"
22 #include "media/filters/video_renderer_base.h" 22 #include "media/filters/video_renderer_base.h"
23 23
24 namespace media { 24 namespace media {
25 25
26 static void OnBufferingState(media::Pipeline::BufferingState buffering_state) {}
27
26 Movie::Movie() 28 Movie::Movie()
27 : audio_manager_(AudioManager::Create()), 29 : audio_manager_(AudioManager::Create()),
28 enable_audio_(false), 30 enable_audio_(false),
29 enable_draw_(true), 31 enable_draw_(true),
30 enable_dump_yuv_file_(false), 32 enable_dump_yuv_file_(false),
31 enable_pause_(false), 33 enable_pause_(false),
32 max_threads_(0), 34 max_threads_(0),
33 play_rate_(1.0f), 35 play_rate_(1.0f),
34 movie_dib_(NULL), 36 movie_dib_(NULL),
35 movie_hwnd_(0) { 37 movie_hwnd_(0) {
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 collection->AddAudioRenderer( 90 collection->AddAudioRenderer(
89 new media::AudioRendererImpl(new media::NullAudioSink())); 91 new media::AudioRendererImpl(new media::NullAudioSink()));
90 collection->AddVideoRenderer(video_renderer); 92 collection->AddVideoRenderer(video_renderer);
91 93
92 // Create and start our pipeline. 94 // Create and start our pipeline.
93 media::PipelineStatusNotification note; 95 media::PipelineStatusNotification note;
94 pipeline_->Start( 96 pipeline_->Start(
95 collection.Pass(), 97 collection.Pass(),
96 media::PipelineStatusCB(), 98 media::PipelineStatusCB(),
97 media::PipelineStatusCB(), 99 media::PipelineStatusCB(),
98 note.Callback()); 100 note.Callback(),
101 base::Bind(&OnBufferingState));
99 102
100 // Wait until the pipeline is fully initialized. 103 // Wait until the pipeline is fully initialized.
101 note.Wait(); 104 note.Wait();
102 if (note.status() != PIPELINE_OK) 105 if (note.status() != PIPELINE_OK)
103 return false; 106 return false;
104 pipeline_->SetPlaybackRate(play_rate_); 107 pipeline_->SetPlaybackRate(play_rate_);
105 return true; 108 return true;
106 } 109 }
107 110
108 void Movie::Play(float rate) { 111 void Movie::Play(float rate) {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
181 void Movie::Close() { 184 void Movie::Close() {
182 if (pipeline_) { 185 if (pipeline_) {
183 pipeline_->Stop(base::Closure()); 186 pipeline_->Stop(base::Closure());
184 pipeline_ = NULL; 187 pipeline_ = NULL;
185 } 188 }
186 189
187 message_loop_factory_.reset(); 190 message_loop_factory_.reset();
188 } 191 }
189 192
190 } // namespace media 193 } // namespace media
OLDNEW
« no previous file with comments | « media/filters/pipeline_integration_test_base.cc ('k') | media/tools/player_x11/player_x11.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698