Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 1ab9d128 authored by Andreas Huber's avatar Andreas Huber Committed by Android Git Automerger
Browse files

am 8e11c822: am 9fee0b2a: Ogg files can be tagged to be automatically looping,...

am 8e11c822: am 9fee0b2a: Ogg files can be tagged to be automatically looping, this setting always overrides the MediaPlayer\'s setLooping setting.

Merge commit '8e11c822'

* commit '8e11c822':
  Ogg files can be tagged to be automatically looping, this setting always overrides the MediaPlayer's setLooping setting.
parents a093659d 8e11c822
Loading
Loading
Loading
Loading
+2 −0
Original line number Original line Diff line number Diff line
@@ -92,6 +92,8 @@ enum {


    kKeyNotRealTime       = 'ntrt',  // bool (int32_t)
    kKeyNotRealTime       = 'ntrt',  // bool (int32_t)


    // Ogg files can be tagged to be automatically looping...
    kKeyAutoLoop          = 'autL',  // bool (int32_t)
};
};


enum {
enum {
+10 −3
Original line number Original line Diff line number Diff line
@@ -333,6 +333,13 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) {
        } else if (!haveAudio && !strncasecmp(mime, "audio/", 6)) {
        } else if (!haveAudio && !strncasecmp(mime, "audio/", 6)) {
            setAudioSource(extractor->getTrack(i));
            setAudioSource(extractor->getTrack(i));
            haveAudio = true;
            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) {
        if (haveAudio && haveVideo) {
@@ -590,7 +597,7 @@ void AwesomePlayer::onStreamDone() {
        return;
        return;
    }
    }


    if (mFlags & LOOPING) {
    if (mFlags & (LOOPING | AUTO_LOOPING)) {
        seekTo_l(0);
        seekTo_l(0);


        if (mVideoSource != NULL) {
        if (mVideoSource != NULL) {
@@ -1582,7 +1589,7 @@ status_t AwesomePlayer::suspend() {
    state->mUriHeaders = mUriHeaders;
    state->mUriHeaders = mUriHeaders;
    state->mFileSource = mFileSource;
    state->mFileSource = mFileSource;


    state->mFlags = mFlags & (PLAYING | LOOPING | AT_EOS);
    state->mFlags = mFlags & (PLAYING | AUTO_LOOPING | LOOPING | AT_EOS);
    getPosition(&state->mPositionUs);
    getPosition(&state->mPositionUs);


    if (mLastVideoBuffer) {
    if (mLastVideoBuffer) {
@@ -1643,7 +1650,7 @@ status_t AwesomePlayer::resume() {


    seekTo_l(state->mPositionUs);
    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)) {
    if (state->mLastVideoFrame && (mSurface != NULL || mISurface != NULL)) {
        mVideoRenderer =
        mVideoRenderer =
+5 −1
Original line number Original line Diff line number Diff line
@@ -592,6 +592,7 @@ void MyVorbisExtractor::parseFileMetaData() {
        { "DATE", kKeyDate },
        { "DATE", kKeyDate },
        { "LYRICIST", kKeyWriter },
        { "LYRICIST", kKeyWriter },
        { "METADATA_BLOCK_PICTURE", kKeyAlbumArt },
        { "METADATA_BLOCK_PICTURE", kKeyAlbumArt },
        { "ANDROID_LOOP", kKeyAutoLoop },
    };
    };


    for (int i = 0; i < mVc.comments; ++i) {
    for (int i = 0; i < mVc.comments; ++i) {
@@ -605,12 +606,15 @@ void MyVorbisExtractor::parseFileMetaData() {
                    extractAlbumArt(
                    extractAlbumArt(
                            &comment[tagLen + 1],
                            &comment[tagLen + 1],
                            mVc.comment_lengths[i] - 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 {
                } else {
                    mFileMeta->setCString(kMap[j].mKey, &comment[tagLen + 1]);
                    mFileMeta->setCString(kMap[j].mKey, &comment[tagLen + 1]);
                }
                }
            }
            }
        }
        }

    }
    }


#if 0
#if 0
+1 −0
Original line number Original line Diff line number Diff line
@@ -107,6 +107,7 @@ private:
        CACHE_UNDERRUN      = 128,
        CACHE_UNDERRUN      = 128,
        AUDIO_AT_EOS        = 256,
        AUDIO_AT_EOS        = 256,
        VIDEO_AT_EOS        = 512,
        VIDEO_AT_EOS        = 512,
        AUTO_LOOPING        = 1024,
    };
    };


    mutable Mutex mLock;
    mutable Mutex mLock;