Add CryptoPluginMode to WV extractor

Allows the WV extractor to run in a mode that is compatible with
the DRM CryptoPlugin HAL API, where decryption is deferred
until the encrypted data is sent through the CryptoPlugin to
the codec.

This patch does:
 (1) Adds a flag mCryptoPluginMode that controls this behavior
     [Note: need framework support to enable/disable this]
 (2) Accumulates information in track metadata to delineate
     crypto unit boundaries for the CryptoPlugin

related-to-bug: 5986621

Change-Id: I3318d5cde38c7b02a7bdb56aca9aece852c9781c
This commit is contained in:
Jeff Tinker
2012-04-13 00:01:05 -07:00
parent aaa8479c34
commit a9f82e979f
8 changed files with 105 additions and 44 deletions

View File

@@ -98,7 +98,8 @@ WVMExtractorImpl::WVMExtractorImpl(sp<DataSource> dataSource)
mIsLiveStream(false),
mSession(NULL),
mSetupStatus(OK),
mUIDIsSet(false)
mUIDIsSet(false),
mCryptoPluginMode(false)
{
dataSource->getDrmInfo(sDecryptHandle, &sDrmManagerClient);
@@ -340,12 +341,18 @@ status_t WVMExtractorImpl::readMetaData()
mVideoSource->delegateDataSource(mDataSource);
mFileMetaData->setCString(kKeyMIMEType, "video/mp4");
mFileMetaData->setCString(kKeyMIMEType, "video/wvm");
mHaveMetaData = true;
mInfoListener->configureHeartbeat();
if (mCryptoPluginMode) {
// In crypto plugin mode, need to trigger the drm plugin to begin
// license use on playback since the media player isn't involved.
sDrmManagerClient->setPlaybackStatus(sDecryptHandle, Playback::START, 0);
}
return OK;
}
@@ -514,6 +521,18 @@ bool WVMExtractorImpl::getAdaptiveStreamingMode() const
return mUseAdaptiveStreaming;
}
void WVMExtractorImpl::setCryptoPluginMode(bool cryptoPluginMode)
{
//ALOGD("WVMExtractorImpl::setCryptoPluginMode(%d)", cryptoPluginMode);
mCryptoPluginMode = cryptoPluginMode;
}
bool WVMExtractorImpl::getCryptoPluginMode() const
{
//ALOGD("WVMExtractorImpl::getCryptoPluginMode - %d", mCryptoPluginMode);
return mCryptoPluginMode;
}
void WVMExtractorImpl::setUID(uid_t uid)
{
//ALOGD("WVMExtractorImpl::setUID(%d)", (uint32_t)uid);