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

Eliminate MediaPlayer & MediaPlayerClient abstractions(play/pause, other APIs)

BUG=350571

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

git-svn-id: svn://svn.chromium.org/blink/trunk@175508 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 07e67f51
...@@ -1733,7 +1733,7 @@ void HTMLMediaElement::addPlayedRange(double start, double end) ...@@ -1733,7 +1733,7 @@ void HTMLMediaElement::addPlayedRange(double start, double end)
bool HTMLMediaElement::supportsSave() const bool HTMLMediaElement::supportsSave() const
{ {
return m_player ? m_player->supportsSave() : false; return webMediaPlayer() && webMediaPlayer()->supportsSave();
} }
void HTMLMediaElement::prepareToPlay() void HTMLMediaElement::prepareToPlay()
...@@ -1789,12 +1789,13 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState) ...@@ -1789,12 +1789,13 @@ void HTMLMediaElement::seek(double time, ExceptionState& exceptionState)
// time scale, we will ask the media engine to "seek" to the current movie time, which may be a noop and // time scale, we will ask the media engine to "seek" to the current movie time, which may be a noop and
// not generate a timechanged callback. This means m_seeking will never be cleared and we will never // not generate a timechanged callback. This means m_seeking will never be cleared and we will never
// fire a 'seeked' event. // fire a 'seeked' event.
double mediaTime = webMediaPlayer()->mediaTimeForTimeValue(time);
if (time != mediaTime) {
#if !LOG_DISABLED #if !LOG_DISABLED
double mediaTime = m_player->mediaTimeForTimeValue(time);
if (time != mediaTime)
WTF_LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime); WTF_LOG(Media, "HTMLMediaElement::seek(%f) - media timeline equivalent is %f", time, mediaTime);
#endif #endif
time = m_player->mediaTimeForTimeValue(time); time = mediaTime;
}
// 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the // 7 - If the (possibly now changed) new playback position is not in one of the ranges given in the
// seekable attribute, then let it be the position in one of the ranges given in the seekable attribute // seekable attribute, then let it be the position in one of the ranges given in the seekable attribute
...@@ -2839,7 +2840,7 @@ void HTMLMediaElement::mediaPlayerPlaybackStateChanged() ...@@ -2839,7 +2840,7 @@ void HTMLMediaElement::mediaPlayerPlaybackStateChanged()
if (!m_player || m_pausedInternal) if (!m_player || m_pausedInternal)
return; return;
if (m_player->paused()) if (webMediaPlayer()->paused())
pause(); pause();
else else
playInternal(); playInternal();
...@@ -3005,8 +3006,8 @@ void HTMLMediaElement::updatePlayState() ...@@ -3005,8 +3006,8 @@ void HTMLMediaElement::updatePlayState()
return; return;
if (m_pausedInternal) { if (m_pausedInternal) {
if (!m_player->paused()) if (webMediaPlayer() && !webMediaPlayer()->paused())
m_player->pause(); webMediaPlayer()->pause();
refreshCachedTime(); refreshCachedTime();
m_playbackProgressTimer.stop(); m_playbackProgressTimer.stop();
if (hasMediaControls()) if (hasMediaControls())
...@@ -3015,7 +3016,7 @@ void HTMLMediaElement::updatePlayState() ...@@ -3015,7 +3016,7 @@ void HTMLMediaElement::updatePlayState()
} }
bool shouldBePlaying = potentiallyPlaying(); bool shouldBePlaying = potentiallyPlaying();
bool playerPaused = m_player->paused(); bool playerPaused = webMediaPlayer() && webMediaPlayer()->paused();
WTF_LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, playerPaused = %s", WTF_LOG(Media, "HTMLMediaElement::updatePlayState - shouldBePlaying = %s, playerPaused = %s",
boolString(shouldBePlaying), boolString(playerPaused)); boolString(shouldBePlaying), boolString(playerPaused));
...@@ -3029,8 +3030,7 @@ void HTMLMediaElement::updatePlayState() ...@@ -3029,8 +3030,7 @@ void HTMLMediaElement::updatePlayState()
// The media engine should just stash the rate and muted values since it isn't already playing. // The media engine should just stash the rate and muted values since it isn't already playing.
m_player->setRate(m_playbackRate); m_player->setRate(m_playbackRate);
updateVolume(); updateVolume();
webMediaPlayer()->play();
m_player->play();
} }
if (hasMediaControls()) if (hasMediaControls())
...@@ -3039,8 +3039,8 @@ void HTMLMediaElement::updatePlayState() ...@@ -3039,8 +3039,8 @@ void HTMLMediaElement::updatePlayState()
m_playing = true; m_playing = true;
} else { // Should not be playing right now } else { // Should not be playing right now
if (!playerPaused) if (!playerPaused && webMediaPlayer())
m_player->pause(); webMediaPlayer()->pause();
refreshCachedTime(); refreshCachedTime();
m_playbackProgressTimer.stop(); m_playbackProgressTimer.stop();
......
...@@ -234,7 +234,7 @@ public: ...@@ -234,7 +234,7 @@ public:
// of one of them here. // of one of them here.
virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return HTMLElement::executionContext(); } virtual ExecutionContext* executionContext() const OVERRIDE FINAL { return HTMLElement::executionContext(); }
bool hasSingleSecurityOrigin() const { return !m_player || m_player->hasSingleSecurityOrigin(); } bool hasSingleSecurityOrigin() const { return webMediaPlayer() && webMediaPlayer()->hasSingleSecurityOrigin(); }
bool isFullscreen() const; bool isFullscreen() const;
void enterFullscreen(); void enterFullscreen();
......
...@@ -112,11 +112,6 @@ public: ...@@ -112,11 +112,6 @@ 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 void play() = 0;
virtual void pause() = 0;
virtual bool supportsSave() const = 0;
virtual double duration() const = 0; virtual double duration() const = 0;
virtual double currentTime() const = 0; virtual double currentTime() const = 0;
...@@ -128,8 +123,6 @@ public: ...@@ -128,8 +123,6 @@ public:
virtual double rate() const = 0; virtual double rate() const = 0;
virtual void setRate(double) = 0; virtual void setRate(double) = 0;
virtual bool paused() const = 0;
virtual void setPoster(const KURL&) = 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 };
...@@ -149,12 +142,6 @@ public: ...@@ -149,12 +142,6 @@ public:
enum Preload { None, MetaData, Auto }; enum Preload { None, MetaData, Auto };
virtual void setPreload(Preload) = 0; virtual void setPreload(Preload) = 0;
virtual bool hasSingleSecurityOrigin() const = 0;
// Time value in the movie's time scale. It is only necessary to override this if the media
// engine uses rational numbers to represent media time.
virtual double mediaTimeForTimeValue(double timeValue) const = 0;
#if ENABLE(WEB_AUDIO) #if ENABLE(WEB_AUDIO)
virtual AudioSourceProvider* audioSourceProvider() = 0; virtual AudioSourceProvider* audioSourceProvider() = 0;
#endif #endif
......
...@@ -205,18 +205,6 @@ void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF ...@@ -205,18 +205,6 @@ void WebMediaPlayerClientImpl::load(WebMediaPlayer::LoadType loadType, const WTF
m_webMediaPlayer->load(loadType, kurl, corsMode); m_webMediaPlayer->load(loadType, kurl, corsMode);
} }
void WebMediaPlayerClientImpl::play()
{
if (m_webMediaPlayer)
m_webMediaPlayer->play();
}
void WebMediaPlayerClientImpl::pause()
{
if (m_webMediaPlayer)
m_webMediaPlayer->pause();
}
double WebMediaPlayerClientImpl::duration() const double WebMediaPlayerClientImpl::duration() const
{ {
if (m_webMediaPlayer) if (m_webMediaPlayer)
...@@ -256,20 +244,6 @@ void WebMediaPlayerClientImpl::setRate(double rate) ...@@ -256,20 +244,6 @@ void WebMediaPlayerClientImpl::setRate(double rate)
m_webMediaPlayer->setRate(rate); m_webMediaPlayer->setRate(rate);
} }
bool WebMediaPlayerClientImpl::paused() const
{
if (m_webMediaPlayer)
return m_webMediaPlayer->paused();
return false;
}
bool WebMediaPlayerClientImpl::supportsSave() const
{
if (m_webMediaPlayer)
return m_webMediaPlayer->supportsSave();
return false;
}
void WebMediaPlayerClientImpl::setPoster(const KURL& poster) void WebMediaPlayerClientImpl::setPoster(const KURL& poster)
{ {
if (m_webMediaPlayer) if (m_webMediaPlayer)
...@@ -346,20 +320,6 @@ void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload) ...@@ -346,20 +320,6 @@ void WebMediaPlayerClientImpl::setPreload(MediaPlayer::Preload preload)
m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preload)); m_webMediaPlayer->setPreload(static_cast<WebMediaPlayer::Preload>(preload));
} }
bool WebMediaPlayerClientImpl::hasSingleSecurityOrigin() const
{
if (m_webMediaPlayer)
return m_webMediaPlayer->hasSingleSecurityOrigin();
return false;
}
double WebMediaPlayerClientImpl::mediaTimeForTimeValue(double timeValue) const
{
if (m_webMediaPlayer)
return m_webMediaPlayer->mediaTimeForTimeValue(timeValue);
return timeValue;
}
#if ENABLE(WEB_AUDIO) #if ENABLE(WEB_AUDIO)
AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider() AudioSourceProvider* WebMediaPlayerClientImpl::audioSourceProvider()
{ {
......
...@@ -94,16 +94,12 @@ public: ...@@ -94,16 +94,12 @@ 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 void play() OVERRIDE;
virtual void pause() OVERRIDE;
virtual bool supportsSave() const OVERRIDE;
virtual double duration() const OVERRIDE; virtual double duration() const OVERRIDE;
virtual double currentTime() const OVERRIDE; virtual double currentTime() const OVERRIDE;
virtual void seek(double time) OVERRIDE; virtual void seek(double time) OVERRIDE;
virtual bool seeking() const 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 bool paused() const OVERRIDE;
virtual void setPoster(const WebCore::KURL&) 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;
...@@ -113,8 +109,6 @@ public: ...@@ -113,8 +109,6 @@ public:
virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&) OVERRIDE; virtual void paint(WebCore::GraphicsContext*, const WebCore::IntRect&) OVERRIDE;
virtual bool copyVideoTextureToPlatformTexture(WebGraphicsContext3D*, Platform3DObject texture, GLint level, GLenum type, GLenum internalFormat, bool premultiplyAlpha, bool flipY) OVERRIDE; virtual bool copyVideoTextureToPlatformTexture(WebGraphicsContext3D*, Platform3DObject texture, GLint level, GLenum type, GLenum internalFormat, bool premultiplyAlpha, bool flipY) OVERRIDE;
virtual void setPreload(WebCore::MediaPlayer::Preload) OVERRIDE; virtual void setPreload(WebCore::MediaPlayer::Preload) OVERRIDE;
virtual bool hasSingleSecurityOrigin() const OVERRIDE;
virtual double mediaTimeForTimeValue(double timeValue) const OVERRIDE;
#if ENABLE(WEB_AUDIO) #if ENABLE(WEB_AUDIO)
virtual WebCore::AudioSourceProvider* audioSourceProvider() OVERRIDE; virtual WebCore::AudioSourceProvider* audioSourceProvider() 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