summaryrefslogtreecommitdiffstats
path: root/drm/common
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/common
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/common')
-rw-r--r--drm/common/DrmEngineBase.cpp18
-rw-r--r--drm/common/IDrmManagerService.cpp25
2 files changed, 34 insertions, 9 deletions
diff --git a/drm/common/DrmEngineBase.cpp b/drm/common/DrmEngineBase.cpp
index 9b16c36..1c345a2 100644
--- a/drm/common/DrmEngineBase.cpp
+++ b/drm/common/DrmEngineBase.cpp
@@ -120,13 +120,23 @@ DrmSupportInfo* DrmEngineBase::getSupportInfo(int uniqueId) {
}
status_t DrmEngineBase::openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, int fd, off64_t offset, off64_t length) {
- return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length);
+ int uniqueId, DecryptHandle* decryptHandle,
+ int fd, off64_t offset, off64_t length, const char* mime) {
+
+ if (!mime || mime[0] == '\0') {
+ return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length);
+ }
+
+ return onOpenDecryptSession(uniqueId, decryptHandle, fd, offset, length, mime);
}
status_t DrmEngineBase::openDecryptSession(
- int uniqueId, DecryptHandle* decryptHandle, const char* uri) {
- return onOpenDecryptSession(uniqueId, decryptHandle, uri);
+ int uniqueId, DecryptHandle* decryptHandle,
+ const char* uri, const char* mime) {
+ if (!mime || mime[0] == '\0') {
+ return onOpenDecryptSession(uniqueId, decryptHandle, uri);
+ }
+ return onOpenDecryptSession(uniqueId, decryptHandle, uri, mime);
}
status_t DrmEngineBase::closeDecryptSession(int uniqueId, DecryptHandle* decryptHandle) {
diff --git a/drm/common/IDrmManagerService.cpp b/drm/common/IDrmManagerService.cpp
index 3ed8ade..43f64f2 100644
--- a/drm/common/IDrmManagerService.cpp
+++ b/drm/common/IDrmManagerService.cpp
@@ -600,7 +600,7 @@ status_t BpDrmManagerService::getAllSupportInfo(
}
DecryptHandle* BpDrmManagerService::openDecryptSession(
- int uniqueId, int fd, off64_t offset, off64_t length) {
+ int uniqueId, int fd, off64_t offset, off64_t length, const char* mime) {
ALOGV("Entering BpDrmManagerService::openDecryptSession");
Parcel data, reply;
@@ -609,6 +609,11 @@ DecryptHandle* BpDrmManagerService::openDecryptSession(
data.writeFileDescriptor(fd);
data.writeInt64(offset);
data.writeInt64(length);
+ String8 mimeType;
+ if (mime) {
+ mimeType = mime;
+ }
+ data.writeString8(mimeType);
remote()->transact(OPEN_DECRYPT_SESSION, data, &reply);
@@ -620,13 +625,20 @@ DecryptHandle* BpDrmManagerService::openDecryptSession(
return handle;
}
-DecryptHandle* BpDrmManagerService::openDecryptSession(int uniqueId, const char* uri) {
- ALOGV("Entering BpDrmManagerService::openDecryptSession");
+DecryptHandle* BpDrmManagerService::openDecryptSession(
+ int uniqueId, const char* uri, const char* mime) {
+
+ ALOGV("Entering BpDrmManagerService::openDecryptSession: mime=%s", mime? mime: "NULL");
Parcel data, reply;
data.writeInterfaceToken(IDrmManagerService::getInterfaceDescriptor());
data.writeInt32(uniqueId);
data.writeString8(String8(uri));
+ String8 mimeType;
+ if (mime) {
+ mimeType = mime;
+ }
+ data.writeString8(mimeType);
remote()->transact(OPEN_DECRYPT_SESSION_FROM_URI, data, &reply);
@@ -1265,8 +1277,10 @@ status_t BnDrmManagerService::onTransact(
const off64_t offset = data.readInt64();
const off64_t length = data.readInt64();
+ const String8 mime = data.readString8();
+
DecryptHandle* handle
- = openDecryptSession(uniqueId, fd, offset, length);
+ = openDecryptSession(uniqueId, fd, offset, length, mime.string());
if (NULL != handle) {
writeDecryptHandleToParcelData(handle, reply);
@@ -1283,8 +1297,9 @@ status_t BnDrmManagerService::onTransact(
const int uniqueId = data.readInt32();
const String8 uri = data.readString8();
+ const String8 mime = data.readString8();
- DecryptHandle* handle = openDecryptSession(uniqueId, uri.string());
+ DecryptHandle* handle = openDecryptSession(uniqueId, uri.string(), mime.string());
if (NULL != handle) {
writeDecryptHandleToParcelData(handle, reply);