diff options
Diffstat (limited to 'media/libstagefright')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 13 | ||||
-rw-r--r-- | media/libstagefright/OggExtractor.cpp | 6 | ||||
-rw-r--r-- | media/libstagefright/include/AwesomePlayer.h | 1 |
3 files changed, 16 insertions, 4 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index c13726b..8507afc 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -330,6 +330,13 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) { } else if (!haveAudio && !strncasecmp(mime, "audio/", 6)) { setAudioSource(extractor->getTrack(i)); haveAudio = true; + + sp<MetaData> fileMeta = extractor->getMetaData(); + int32_t loop; + if (fileMeta != NULL + && fileMeta->findInt32(kKeyAutoLoop, &loop) && loop != 0) { + mFlags |= AUTO_LOOPING; + } } if (haveAudio && haveVideo) { @@ -587,7 +594,7 @@ void AwesomePlayer::onStreamDone() { return; } - if (mFlags & LOOPING) { + if (mFlags & (LOOPING | AUTO_LOOPING)) { seekTo_l(0); if (mVideoSource != NULL) { @@ -1560,7 +1567,7 @@ status_t AwesomePlayer::suspend() { state->mUriHeaders = mUriHeaders; state->mFileSource = mFileSource; - state->mFlags = mFlags & (PLAYING | LOOPING | AT_EOS); + state->mFlags = mFlags & (PLAYING | AUTO_LOOPING | LOOPING | AT_EOS); getPosition(&state->mPositionUs); if (mLastVideoBuffer) { @@ -1621,7 +1628,7 @@ status_t AwesomePlayer::resume() { seekTo_l(state->mPositionUs); - mFlags = state->mFlags & (LOOPING | AT_EOS); + mFlags = state->mFlags & (AUTO_LOOPING | LOOPING | AT_EOS); if (state->mLastVideoFrame && mISurface != NULL) { mVideoRenderer = diff --git a/media/libstagefright/OggExtractor.cpp b/media/libstagefright/OggExtractor.cpp index 2c1311a..7a8cf32 100644 --- a/media/libstagefright/OggExtractor.cpp +++ b/media/libstagefright/OggExtractor.cpp @@ -592,6 +592,7 @@ void MyVorbisExtractor::parseFileMetaData() { { "DATE", kKeyDate }, { "LYRICIST", kKeyWriter }, { "METADATA_BLOCK_PICTURE", kKeyAlbumArt }, + { "ANDROID_LOOP", kKeyAutoLoop }, }; for (int i = 0; i < mVc.comments; ++i) { @@ -605,12 +606,15 @@ void MyVorbisExtractor::parseFileMetaData() { extractAlbumArt( &comment[tagLen + 1], mVc.comment_lengths[i] - tagLen - 1); + } else if (kMap[j].mKey == kKeyAutoLoop) { + if (!strcasecmp(&comment[tagLen + 1], "true")) { + mFileMeta->setInt32(kKeyAutoLoop, true); + } } else { mFileMeta->setCString(kMap[j].mKey, &comment[tagLen + 1]); } } } - } #if 0 diff --git a/media/libstagefright/include/AwesomePlayer.h b/media/libstagefright/include/AwesomePlayer.h index f47deb8..1f3946c 100644 --- a/media/libstagefright/include/AwesomePlayer.h +++ b/media/libstagefright/include/AwesomePlayer.h @@ -106,6 +106,7 @@ private: CACHE_UNDERRUN = 128, AUDIO_AT_EOS = 256, VIDEO_AT_EOS = 512, + AUTO_LOOPING = 1024, }; mutable Mutex mLock; |