diff options
author | Gloria Wang <gwang@google.com> | 2010-10-25 15:23:04 -0700 |
---|---|---|
committer | Gloria Wang <gwang@google.com> | 2010-10-25 16:11:18 -0700 |
commit | a9741a9232c81eaf59179acef91f5be46c42264e (patch) | |
tree | 9a66416b42a28ec2ad4fa2ec520c42d976046aec /media/libstagefright/AwesomePlayer.cpp | |
parent | d8cba5371423841e6a85816ad4a7fd88d3a60b12 (diff) | |
parent | dcd25efb46c41c8d24a0a9cf61fb57f84149709e (diff) | |
download | frameworks_av-a9741a9232c81eaf59179acef91f5be46c42264e.zip frameworks_av-a9741a9232c81eaf59179acef91f5be46c42264e.tar.gz frameworks_av-a9741a9232c81eaf59179acef91f5be46c42264e.tar.bz2 |
resolved conflicts for merge of 9084631d to gingerbread-plus-aosp
Change-Id: Ie2b675d50bfca3f33aee80f1a67c9f03d1f97472
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 064a00c..6eeab05 100644 --- a/media/libstagefright/AwesomePlayer.cpp +++ b/media/libstagefright/AwesomePlayer.cpp @@ -200,7 +200,8 @@ AwesomePlayer::AwesomePlayer() mExtractorFlags(0), mLastVideoBuffer(NULL), mVideoBuffer(NULL), - mSuspensionState(NULL) { + mSuspensionState(NULL), + mDecryptHandle(NULL) { CHECK_EQ(mClient.connect(), OK); DataSource::RegisterDefaultSniffers(); @@ -299,6 +300,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); } @@ -364,6 +376,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; } @@ -374,6 +391,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) { @@ -770,6 +796,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; } @@ -843,6 +876,11 @@ status_t AwesomePlayer::pause_l(bool at_eos) { mFlags &= ~PLAYING; + if (mDecryptHandle != NULL) { + mDrmManagerClient->setPlaybackStatus(mDecryptHandle, + Playback::PAUSE, 0); + } + return OK; } @@ -960,6 +998,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); + } } } @@ -1184,6 +1229,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; @@ -1554,6 +1606,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); } |