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

Commit 7b7f17dc authored by Andreas Huber's avatar Andreas Huber Committed by Android Git Automerger
Browse files

am b7c8e918: Add support for HLS playlists of type \'event\'.

* commit 'b7c8e918':
  Add support for HLS playlists of type 'event'.
parents 5d7b2778 b7c8e918
Loading
Loading
Loading
Loading
+5 −0
Original line number Diff line number Diff line
@@ -73,6 +73,11 @@ struct IStreamListener : public IInterface {
    // ATSParser::DiscontinuityType.
    static const char *const kKeyDiscontinuityMask;

    // Optionally signalled as part of a discontinuity that includes
    // DISCONTINUITY_TIME. It indicates the media time (in us) to be associated
    // with the next PTS occuring in the stream. The value is of type int64_t.
    static const char *const kKeyMediaTimeUs;

    virtual void issueCommand(
            Command cmd, bool synchronous, const sp<AMessage> &msg = NULL) = 0;
};
+0 −1
Original line number Diff line number Diff line
@@ -249,7 +249,6 @@ private:
    sp<MediaPlayerListener>     mListener;
    void*                       mCookie;
    media_player_states         mCurrentState;
    int                         mDuration;
    int                         mCurrentPosition;
    int                         mSeekPosition;
    bool                        mPrepareSync;
+3 −0
Original line number Diff line number Diff line
@@ -32,6 +32,9 @@ const char *const IStreamListener::kKeyResumeAtPTS = "resume-at-PTS";
// static
const char *const IStreamListener::kKeyDiscontinuityMask = "discontinuity-mask";

// static
const char *const IStreamListener::kKeyMediaTimeUs = "media-time-us";

enum {
    // IStreamSource
    SET_LISTENER = IBinder::FIRST_CALL_TRANSACTION,
+24 −12
Original line number Diff line number Diff line
@@ -47,7 +47,6 @@ MediaPlayer::MediaPlayer()
    ALOGV("constructor");
    mListener = NULL;
    mCookie = NULL;
    mDuration = -1;
    mStreamType = AUDIO_STREAM_MUSIC;
    mCurrentPosition = -1;
    mSeekPosition = -1;
@@ -90,7 +89,6 @@ void MediaPlayer::disconnect()
// always call with lock held
void MediaPlayer::clear_l()
{
    mDuration = -1;
    mCurrentPosition = -1;
    mSeekPosition = -1;
    mVideoWidth = mVideoHeight = 0;
@@ -395,14 +393,14 @@ status_t MediaPlayer::getCurrentPosition(int *msec)

status_t MediaPlayer::getDuration_l(int *msec)
{
    ALOGV("getDuration");
    ALOGV("getDuration_l");
    bool isValidState = (mCurrentState & (MEDIA_PLAYER_PREPARED | MEDIA_PLAYER_STARTED | MEDIA_PLAYER_PAUSED | MEDIA_PLAYER_STOPPED | MEDIA_PLAYER_PLAYBACK_COMPLETE));
    if (mPlayer != 0 && isValidState) {
        status_t ret = NO_ERROR;
        if (mDuration <= 0)
            ret = mPlayer->getDuration(&mDuration);
        if (msec)
            *msec = mDuration;
        int durationMs;
        status_t ret = mPlayer->getDuration(&durationMs);
        if (msec) {
            *msec = durationMs;
        }
        return ret;
    }
    ALOGE("Attempt to call getDuration without a valid mediaplayer");
@@ -422,14 +420,28 @@ status_t MediaPlayer::seekTo_l(int msec)
        if ( msec < 0 ) {
            ALOGW("Attempt to seek to invalid position: %d", msec);
            msec = 0;
        } else if ((mDuration > 0) && (msec > mDuration)) {
            ALOGW("Attempt to seek to past end of file: request = %d, EOF = %d", msec, mDuration);
            msec = mDuration;
        }

        int durationMs;
        status_t err = mPlayer->getDuration(&durationMs);

        if (err != OK) {
            ALOGW("Stream has no duration and is therefore not seekable.");
            return err;
        }

        if (msec > durationMs) {
            ALOGW("Attempt to seek to past end of file: request = %d, "
                  "durationMs = %d",
                  msec,
                  durationMs);

            msec = durationMs;
        }

        // cache duration
        mCurrentPosition = msec;
        if (mSeekPosition < 0) {
            getDuration_l(NULL);
            mSeekPosition = msec;
            return mPlayer->seekTo(msec);
        }
+2 −2
Original line number Diff line number Diff line
@@ -258,8 +258,8 @@ void NuPlayer::GenericSource::readBuffer(
    }
}

bool NuPlayer::GenericSource::isSeekable() {
    return true;
uint32_t NuPlayer::GenericSource::flags() const {
    return FLAG_SEEKABLE;
}

}  // namespace android
Loading