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

Commit 692ac36c authored by James Dong's avatar James Dong
Browse files

Make timed text source type explicit in TimedTextDriver

o related-to-bug: 5542712

Change-Id: Ifdc730e616336e8b16783e8a5766f27df62a0592
parent 52bef17f
Loading
Loading
Loading
Loading
+6 −1
Original line number Diff line number Diff line
@@ -68,6 +68,11 @@ private:
        PAUSED,
    };

    enum TextSourceType {
        TEXT_SOURCE_TYPE_IN_BAND = 0,
        TEXT_SOURCE_TYPE_OUT_OF_BAND,
    };

    sp<ALooper> mLooper;
    sp<TimedTextPlayer> mPlayer;
    wp<MediaPlayerBase> mListener;
@@ -76,7 +81,7 @@ private:
    State mState;
    size_t mCurrentTrackIndex;
    KeyedVector<size_t, sp<TimedTextSource> > mTextSourceVector;
    Vector<bool> mTextSourceTypeVector;
    Vector<TextSourceType> mTextSourceTypeVector;

    // -- End of variables to be guarded by mLock

+4 −4
Original line number Diff line number Diff line
@@ -154,7 +154,7 @@ status_t TimedTextDriver::addInBandTextSource(
    }
    Mutex::Autolock autoLock(mLock);
    mTextSourceVector.add(trackIndex, source);
    mTextSourceTypeVector.add(true);
    mTextSourceTypeVector.add(TEXT_SOURCE_TYPE_IN_BAND);
    return OK;
}

@@ -206,14 +206,14 @@ status_t TimedTextDriver::createOutOfBandTextSource(

    Mutex::Autolock autoLock(mLock);
    mTextSourceVector.add(trackIndex, source);
    mTextSourceTypeVector.add(false);
    mTextSourceTypeVector.add(TEXT_SOURCE_TYPE_OUT_OF_BAND);
    return OK;
}

size_t TimedTextDriver::countExternalTracks() const {
    size_t nTracks = 0;
    for (size_t i = 0, n = mTextSourceTypeVector.size(); i < n; ++i) {
        if (!mTextSourceTypeVector[i]) {
        if (mTextSourceTypeVector[i] == TEXT_SOURCE_TYPE_OUT_OF_BAND) {
            ++nTracks;
        }
    }
@@ -223,7 +223,7 @@ size_t TimedTextDriver::countExternalTracks() const {
void TimedTextDriver::getExternalTrackInfo(Parcel *parcel) {
    Mutex::Autolock autoLock(mLock);
    for (size_t i = 0, n = mTextSourceTypeVector.size(); i < n; ++i) {
        if (mTextSourceTypeVector[i]) {
        if (mTextSourceTypeVector[i] == TEXT_SOURCE_TYPE_IN_BAND) {
            continue;
        }