summaryrefslogtreecommitdiffstats
path: root/drm/libdrmframework
diff options
context:
space:
mode:
authorJames Dong <jdong@google.com>2012-01-10 08:24:37 -0800
committerJames Dong <jdong@google.com>2012-01-12 16:25:12 -0800
commit9d2f386dd2885eaffa11fd494ae258bb09fe6397 (patch)
tree382639f8cc7f1a3677589d7dfca37b667ea4261c /drm/libdrmframework
parent83bc7f3cf78b28a818417f40a4f0c00593993366 (diff)
downloadframeworks_av-9d2f386dd2885eaffa11fd494ae258bb09fe6397.zip
frameworks_av-9d2f386dd2885eaffa11fd494ae258bb09fe6397.tar.gz
frameworks_av-9d2f386dd2885eaffa11fd494ae258bb09fe6397.tar.bz2
Separate sniffing from session initialization
This avoid lengthy/duplicate sniffing for drm plugins when a decrypt session is opened o The change is backward compatibile in that no update is required for existing drm plug-ins if they do not plan to provide separate sniffer/extractor related-to-bug: 5725548 Change-Id: I7fc4caf82d77472da4e2bc7b5d31060fb54fd84c
Diffstat (limited to 'drm/libdrmframework')
-rw-r--r--drm/libdrmframework/DrmManagerClient.cpp14
-rw-r--r--drm/libdrmframework/DrmManagerClientImpl.cpp12
-rw-r--r--drm/libdrmframework/include/DrmManager.h5
-rw-r--r--drm/libdrmframework/include/DrmManagerClientImpl.h8
-rw-r--r--drm/libdrmframework/include/DrmManagerService.h6
-rw-r--r--drm/libdrmframework/include/IDrmManagerService.h14
-rw-r--r--drm/libdrmframework/plugins/common/include/DrmEngineBase.h51
-rw-r--r--drm/libdrmframework/plugins/common/include/IDrmEngine.h10
8 files changed, 96 insertions, 24 deletions
diff --git a/drm/libdrmframework/DrmManagerClient.cpp b/drm/libdrmframework/DrmManagerClient.cpp
index c9c0d57..8768c08 100644
--- a/drm/libdrmframework/DrmManagerClient.cpp
+++ b/drm/libdrmframework/DrmManagerClient.cpp
@@ -116,12 +116,18 @@ status_t DrmManagerClient::getAllSupportInfo(int* length, DrmSupportInfo** drmSu
return mDrmManagerClientImpl->getAllSupportInfo(mUniqueId, length, drmSupportInfoArray);
}
-sp<DecryptHandle> DrmManagerClient::openDecryptSession(int fd, off64_t offset, off64_t length) {
- return mDrmManagerClientImpl->openDecryptSession(mUniqueId, fd, offset, length);
+sp<DecryptHandle> DrmManagerClient::openDecryptSession(
+ int fd, off64_t offset, off64_t length, const char* mime) {
+
+ return mDrmManagerClientImpl->openDecryptSession(
+ mUniqueId, fd, offset, length, mime);
}
-sp<DecryptHandle> DrmManagerClient::openDecryptSession(const char* uri) {
- return mDrmManagerClientImpl->openDecryptSession(mUniqueId, uri);
+sp<DecryptHandle> DrmManagerClient::openDecryptSession(
+ const char* uri, const char* mime) {
+
+ return mDrmManagerClientImpl->openDecryptSession(
+ mUniqueId, uri, mime);
}
status_t DrmManagerClient::closeDecryptSession(sp<DecryptHandle> &decryptHandle) {
diff --git a/drm/libdrmframework/DrmManagerClientImpl.cpp b/drm/libdrmframework/DrmManagerClientImpl.cpp
index b222b8f..fb0439e 100644
--- a/drm/libdrmframework/DrmManagerClientImpl.cpp
+++ b/drm/libdrmframework/DrmManagerClientImpl.cpp
@@ -255,15 +255,19 @@ status_t DrmManagerClientImpl::getAllSupportInfo(
}
sp<DecryptHandle> DrmManagerClientImpl::openDecryptSession(
- int uniqueId, int fd, off64_t offset, off64_t length) {
- return getDrmManagerService()->openDecryptSession(uniqueId, fd, offset, length);
+ int uniqueId, int fd, off64_t offset,
+ off64_t length, const char* mime) {
+
+ return getDrmManagerService()->openDecryptSession(
+ uniqueId, fd, offset, length, mime);
}
sp<DecryptHandle> DrmManagerClientImpl::openDecryptSession(
- int uniqueId, const char* uri) {
+ int uniqueId, const char* uri, const char* mime) {
+
DecryptHandle* handle = NULL;
if (NULL != uri) {
- handle = getDrmManagerService()->openDecryptSession(uniqueId, uri);
+ handle = getDrmManagerService()->openDecryptSession(uniqueId, uri, mime);
}
return handle;
}
diff --git a/drm/libdrmframework/include/DrmManager.h b/drm/libdrmframework/include/DrmManager.h
index ac2b946..c9167d4 100644
--- a/drm/libdrmframework/include/DrmManager.h
+++ b/drm/libdrmframework/include/DrmManager.h
@@ -111,9 +111,10 @@ public:
status_t getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray);
- DecryptHandle* openDecryptSession(int uniqueId, int fd, off64_t offset, off64_t length);
+ DecryptHandle* openDecryptSession(
+ int uniqueId, int fd, off64_t offset, off64_t length, const char* mime);
- DecryptHandle* openDecryptSession(int uniqueId, const char* uri);
+ DecryptHandle* openDecryptSession(int uniqueId, const char* uri, const char* mime);
status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
diff --git a/drm/libdrmframework/include/DrmManagerClientImpl.h b/drm/libdrmframework/include/DrmManagerClientImpl.h
index e3338d9..2aa493f 100644
--- a/drm/libdrmframework/include/DrmManagerClientImpl.h
+++ b/drm/libdrmframework/include/DrmManagerClientImpl.h
@@ -300,20 +300,24 @@ public:
* @param[in] fd File descriptor of the protected content to be decrypted
* @param[in] offset Start position of the content
* @param[in] length The length of the protected content
+ * @param[in] mime The mime type of the protected content if it is not NULL or empty
* @return
* Handle for the decryption session
*/
- sp<DecryptHandle> openDecryptSession(int uniqueId, int fd, off64_t offset, off64_t length);
+ sp<DecryptHandle> openDecryptSession(
+ int uniqueId, int fd, off64_t offset, off64_t length, const char* mime);
/**
* Open the decrypt session to decrypt the given protected content
*
* @param[in] uniqueId Unique identifier for a session
* @param[in] uri Path of the protected content to be decrypted
+ * @param[in] mime The mime type of the protected content if it is not NULL or empty
* @return
* Handle for the decryption session
*/
- sp<DecryptHandle> openDecryptSession(int uniqueId, const char* uri);
+ sp<DecryptHandle> openDecryptSession(
+ int uniqueId, const char* uri, const char* mime);
/**
* Close the decrypt session for the given handle
diff --git a/drm/libdrmframework/include/DrmManagerService.h b/drm/libdrmframework/include/DrmManagerService.h
index 9cb5804..1a8c2ae 100644
--- a/drm/libdrmframework/include/DrmManagerService.h
+++ b/drm/libdrmframework/include/DrmManagerService.h
@@ -98,9 +98,11 @@ public:
status_t getAllSupportInfo(int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray);
- DecryptHandle* openDecryptSession(int uniqueId, int fd, off64_t offset, off64_t length);
+ DecryptHandle* openDecryptSession(
+ int uniqueId, int fd, off64_t offset, off64_t length, const char *mime);
- DecryptHandle* openDecryptSession(int uniqueId, const char* uri);
+ DecryptHandle* openDecryptSession(
+ int uniqueId, const char* uri, const char* mime);
status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
diff --git a/drm/libdrmframework/include/IDrmManagerService.h b/drm/libdrmframework/include/IDrmManagerService.h
index b9618bb..a7d21c5 100644
--- a/drm/libdrmframework/include/IDrmManagerService.h
+++ b/drm/libdrmframework/include/IDrmManagerService.h
@@ -139,9 +139,12 @@ public:
virtual status_t getAllSupportInfo(
int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray) = 0;
- virtual DecryptHandle* openDecryptSession(int uniqueId, int fd, off64_t offset, off64_t length) = 0;
+ virtual DecryptHandle* openDecryptSession(
+ int uniqueId, int fd, off64_t offset,
+ off64_t length, const char* mime) = 0;
- virtual DecryptHandle* openDecryptSession(int uniqueId, const char* uri) = 0;
+ virtual DecryptHandle* openDecryptSession(
+ int uniqueId, const char* uri, const char* mime) = 0;
virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) = 0;
@@ -222,9 +225,12 @@ public:
virtual status_t getAllSupportInfo(
int uniqueId, int* length, DrmSupportInfo** drmSupportInfoArray);
- virtual DecryptHandle* openDecryptSession(int uniqueId, int fd, off64_t offset, off64_t length);
+ virtual DecryptHandle* openDecryptSession(
+ int uniqueId, int fd, off64_t offset, off64_t length,
+ const char* mime);
- virtual DecryptHandle* openDecryptSession(int uniqueId, const char* uri);
+ virtual DecryptHandle* openDecryptSession(
+ int uniqueId, const char* uri, const char* mime);
virtual status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
diff --git a/drm/libdrmframework/plugins/common/include/DrmEngineBase.h b/drm/libdrmframework/plugins/common/include/DrmEngineBase.h
index 4a5afcf..08f6e6d 100644
--- a/drm/libdrmframework/plugins/common/include/DrmEngineBase.h
+++ b/drm/libdrmframework/plugins/common/include/DrmEngineBase.h
@@ -80,10 +80,12 @@ public:
DrmSupportInfo* getSupportInfo(int uniqueId);
status_t openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length);
+ int uniqueId, DecryptHandle* decryptHandle,
+ int fd, off64_t offset, off64_t length, const char* mime);
status_t openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, const char* uri);
+ int uniqueId, DecryptHandle* decryptHandle,
+ const char* uri, const char* mime);
status_t closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle);
@@ -375,7 +377,29 @@ protected:
* DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
*/
virtual status_t onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length) = 0;
+ int uniqueId, DecryptHandle* decryptHandle,
+ int fd, off64_t offset, off64_t length) = 0;
+
+ /**
+ * Open the decrypt session to decrypt the given protected content
+ *
+ * @param[in] uniqueId Unique identifier for a session
+ * @param[in] decryptHandle Handle for the current decryption session
+ * @param[in] fd File descriptor of the protected content to be decrypted
+ * @param[in] offset Start position of the content
+ * @param[in] length The length of the protected content
+ * @param[in] mime Mime type of the protected content
+ * drm plugin may do some optimization since the mime type is known.
+ * @return
+ * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
+ */
+ virtual status_t onOpenDecryptSession(
+ int uniqueId, DecryptHandle* decryptHandle,
+ int fd, off64_t offset, off64_t length,
+ const char* mime) {
+
+ return DRM_ERROR_CANNOT_HANDLE;
+ }
/**
* Open the decrypt session to decrypt the given protected content
@@ -387,7 +411,26 @@ protected:
* DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
*/
virtual status_t onOpenDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, const char* uri) = 0;
+ int uniqueId, DecryptHandle* decryptHandle,
+ const char* uri) = 0;
+
+ /**
+ * Open the decrypt session to decrypt the given protected content
+ *
+ * @param[in] uniqueId Unique identifier for a session
+ * @param[in] decryptHandle Handle for the current decryption session
+ * @param[in] uri Path of the protected content to be decrypted
+ * @param[in] mime Mime type of the protected content. The corresponding
+ * drm plugin may do some optimization since the mime type is known.
+ * @return
+ * DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
+ */
+ virtual status_t onOpenDecryptSession(
+ int uniqueId, DecryptHandle* decryptHandle,
+ const char* uri, const char* mime) {
+
+ return DRM_ERROR_CANNOT_HANDLE;
+ }
/**
* Close the decrypt session for the given handle
diff --git a/drm/libdrmframework/plugins/common/include/IDrmEngine.h b/drm/libdrmframework/plugins/common/include/IDrmEngine.h
index 77460f6..dcf5977 100644
--- a/drm/libdrmframework/plugins/common/include/IDrmEngine.h
+++ b/drm/libdrmframework/plugins/common/include/IDrmEngine.h
@@ -320,11 +320,14 @@ public:
* @param[in] fd File descriptor of the protected content to be decrypted
* @param[in] offset Start position of the content
* @param[in] length The length of the protected content
+ * @param[in] mime Mime type of the protected content if it is
+ * not NULL or empty
* @return
* DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
*/
virtual status_t openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length) = 0;
+ int uniqueId, DecryptHandle* decryptHandle,
+ int fd, off64_t offset, off64_t length, const char* mime) = 0;
/**
* Open the decrypt session to decrypt the given protected content
@@ -332,11 +335,14 @@ public:
* @param[in] uniqueId Unique identifier for a session
* @param[in] decryptHandle Handle for the current decryption session
* @param[in] uri Path of the protected content to be decrypted
+ * @param[in] mime Mime type of the protected content if it is
+ * not NULL or empty
* @return
* DRM_ERROR_CANNOT_HANDLE for failure and DRM_NO_ERROR for success
*/
virtual status_t openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, const char* uri) = 0;
+ int uniqueId, DecryptHandle* decryptHandle,
+ const char* uri, const char* mime) = 0;
/**
* Close the decrypt session for the given handle