am 8e11c822: am 9fee0b2a: Ogg files can be tagged to be automatically looping, this setting always overrides the MediaPlayer\'s setLooping setting.
Merge commit '8e11c82247151085fa165c76bfbc157bc6091ca4'
* commit '8e11c82247151085fa165c76bfbc157bc6091ca4':
Ogg files can be tagged to be automatically looping, this setting always overrides the MediaPlayer's setLooping setting.
diff --git a/include/media/stagefright/MetaData.h b/include/media/stagefright/MetaData.h
index 0b6201c..1e447f1 100644
--- a/include/media/stagefright/MetaData.h
+++ b/include/media/stagefright/MetaData.h
@@ -92,6 +92,8 @@
kKeyNotRealTime = 'ntrt', // bool (int32_t)
+ // Ogg files can be tagged to be automatically looping...
+ kKeyAutoLoop = 'autL', // bool (int32_t)
};
enum {
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp
index d6456da..fd5f30b 100644
--- a/media/libstagefright/AwesomePlayer.cpp
+++ b/media/libstagefright/AwesomePlayer.cpp
@@ -333,6 +333,13 @@
} 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) {
@@ -590,7 +597,7 @@
return;
}
- if (mFlags & LOOPING) {
+ if (mFlags & (LOOPING | AUTO_LOOPING)) {
seekTo_l(0);
if (mVideoSource != NULL) {
@@ -1582,7 +1589,7 @@
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) {
@@ -1643,7 +1650,7 @@
seekTo_l(state->mPositionUs);
- mFlags = state->mFlags & (LOOPING | AT_EOS);
+ mFlags = state->mFlags & (AUTO_LOOPING | LOOPING | AT_EOS);
if (state->mLastVideoFrame && (mSurface != NULL || 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 @@
{ "DATE", kKeyDate },
{ "LYRICIST", kKeyWriter },
{ "METADATA_BLOCK_PICTURE", kKeyAlbumArt },
+ { "ANDROID_LOOP", kKeyAutoLoop },
};
for (int i = 0; i < mVc.comments; ++i) {
@@ -605,12 +606,15 @@
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 d4338c6..ea2f7d5 100644
--- a/media/libstagefright/include/AwesomePlayer.h
+++ b/media/libstagefright/include/AwesomePlayer.h
@@ -107,6 +107,7 @@
CACHE_UNDERRUN = 128,
AUDIO_AT_EOS = 256,
VIDEO_AT_EOS = 512,
+ AUTO_LOOPING = 1024,
};
mutable Mutex mLock;