diff options
Diffstat (limited to 'webkit/glue/webmediaplayer_impl.cc')
-rw-r--r-- | webkit/glue/webmediaplayer_impl.cc | 30 |
1 files changed, 18 insertions, 12 deletions
diff --git a/webkit/glue/webmediaplayer_impl.cc b/webkit/glue/webmediaplayer_impl.cc index 58489cc..4a64b0f 100644 --- a/webkit/glue/webmediaplayer_impl.cc +++ b/webkit/glue/webmediaplayer_impl.cc @@ -8,6 +8,7 @@ #include "base/callback.h" #include "base/command_line.h" +#include "media/base/filter_collection.h" #include "media/base/limits.h" #include "media/base/media_format.h" #include "media/base/media_switches.h" @@ -23,7 +24,6 @@ #include "third_party/WebKit/WebKit/chromium/public/WebURL.h" #include "third_party/WebKit/WebKit/chromium/public/WebVideoFrame.h" #include "webkit/glue/media/buffered_data_source.h" -#include "webkit/glue/media/media_resource_loader_bridge_factory.h" #include "webkit/glue/media/simple_data_source.h" #include "webkit/glue/media/video_renderer_impl.h" #include "webkit/glue/media/web_video_renderer.h" @@ -225,7 +225,7 @@ void WebMediaPlayerImpl::Proxy::PutCurrentFrame( WebMediaPlayerImpl::WebMediaPlayerImpl( WebKit::WebMediaPlayerClient* client, - media::MediaFilterCollection* collection) + media::FilterCollection* collection) : network_state_(WebKit::WebMediaPlayer::Empty), ready_state_(WebKit::WebMediaPlayer::HaveNothing), main_loop_(NULL), @@ -233,6 +233,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( pipeline_(NULL), pipeline_thread_("PipelineThread"), paused_(true), + seeking_(false), playback_rate_(0.0f), client_(client), proxy_(NULL), @@ -243,8 +244,7 @@ WebMediaPlayerImpl::WebMediaPlayerImpl( } bool WebMediaPlayerImpl::Initialize( - MediaResourceLoaderBridgeFactory* bridge_factory_simple, - MediaResourceLoaderBridgeFactory* bridge_factory_buffered, + WebKit::WebFrame* frame, bool use_simple_data_source, scoped_refptr<WebVideoRenderer> web_video_renderer) { // Create the pipeline and its thread. @@ -274,11 +274,11 @@ bool WebMediaPlayerImpl::Initialize( // A simple data source that keeps all data in memory. scoped_refptr<SimpleDataSource> simple_data_source( - new SimpleDataSource(MessageLoop::current(), bridge_factory_simple)); + new SimpleDataSource(MessageLoop::current(), frame)); // A sophisticated data source that does memory caching. scoped_refptr<BufferedDataSource> buffered_data_source( - new BufferedDataSource(MessageLoop::current(), bridge_factory_buffered)); + new BufferedDataSource(MessageLoop::current(), frame)); proxy_->SetDataSource(buffered_data_source); if (use_simple_data_source) { @@ -369,11 +369,6 @@ void WebMediaPlayerImpl::seek(float seconds) { return; } - // Drop our ready state if the media file isn't fully loaded. - if (!pipeline_->IsLoaded()) { - SetReadyState(WebKit::WebMediaPlayer::HaveMetadata); - } - // Try to preserve as much accuracy as possible. float microseconds = seconds * base::Time::kMicrosecondsPerSecond; base::TimeDelta seek_time = @@ -384,6 +379,8 @@ void WebMediaPlayerImpl::seek(float seconds) { paused_time_ = seek_time; } + seeking_ = true; + // Kick off the asynchronous seek! pipeline_->Seek( seek_time, @@ -477,7 +474,7 @@ bool WebMediaPlayerImpl::seeking() const { if (ready_state_ == WebKit::WebMediaPlayer::HaveNothing) return false; - return ready_state_ == WebKit::WebMediaPlayer::HaveMetadata; + return seeking_; } float WebMediaPlayerImpl::duration() const { @@ -505,6 +502,14 @@ int WebMediaPlayerImpl::dataRate() const { return 0; } +WebKit::WebMediaPlayer::NetworkState WebMediaPlayerImpl::networkState() const { + return network_state_; +} + +WebKit::WebMediaPlayer::ReadyState WebMediaPlayerImpl::readyState() const { + return ready_state_; +} + const WebKit::WebTimeRanges& WebMediaPlayerImpl::buffered() { DCHECK(MessageLoop::current() == main_loop_); @@ -698,6 +703,7 @@ void WebMediaPlayerImpl::OnPipelineSeek() { } SetReadyState(WebKit::WebMediaPlayer::HaveEnoughData); + seeking_ = false; GetClient()->timeChanged(); } } |