diff options
author | Insun Kang <insun@google.com> | 2012-07-24 14:44:06 +0900 |
---|---|---|
committer | Insun Kang <insun@google.com> | 2012-08-02 11:56:07 +0900 |
commit | c9729ca1cb1760da836e293e3ed7a82f769f3e07 (patch) | |
tree | 7e080db5914465b3f739f68ae9a21cef94646c9f /media/libstagefright/timedtext | |
parent | 6472badc497a9e748411f8c8c9ed5d83ef335a85 (diff) | |
download | frameworks_av-c9729ca1cb1760da836e293e3ed7a82f769f3e07.zip frameworks_av-c9729ca1cb1760da836e293e3ed7a82f769f3e07.tar.gz frameworks_av-c9729ca1cb1760da836e293e3ed7a82f769f3e07.tar.bz2 |
Unifying TimedTextDriver's resume() and start().
(cherry picked from gtv bb23a2b7e06c59f56e353fd4a2a66a9b8179d425)
Change-Id: If5f14549fa315c34e32d6fed7c1ea09deabceb63
Diffstat (limited to 'media/libstagefright/timedtext')
-rw-r--r-- | media/libstagefright/timedtext/TimedTextDriver.cpp | 41 |
1 files changed, 19 insertions, 22 deletions
diff --git a/media/libstagefright/timedtext/TimedTextDriver.cpp b/media/libstagefright/timedtext/TimedTextDriver.cpp index 71da803..54ce7ac 100644 --- a/media/libstagefright/timedtext/TimedTextDriver.cpp +++ b/media/libstagefright/timedtext/TimedTextDriver.cpp @@ -61,7 +61,7 @@ status_t TimedTextDriver::selectTrack_l(size_t index) { source = mTextSourceVector.valueFor(index); mPlayer->setDataSource(source); if (mState == UNINITIALIZED) { - mState = PAUSED; + mState = PREPARED; } mCurrentTrackIndex = index; return OK; @@ -74,22 +74,23 @@ status_t TimedTextDriver::start() { return INVALID_OPERATION; case PLAYING: return OK; - case PAUSED: + case PREPARED: mPlayer->start(); mState = PLAYING; return OK; + case PAUSED: + mPlayer->resume(); + mState = PLAYING; + return OK; default: TRESPASS(); } return UNKNOWN_ERROR; } -// TODO: Test if pause() works properly. -// Scenario 1: start - pause - resume -// Scenario 2: start - seek -// Scenario 3: start - pause - seek - resume status_t TimedTextDriver::pause() { Mutex::Autolock autoLock(mLock); + ALOGV("%s() is called", __FUNCTION__); switch (mState) { case UNINITIALIZED: return INVALID_OPERATION; @@ -97,24 +98,9 @@ status_t TimedTextDriver::pause() { mPlayer->pause(); mState = PAUSED; return OK; - case PAUSED: - return OK; - default: - TRESPASS(); - } - return UNKNOWN_ERROR; -} - -status_t TimedTextDriver::resume() { - Mutex::Autolock autoLock(mLock); - switch (mState) { - case UNINITIALIZED: + case PREPARED: return INVALID_OPERATION; - case PLAYING: - return OK; case PAUSED: - mPlayer->resume(); - mState = PLAYING; return OK; default: TRESPASS(); @@ -125,8 +111,10 @@ status_t TimedTextDriver::resume() { status_t TimedTextDriver::selectTrack(size_t index) { status_t ret = OK; Mutex::Autolock autoLock(mLock); + ALOGV("%s() is called", __FUNCTION__); switch (mState) { case UNINITIALIZED: + case PREPARED: case PAUSED: ret = selectTrack_l(index); break; @@ -146,6 +134,7 @@ status_t TimedTextDriver::selectTrack(size_t index) { status_t TimedTextDriver::unselectTrack(size_t index) { Mutex::Autolock autoLock(mLock); + ALOGV("%s() is called", __FUNCTION__); if (mCurrentTrackIndex != index) { return INVALID_OPERATION; } @@ -156,6 +145,7 @@ status_t TimedTextDriver::unselectTrack(size_t index) { mPlayer->pause(); mState = UNINITIALIZED; return OK; + case PREPARED: case PAUSED: mState = UNINITIALIZED; return OK; @@ -167,11 +157,18 @@ status_t TimedTextDriver::unselectTrack(size_t index) { status_t TimedTextDriver::seekToAsync(int64_t timeUs) { Mutex::Autolock autoLock(mLock); + ALOGV("%s() is called", __FUNCTION__); switch (mState) { case UNINITIALIZED: return INVALID_OPERATION; + case PREPARED: + mPlayer->seekToAsync(timeUs); + mPlayer->pause(); + mState = PAUSED; + return OK; case PAUSED: mPlayer->seekToAsync(timeUs); + mPlayer->pause(); return OK; case PLAYING: mPlayer->seekToAsync(timeUs); |