Commit 9e6042cc authored by acolwell@chromium.org's avatar acolwell@chromium.org

Revert 175546 "Eliminate MediaPlayer & MediaPlayerClient abstrac..."

> Eliminate MediaPlayer & MediaPlayerClient abstractions(seek, duration, poster APIs)
> 
> Bug=350571
> 
> Review URL: https://codereview.chromium.org/306123003

TBR=srirama.m@samsung.com

Review URL: https://codereview.chromium.org/314413003

git-svn-id: svn://svn.chromium.org/blink/trunk@175712 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a396e5ac
...@@ -1836,7 +1836,7 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState) ...@@ -1836,7 +1836,7 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState)
scheduleEvent(EventTypeNames::seeking); scheduleEvent(EventTypeNames::seeking);
// 9 - Set the current playback position to the given new playback position // 9 - Set the current playback position to the given new playback position
webMediaPlayer()->seek(time); m_player->seek(time);
// 10-14 are handled, if necessary, when the engine signals a readystate change or otherwise // 10-14 are handled, if necessary, when the engine signals a readystate change or otherwise
// satisfies seek completion and signals a time change. // satisfies seek completion and signals a time change.
...@@ -1876,10 +1876,7 @@ bool HTMLMediaElement::seeking() const ...@@ -1876,10 +1876,7 @@ bool HTMLMediaElement::seeking() const
void HTMLMediaElement::refreshCachedTime() const void HTMLMediaElement::refreshCachedTime() const
{ {
if (!webMediaPlayer()) m_cachedTime = m_player->currentTime();
return;
m_cachedTime = webMediaPlayer()->currentTime();
m_cachedTimeWallClockUpdateTime = WTF::currentTime(); m_cachedTimeWallClockUpdateTime = WTF::currentTime();
} }
...@@ -1903,7 +1900,7 @@ double HTMLMediaElement::currentTime() const ...@@ -1903,7 +1900,7 @@ double HTMLMediaElement::currentTime() const
static const double minCachedDeltaForWarning = 0.01; static const double minCachedDeltaForWarning = 0.01;
#endif #endif
if (!m_player || !webMediaPlayer()) if (!m_player)
return 0; return 0;
if (m_seeking) { if (m_seeking) {
...@@ -1913,7 +1910,7 @@ double HTMLMediaElement::currentTime() const ...@@ -1913,7 +1910,7 @@ double HTMLMediaElement::currentTime() const
if (m_cachedTime != MediaPlayer::invalidTime() && m_paused) { if (m_cachedTime != MediaPlayer::invalidTime() && m_paused) {
#if LOG_CACHED_TIME_WARNINGS #if LOG_CACHED_TIME_WARNINGS
double delta = m_cachedTime - webMediaPlayer()->currentTime(); double delta = m_cachedTime - m_player->currentTime();
if (delta > minCachedDeltaForWarning) if (delta > minCachedDeltaForWarning)
WTF_LOG(Media, "HTMLMediaElement::currentTime - WARNING, cached time is %f seconds off of media time when paused", delta); WTF_LOG(Media, "HTMLMediaElement::currentTime - WARNING, cached time is %f seconds off of media time when paused", delta);
#endif #endif
...@@ -1952,7 +1949,7 @@ double HTMLMediaElement::duration() const ...@@ -1952,7 +1949,7 @@ double HTMLMediaElement::duration() const
if (m_mediaSource) if (m_mediaSource)
return m_mediaSource->duration(); return m_mediaSource->duration();
return webMediaPlayer()->duration(); return m_player->duration();
} }
bool HTMLMediaElement::paused() const bool HTMLMediaElement::paused() const
...@@ -2768,7 +2765,7 @@ void HTMLMediaElement::mediaPlayerTimeChanged() ...@@ -2768,7 +2765,7 @@ void HTMLMediaElement::mediaPlayerTimeChanged()
invalidateCachedTime(); invalidateCachedTime();
// 4.8.10.9 steps 12-14. Needed if no ReadyState change is associated with the seek. // 4.8.10.9 steps 12-14. Needed if no ReadyState change is associated with the seek.
if (m_seeking && m_readyState >= HAVE_CURRENT_DATA && !webMediaPlayer()->seeking()) if (m_seeking && m_readyState >= HAVE_CURRENT_DATA && !m_player->seeking())
finishSeek(); finishSeek();
// Always call scheduleTimeupdateEvent when the media engine reports a time discontinuity, // Always call scheduleTimeupdateEvent when the media engine reports a time discontinuity,
......
...@@ -117,8 +117,8 @@ void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr ...@@ -117,8 +117,8 @@ void HTMLVideoElement::parseAttribute(const QualifiedName& name, const AtomicStr
toRenderImage(renderer())->imageResource()->setImageResource(0); toRenderImage(renderer())->imageResource()->setImageResource(0);
} }
// Notify the player when the poster image URL changes. // Notify the player when the poster image URL changes.
if (webMediaPlayer()) if (player())
webMediaPlayer()->setPoster(posterImageURL()); player()->setPoster(posterImageURL());
} else } else
HTMLMediaElement::parseAttribute(name, value); HTMLMediaElement::parseAttribute(name, value);
} }
......
...@@ -112,9 +112,19 @@ public: ...@@ -112,9 +112,19 @@ public:
virtual void load(blink::WebMediaPlayer::LoadType, const String& url, blink::WebMediaPlayer::CORSMode) = 0; virtual void load(blink::WebMediaPlayer::LoadType, const String& url, blink::WebMediaPlayer::CORSMode) = 0;
virtual double duration() const = 0;
virtual double currentTime() const = 0;
virtual void seek(double) = 0;
virtual bool seeking() const = 0;
virtual double rate() const = 0; virtual double rate() const = 0;
virtual void setRate(double) = 0; virtual void setRate(double) = 0;
virtual void setPoster(const KURL&) = 0;
enum NetworkState { Empty, Idle, Loading, Loaded, FormatError, NetworkError, DecodeError }; enum NetworkState { Empty, Idle, Loading, Loaded, FormatError, NetworkError, DecodeError };
virtual NetworkState networkState() const = 0; virtual NetworkState networkState() const = 0;
......
...@@ -205,6 +205,33 @@ void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF ...@@ -205,6 +205,33 @@ void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF
m_webMediaPlayer->load(loadType, kurl, corsMode); m_webMediaPlayer->load(loadType, kurl, corsMode);
} }
double WebMediaPlayerClientImpl::duration() const
{
if (m_webMediaPlayer)
return m_webMediaPlayer->duration();
return 0.0;
}
double WebMediaPlayerClientImpl::currentTime() const
{
if (m_webMediaPlayer)
return m_webMediaPlayer->currentTime();
return 0.0;
}
void WebMediaPlayerClientImpl::seek(double time)
{
if (m_webMediaPlayer)
m_webMediaPlayer->seek(time);
}
bool WebMediaPlayerClientImpl::seeking() const
{
if (m_webMediaPlayer)
return m_webMediaPlayer->seeking();
return false;
}
double WebMediaPlayerClientImpl::rate() const double WebMediaPlayerClientImpl::rate() const
{ {
return m_rate; return m_rate;
...@@ -217,6 +244,12 @@ void WebMediaPlayerClientImpl::setRate(double rate) ...@@ -217,6 +244,12 @@ void WebMediaPlayerClientImpl::setRate(double rate)
m_webMediaPlayer->setRate(rate); m_webMediaPlayer->setRate(rate);
} }
void WebMediaPlayerClientImpl::setPoster(const KURL& poster)
{
if (m_webMediaPlayer)
m_webMediaPlayer->setPoster(WebURL(poster));
}
MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const MediaPlayer::NetworkState WebMediaPlayerClientImpl::networkState() const
{ {
if (m_webMediaPlayer) if (m_webMediaPlayer)
......
...@@ -94,8 +94,13 @@ public: ...@@ -94,8 +94,13 @@ public:
// MediaPlayer methods: // MediaPlayer methods:
virtual WebMediaPlayer* webMediaPlayer() const OVERRIDE; virtual WebMediaPlayer* webMediaPlayer() const OVERRIDE;
virtual void load(WebMediaPlayer::LoadType, const WTF::String& url, WebMediaPlayer::CORSMode) OVERRIDE; virtual void load(WebMediaPlayer::LoadType, const WTF::String& url, WebMediaPlayer::CORSMode) OVERRIDE;
virtual double duration() const OVERRIDE;
virtual double currentTime() const OVERRIDE;
virtual void seek(double time) OVERRIDE;
virtual bool seeking() const OVERRIDE;
virtual double rate() const OVERRIDE; virtual double rate() const OVERRIDE;
virtual void setRate(double) OVERRIDE; virtual void setRate(double) OVERRIDE;
virtual void setPoster(const WebCore::KURL&) OVERRIDE;
virtual WebCore::MediaPlayer::NetworkState networkState() const OVERRIDE; virtual WebCore::MediaPlayer::NetworkState networkState() const OVERRIDE;
virtual WebCore::MediaPlayer::ReadyState readyState() const OVERRIDE; virtual WebCore::MediaPlayer::ReadyState readyState() const OVERRIDE;
virtual double maxTimeSeekable() const OVERRIDE; virtual double maxTimeSeekable() const OVERRIDE;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment