Commit ee175426 authored by srirama.m@samsung.com's avatar srirama.m@samsung.com

Eliminate MediaPlayer & MediaPlayerClient abstractions(seek, duration, poster APIs)

Bug=350571

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175546 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent a37d69ec
...@@ -1834,7 +1834,7 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState) ...@@ -1834,7 +1834,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
m_player->seek(time); webMediaPlayer()->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.
...@@ -1874,7 +1874,10 @@ bool HTMLMediaElement::seeking() const ...@@ -1874,7 +1874,10 @@ bool HTMLMediaElement::seeking() const
void HTMLMediaElement::refreshCachedTime() const void HTMLMediaElement::refreshCachedTime() const
{ {
m_cachedTime = m_player->currentTime(); if (!webMediaPlayer())
return;
m_cachedTime = webMediaPlayer()->currentTime();
m_cachedTimeWallClockUpdateTime = WTF::currentTime(); m_cachedTimeWallClockUpdateTime = WTF::currentTime();
} }
...@@ -1898,7 +1901,7 @@ double HTMLMediaElement::currentTime() const ...@@ -1898,7 +1901,7 @@ double HTMLMediaElement::currentTime() const
static const double minCachedDeltaForWarning = 0.01; static const double minCachedDeltaForWarning = 0.01;
#endif #endif
if (!m_player) if (!m_player || !webMediaPlayer())
return 0; return 0;
if (m_seeking) { if (m_seeking) {
...@@ -1908,7 +1911,7 @@ double HTMLMediaElement::currentTime() const ...@@ -1908,7 +1911,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 - m_player->currentTime(); double delta = m_cachedTime - webMediaPlayer()->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
...@@ -1947,7 +1950,7 @@ double HTMLMediaElement::duration() const ...@@ -1947,7 +1950,7 @@ double HTMLMediaElement::duration() const
if (m_mediaSource) if (m_mediaSource)
return m_mediaSource->duration(); return m_mediaSource->duration();
return m_player->duration(); return webMediaPlayer()->duration();
} }
bool HTMLMediaElement::paused() const bool HTMLMediaElement::paused() const
...@@ -2763,7 +2766,7 @@ void HTMLMediaElement::mediaPlayerTimeChanged() ...@@ -2763,7 +2766,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 && !m_player->seeking()) if (m_seeking && m_readyState >= HAVE_CURRENT_DATA && !webMediaPlayer()->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 (player()) if (webMediaPlayer())
player()->setPoster(posterImageURL()); webMediaPlayer()->setPoster(posterImageURL());
} else } else
HTMLMediaElement::parseAttribute(name, value); HTMLMediaElement::parseAttribute(name, value);
} }
......
...@@ -112,19 +112,9 @@ public: ...@@ -112,19 +112,9 @@ 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,33 +205,6 @@ void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF ...@@ -205,33 +205,6 @@ 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;
...@@ -244,12 +217,6 @@ void WebMediaPlayerClientImpl::setRate(double rate) ...@@ -244,12 +217,6 @@ 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,13 +94,8 @@ public: ...@@ -94,13 +94,8 @@ 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