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

Commit dddb4326 authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "MediaPlayer: add notifyAt at native side"

parents 1841755b 52c2851b
Loading
Loading
Loading
Loading
+15 −0
Original line number Diff line number Diff line
@@ -58,6 +58,7 @@ enum {
    GET_CURRENT_POSITION,
    GET_DURATION,
    RESET,
    NOTIFY_AT,
    SET_AUDIO_STREAM_TYPE,
    SET_LOOPING,
    SET_VOLUME,
@@ -328,6 +329,15 @@ public:
        return reply.readInt32();
    }

    status_t notifyAt(int64_t mediaTimeUs)
    {
        Parcel data, reply;
        data.writeInterfaceToken(IMediaPlayer::getInterfaceDescriptor());
        data.writeInt64(mediaTimeUs);
        remote()->transact(NOTIFY_AT, data, &reply);
        return reply.readInt32();
    }

    status_t setAudioStreamType(audio_stream_type_t stream)
    {
        Parcel data, reply;
@@ -746,6 +756,11 @@ status_t BnMediaPlayer::onTransact(
            reply->writeInt32(reset());
            return NO_ERROR;
        } break;
        case NOTIFY_AT: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(notifyAt(data.readInt64()));
            return NO_ERROR;
        } break;
        case SET_AUDIO_STREAM_TYPE: {
            CHECK_INTERFACE(IMediaPlayer, data, reply);
            reply->writeInt32(setAudioStreamType((audio_stream_type_t) data.readInt32()));
+1 −0
Original line number Diff line number Diff line
@@ -79,6 +79,7 @@ public:
            MediaPlayerSeekMode mode = MediaPlayerSeekMode::SEEK_PREVIOUS_SYNC) = 0;
    virtual status_t        getCurrentPosition(int* msec) = 0;
    virtual status_t        getDuration(int* msec) = 0;
    virtual status_t        notifyAt(int64_t mediaTimeUs) = 0;
    virtual status_t        reset() = 0;
    virtual status_t        setAudioStreamType(audio_stream_type_t type) = 0;
    virtual status_t        setLooping(int loop) = 0;
+2 −0
Original line number Diff line number Diff line
@@ -50,6 +50,7 @@ enum media_event_type {
    MEDIA_PAUSED            = 7,
    MEDIA_STOPPED           = 8,
    MEDIA_SKIPPED           = 9,
    MEDIA_NOTIFY_TIME       = 98,
    MEDIA_TIMED_TEXT        = 99,
    MEDIA_ERROR             = 100,
    MEDIA_INFO              = 200,
@@ -245,6 +246,7 @@ public:
            status_t        seekTo(
                    int msec,
                    MediaPlayerSeekMode mode = MediaPlayerSeekMode::SEEK_PREVIOUS_SYNC);
            status_t        notifyAt(int64_t mediaTimeUs);
            status_t        getCurrentPosition(int *msec);
            status_t        getDuration(int *msec);
            status_t        reset();
+12 −0
Original line number Diff line number Diff line
@@ -610,6 +610,15 @@ status_t MediaPlayer::seekTo(int msec, MediaPlayerSeekMode mode)
    return result;
}

status_t MediaPlayer::notifyAt(int64_t mediaTimeUs)
{
    Mutex::Autolock _l(mLock);
    if (mPlayer != 0) {
        return mPlayer->notifyAt(mediaTimeUs);
    }
    return INVALID_OPERATION;
}

status_t MediaPlayer::reset_l()
{
    mLoop = false;
@@ -950,6 +959,9 @@ void MediaPlayer::notify(int msg, int ext1, int ext2, const Parcel *obj)
        mVideoWidth = ext1;
        mVideoHeight = ext2;
        break;
    case MEDIA_NOTIFY_TIME:
        ALOGV("Received notify time message");
        break;
    case MEDIA_TIMED_TEXT:
        ALOGV("Received timed text message");
        break;
+8 −0
Original line number Diff line number Diff line
@@ -1269,6 +1269,14 @@ status_t MediaPlayerService::Client::reset()
    return p->reset();
}

status_t MediaPlayerService::Client::notifyAt(int64_t mediaTimeUs)
{
    ALOGV("[%d] notifyAt(%lld)", mConnId, (long long)mediaTimeUs);
    sp<MediaPlayerBase> p = getPlayer();
    if (p == 0) return UNKNOWN_ERROR;
    return p->notifyAt(mediaTimeUs);
}

status_t MediaPlayerService::Client::setAudioStreamType(audio_stream_type_t type)
{
    ALOGV("[%d] setAudioStreamType(%d)", mConnId, type);
Loading