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/libmedia/IHDCP.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/libmedia/IHDCP.cpp')
-rw-r--r-- | media/libmedia/IHDCP.cpp | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/media/libmedia/IHDCP.cpp b/media/libmedia/IHDCP.cpp index 493f5a4..f13addc 100644 --- a/media/libmedia/IHDCP.cpp +++ b/media/libmedia/IHDCP.cpp @@ -31,6 +31,7 @@ enum { HDCP_INIT_ASYNC, HDCP_SHUTDOWN_ASYNC, HDCP_ENCRYPT, + HDCP_DECRYPT, }; struct BpHDCPObserver : public BpInterface<IHDCPObserver> { @@ -106,6 +107,29 @@ struct BpHDCP : public BpInterface<IHDCP> { return err; } + + virtual status_t decrypt( + const void *inData, size_t size, + uint32_t streamCTR, uint64_t inputCTR, + void *outData) { + Parcel data, reply; + data.writeInterfaceToken(IHDCP::getInterfaceDescriptor()); + data.writeInt32(size); + data.write(inData, size); + data.writeInt32(streamCTR); + data.writeInt64(inputCTR); + remote()->transact(HDCP_DECRYPT, data, &reply); + + status_t err = reply.readInt32(); + + if (err != OK) { + return err; + } + + reply.read(outData, size); + + return err; + } }; IMPLEMENT_META_INTERFACE(HDCP, "android.hardware.IHDCP"); @@ -198,6 +222,31 @@ status_t BnHDCP::onTransact( return OK; } + case HDCP_DECRYPT: + { + size_t size = data.readInt32(); + + void *inData = malloc(2 * size); + void *outData = (uint8_t *)inData + size; + + data.read(inData, size); + + uint32_t streamCTR = data.readInt32(); + uint64_t inputCTR = data.readInt64(); + status_t err = decrypt(inData, size, streamCTR, inputCTR, outData); + + reply->writeInt32(err); + + if (err == OK) { + reply->write(outData, size); + } + + free(inData); + inData = outData = NULL; + + return OK; + } + default: return BBinder::onTransact(code, data, reply, flags); } |