diff options
author | Gloria Wang <gwang@google.com> | 2010-10-25 16:56:49 -0700 |
---|---|---|
committer | Gloria Wang <gwang@google.com> | 2010-10-25 16:56:49 -0700 |
commit | aceaaf303422bbe3a7b8d9cdb96495dbf8109c23 (patch) | |
tree | 567006154374135f6747dd8a81288d3b5570c11f /media/libstagefright/AwesomePlayer.cpp | |
parent | 4cd5c79858d5c8508dffdcba5a0fcb941a39cbef (diff) | |
parent | a9741a9232c81eaf59179acef91f5be46c42264e (diff) | |
download | frameworks_av-aceaaf303422bbe3a7b8d9cdb96495dbf8109c23.zip frameworks_av-aceaaf303422bbe3a7b8d9cdb96495dbf8109c23.tar.gz frameworks_av-aceaaf303422bbe3a7b8d9cdb96495dbf8109c23.tar.bz2 |
resolved conflicts for merge of 965f960e to master
Change-Id: I63cec8ffb3593216da1de03428134d89e75b9338
Diffstat (limited to 'media/libstagefright/AwesomePlayer.cpp')
-rw-r--r-- | media/libstagefright/AwesomePlayer.cpp | 65 |
1 files changed, 64 insertions, 1 deletions
diff --git a/media/libstagefright/AwesomePlayer.cpp b/media/libstagefright/AwesomePlayer.cpp index 8c6c963..cf04e92 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -232,7 +232,8 @@ AwesomePlayer::AwesomePlayer() mExtractorFlags(0), mLastVideoBuffer(NULL), mVideoBuffer(NULL), - mSuspensionState(NULL) { + mSuspensionState(NULL), + mDecryptHandle(NULL) { CHECK_EQ(mClient.connect(), OK); DataSource::RegisterDefaultSniffers(); @@ -331,6 +332,17 @@ status_t AwesomePlayer::setDataSource_l( return UNKNOWN_ERROR; } + dataSource->getDrmInfo(&mDecryptHandle, &mDrmManagerClient); + if (mDecryptHandle != NULL) { + if (RightsStatus::RIGHTS_VALID == mDecryptHandle->status) { + if (DecryptApiType::CONTAINER_BASED == mDecryptHandle->decryptApiType) { + mDrmManagerClient->consumeRights(mDecryptHandle, Action::PLAY, true); + } + } else { + notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_NO_LICENSE); + } + } + return setDataSource_l(extractor); } @@ -396,6 +408,11 @@ status_t AwesomePlayer::setDataSource_l(const sp<MediaExtractor> &extractor) { } mExtractorFlags = extractor->flags(); + if (mDecryptHandle != NULL) { + if (DecryptApiType::ELEMENTARY_STREAM_BASED == mDecryptHandle->decryptApiType) { + mDrmManagerClient->consumeRights(mDecryptHandle, Action::PLAY, true); + } + } return OK; } @@ -406,6 +423,15 @@ void AwesomePlayer::reset() { } void AwesomePlayer::reset_l() { + if (mDecryptHandle != NULL) { + mDrmManagerClient->setPlaybackStatus(mDecryptHandle, + Playback::STOP, 0); + mDrmManagerClient->consumeRights(mDecryptHandle, + Action::PLAY, false); + mDecryptHandle = NULL; + mDrmManagerClient = NULL; + } + if (mFlags & PREPARING) { mFlags |= PREPARE_CANCELLED; if (mConnectingDataSource != NULL) { @@ -808,6 +834,13 @@ status_t AwesomePlayer::play_l() { seekTo_l(0); } + if (mDecryptHandle != NULL) { + int64_t position; + getPosition(&position); + mDrmManagerClient->setPlaybackStatus(mDecryptHandle, + Playback::START, position / 1000); + } + return OK; } @@ -901,6 +934,11 @@ status_t AwesomePlayer::pause_l(bool at_eos) { mFlags &= ~PLAYING; + if (mDecryptHandle != NULL) { + mDrmManagerClient->setPlaybackStatus(mDecryptHandle, + Playback::PAUSE, 0); + } + return OK; } @@ -1024,6 +1062,13 @@ void AwesomePlayer::seekAudioIfNecessary_l() { mWatchForAudioSeekComplete = true; mWatchForAudioEOS = true; mSeekNotificationSent = false; + + if (mDecryptHandle != NULL) { + mDrmManagerClient->setPlaybackStatus(mDecryptHandle, + Playback::PAUSE, 0); + mDrmManagerClient->setPlaybackStatus(mDecryptHandle, + Playback::START, mSeekTimeUs / 1000); + } } } @@ -1250,6 +1295,13 @@ void AwesomePlayer::onVideoEvent() { TimeSource *ts = (mFlags & AUDIO_AT_EOS) ? &mSystemTimeSource : mTimeSource; + if (mDecryptHandle != NULL) { + mDrmManagerClient->setPlaybackStatus(mDecryptHandle, + Playback::PAUSE, 0); + mDrmManagerClient->setPlaybackStatus(mDecryptHandle, + Playback::START, timeUs / 1000); + } + if (mFlags & FIRST_FRAME) { mFlags &= ~FIRST_FRAME; @@ -1620,6 +1672,17 @@ status_t AwesomePlayer::finishSetDataSource_l() { return UNKNOWN_ERROR; } + dataSource->getDrmInfo(&mDecryptHandle, &mDrmManagerClient); + if (mDecryptHandle != NULL) { + if (RightsStatus::RIGHTS_VALID == mDecryptHandle->status) { + if (DecryptApiType::CONTAINER_BASED == mDecryptHandle->decryptApiType) { + mDrmManagerClient->consumeRights(mDecryptHandle, Action::PLAY, true); + } + } else { + notifyListener_l(MEDIA_ERROR, MEDIA_ERROR_UNKNOWN, ERROR_NO_LICENSE); + } + } + return setDataSource_l(extractor); } |