diff options
author | Andreas Huber <andih@google.com> | 2011-10-28 16:17:54 +0000 |
---|---|---|
committer | Android Git Automerger <android-git-automerger@android.com> | 2011-10-28 16:17:54 +0000 |
commit | d7a07f295a291496111b56a4886411c237ba6dc9 (patch) | |
tree | ab70a053878c6b511317e91790cfb0d824b3e641 /media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp | |
parent | 4b8bb4ee7d1d64dc1cd5478a3772f97e4a4a00d7 (diff) | |
parent | 841fa37451fb74f3d5978a15aab606bbb67e8c39 (diff) | |
download | frameworks_av-d7a07f295a291496111b56a4886411c237ba6dc9.zip frameworks_av-d7a07f295a291496111b56a4886411c237ba6dc9.tar.gz frameworks_av-d7a07f295a291496111b56a4886411c237ba6dc9.tar.bz2 |
am 27ed1249: Merge "Properly report that we\'re no longer playing after receiving event" into ics-mr1
* commit '27ed12492dfbec6ec67b66ff3cf60febce370b01':
Properly report that we're no longer playing after receiving event
Diffstat (limited to 'media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp')
-rw-r--r-- | media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp index b1e917d..452ba99 100644 --- a/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp +++ b/media/libmediaplayerservice/nuplayer/NuPlayerDriver.cpp @@ -35,6 +35,7 @@ NuPlayerDriver::NuPlayerDriver() mNumFramesDropped(0), mLooper(new ALooper), mState(UNINITIALIZED), + mAtEOS(false), mStartupSeekTimeUs(-1) { mLooper->setName("NuPlayerDriver Looper"); @@ -106,7 +107,7 @@ status_t NuPlayerDriver::prepare() { } status_t NuPlayerDriver::prepareAsync() { - sendEvent(MEDIA_PREPARED); + notifyListener(MEDIA_PREPARED); return OK; } @@ -117,6 +118,7 @@ status_t NuPlayerDriver::start() { return INVALID_OPERATION; case STOPPED: { + mAtEOS = false; mPlayer->start(); if (mStartupSeekTimeUs >= 0) { @@ -173,7 +175,7 @@ status_t NuPlayerDriver::pause() { } bool NuPlayerDriver::isPlaying() { - return mState == PLAYING; + return mState == PLAYING && !mAtEOS; } status_t NuPlayerDriver::seekTo(int msec) { @@ -190,6 +192,7 @@ status_t NuPlayerDriver::seekTo(int msec) { case PLAYING: case PAUSED: { + mAtEOS = false; mPlayer->seekToAsync(seekTimeUs); break; } @@ -291,7 +294,7 @@ void NuPlayerDriver::notifyPosition(int64_t positionUs) { } void NuPlayerDriver::notifySeekComplete() { - sendEvent(MEDIA_SEEK_COMPLETE); + notifyListener(MEDIA_SEEK_COMPLETE); } void NuPlayerDriver::notifyFrameStats( @@ -320,4 +323,12 @@ status_t NuPlayerDriver::dump(int fd, const Vector<String16> &args) const { return OK; } +void NuPlayerDriver::notifyListener(int msg, int ext1, int ext2) { + if (msg == MEDIA_PLAYBACK_COMPLETE || msg == MEDIA_ERROR) { + mAtEOS = true; + } + + sendEvent(msg, ext1, ext2); +} + } // namespace android |