diff options
author | Andreas Huber <andih@google.com> | 2013-01-30 10:41:25 -0800 |
---|---|---|
committer | Andreas Huber <andih@google.com> | 2013-01-30 10:41:25 -0800 |
commit | a6a88d9c445e261972c2433254e0a996336e78a4 (patch) | |
tree | 3bcb34c468d9f0f525fb68dbb237e5b709a03465 /media/libmediaplayerservice/HDCP.cpp | |
parent | 1bd947a7c99853ad4ee67d59db89524be1e5acfc (diff) | |
download | frameworks_av-a6a88d9c445e261972c2433254e0a996336e78a4.zip frameworks_av-a6a88d9c445e261972c2433254e0a996336e78a4.tar.gz frameworks_av-a6a88d9c445e261972c2433254e0a996336e78a4.tar.bz2 |
Plumbing to reflect minor changes in the HDCP module API that allow for
support of _decryption_ modules in addition to what we already supported.
Change-Id: Ic37b87dc170ba8def3817991d25df798f21e950b
Diffstat (limited to 'media/libmediaplayerservice/HDCP.cpp')
-rw-r--r-- | media/libmediaplayerservice/HDCP.cpp | 26 |
1 files changed, 23 insertions, 3 deletions
diff --git a/media/libmediaplayerservice/HDCP.cpp b/media/libmediaplayerservice/HDCP.cpp index 09b9719..469a02e 100644 --- a/media/libmediaplayerservice/HDCP.cpp +++ b/media/libmediaplayerservice/HDCP.cpp @@ -26,8 +26,9 @@ namespace android { -HDCP::HDCP() - : mLibHandle(NULL), +HDCP::HDCP(bool createEncryptionModule) + : mIsEncryptionModule(createEncryptionModule), + mLibHandle(NULL), mHDCPModule(NULL) { mLibHandle = dlopen("libstagefright_hdcp.so", RTLD_NOW); @@ -40,7 +41,10 @@ HDCP::HDCP() void *, HDCPModule::ObserverFunc); CreateHDCPModuleFunc createHDCPModule = - (CreateHDCPModuleFunc)dlsym(mLibHandle, "createHDCPModule"); + mIsEncryptionModule + ? (CreateHDCPModuleFunc)dlsym(mLibHandle, "createHDCPModule") + : (CreateHDCPModuleFunc)dlsym( + mLibHandle, "createHDCPModuleForDecryption"); if (createHDCPModule == NULL) { ALOGE("Unable to find symbol 'createHDCPModule'."); @@ -101,6 +105,8 @@ status_t HDCP::encrypt( uint64_t *outInputCTR, void *outData) { Mutex::Autolock autoLock(mLock); + CHECK(mIsEncryptionModule); + if (mHDCPModule == NULL) { *outInputCTR = 0; @@ -110,6 +116,20 @@ status_t HDCP::encrypt( return mHDCPModule->encrypt(inData, size, streamCTR, outInputCTR, outData); } +status_t HDCP::decrypt( + const void *inData, size_t size, + uint32_t streamCTR, uint64_t outInputCTR, void *outData) { + Mutex::Autolock autoLock(mLock); + + CHECK(!mIsEncryptionModule); + + if (mHDCPModule == NULL) { + return NO_INIT; + } + + return mHDCPModule->decrypt(inData, size, streamCTR, outInputCTR, outData); +} + // static void HDCP::ObserveWrapper(void *me, int msg, int ext1, int ext2) { static_cast<HDCP *>(me)->observe(msg, ext1, ext2); |