From bafb682ec7f51486e751fea954169deb91846063 Mon Sep 17 00:00:00 2001 From: Jeff Tinker Date: Fri, 22 Mar 2013 15:26:39 -0700 Subject: Load crypto plugins from additional shared libraries Currently crypto plugins are expected to be in libdrmdecrypt.so. When there are multiple plugins supporting different schemes, this approach requires source code integration across vendors which is unmanagable. Also, for integration with MediaDrm where the crypto keys are obtained from a drm server, the MediaCrypto plugin needs to interoperate with the MediaDrm plugin. This change allows {MediaCrypto, MediaDrm} pairs that are logically related to be implemented in a common shared library. Change-Id: I7f6638f29171f91609fc2d944396365568630b56 --- media/libmediaplayerservice/Crypto.h | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) (limited to 'media/libmediaplayerservice/Crypto.h') diff --git a/media/libmediaplayerservice/Crypto.h b/media/libmediaplayerservice/Crypto.h index d066774..c44ae34 100644 --- a/media/libmediaplayerservice/Crypto.h +++ b/media/libmediaplayerservice/Crypto.h @@ -20,6 +20,9 @@ #include #include +#include + +#include "SharedLibrary.h" namespace android { @@ -32,7 +35,7 @@ struct Crypto : public BnCrypto { virtual status_t initCheck() const; - virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]) const; + virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]); virtual status_t createPlugin( const uint8_t uuid[16], const void *data, size_t size); @@ -56,11 +59,17 @@ private: mutable Mutex mLock; status_t mInitCheck; - void *mLibHandle; + sp mLibrary; CryptoFactory *mFactory; CryptoPlugin *mPlugin; - status_t init(); + static KeyedVector, String8> mUUIDToLibraryPathMap; + static KeyedVector > mLibraryPathToOpenLibraryMap; + static Mutex mMapLock; + + void findFactoryForScheme(const uint8_t uuid[16]); + bool loadLibraryForScheme(const String8 &path, const uint8_t uuid[16]); + void closeFactory(); DISALLOW_EVIL_CONSTRUCTORS(Crypto); }; -- cgit v1.1