Loading include/media/ICrypto.h +2 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ namespace android { struct AString; struct IMemory; struct ICrypto : public IInterface { DECLARE_META_INTERFACE(Crypto); Loading @@ -48,7 +49,7 @@ struct ICrypto : public IInterface { const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const sp<IMemory> &sharedBuffer, size_t offset, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg) = 0; Loading include/media/stagefright/MediaCodec.h +5 −1 Original line number Diff line number Diff line Loading @@ -30,8 +30,10 @@ struct AMessage; struct AReplyToken; struct AString; struct CodecBase; struct ICrypto; struct IBatteryStats; struct ICrypto; struct IMemory; struct MemoryDealer; struct SoftwareRenderer; struct Surface; Loading Loading @@ -214,6 +216,7 @@ private: uint32_t mBufferID; sp<ABuffer> mData; sp<ABuffer> mEncryptedData; sp<IMemory> mSharedEncryptedBuffer; sp<AMessage> mNotify; sp<AMessage> mFormat; bool mOwnedByClient; Loading @@ -232,6 +235,7 @@ private: sp<AMessage> mOutputFormat; sp<AMessage> mInputFormat; sp<AMessage> mCallback; sp<MemoryDealer> mDealer; bool mBatteryStatNotified; bool mIsVideo; Loading media/libmedia/ICrypto.cpp +15 −9 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <utils/Log.h> #include <binder/Parcel.h> #include <binder/IMemory.h> #include <media/ICrypto.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/foundation/ADebug.h> Loading Loading @@ -97,7 +98,7 @@ struct BpCrypto : public BpInterface<ICrypto> { const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const sp<IMemory> &sharedBuffer, size_t offset, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg) { Loading Loading @@ -126,7 +127,8 @@ struct BpCrypto : public BpInterface<ICrypto> { } data.writeInt32(totalSize); data.write(srcPtr, totalSize); data.writeStrongBinder(IInterface::asBinder(sharedBuffer)); data.writeInt32(offset); data.writeInt32(numSubSamples); data.write(subSamples, sizeof(CryptoPlugin::SubSample) * numSubSamples); Loading Loading @@ -245,8 +247,9 @@ status_t BnCrypto::onTransact( data.read(iv, sizeof(iv)); size_t totalSize = data.readInt32(); void *srcData = malloc(totalSize); data.read(srcData, totalSize); sp<IMemory> sharedBuffer = interface_cast<IMemory>(data.readStrongBinder()); int32_t offset = data.readInt32(); int32_t numSubSamples = data.readInt32(); Loading @@ -265,15 +268,21 @@ status_t BnCrypto::onTransact( } AString errorDetailMsg; ssize_t result = decrypt( ssize_t result; if (offset + totalSize > sharedBuffer->size()) { result = -EINVAL; } else { result = decrypt( secure, key, iv, mode, srcData, sharedBuffer, offset, subSamples, numSubSamples, dstPtr, &errorDetailMsg); } reply->writeInt32(result); Loading @@ -294,9 +303,6 @@ status_t BnCrypto::onTransact( delete[] subSamples; subSamples = NULL; free(srcData); srcData = NULL; return OK; } Loading media/libmediaplayerservice/Crypto.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "Crypto.h" #include <binder/IMemory.h> #include <media/hardware/CryptoAPI.h> #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/foundation/AString.h> Loading Loading @@ -238,7 +239,7 @@ ssize_t Crypto::decrypt( const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const sp<IMemory> &sharedBuffer, size_t offset, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg) { Loading @@ -252,6 +253,8 @@ ssize_t Crypto::decrypt( return -EINVAL; } const void *srcPtr = static_cast<uint8_t *>(sharedBuffer->pointer()) + offset; return mPlugin->decrypt( secure, key, iv, mode, srcPtr, subSamples, numSubSamples, dstPtr, errorDetailMsg); Loading media/libmediaplayerservice/Crypto.h +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ struct Crypto : public BnCrypto { const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const sp<IMemory> &sharedBuffer, size_t offset, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg); Loading Loading
include/media/ICrypto.h +2 −1 Original line number Diff line number Diff line Loading @@ -25,6 +25,7 @@ namespace android { struct AString; struct IMemory; struct ICrypto : public IInterface { DECLARE_META_INTERFACE(Crypto); Loading @@ -48,7 +49,7 @@ struct ICrypto : public IInterface { const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const sp<IMemory> &sharedBuffer, size_t offset, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg) = 0; Loading
include/media/stagefright/MediaCodec.h +5 −1 Original line number Diff line number Diff line Loading @@ -30,8 +30,10 @@ struct AMessage; struct AReplyToken; struct AString; struct CodecBase; struct ICrypto; struct IBatteryStats; struct ICrypto; struct IMemory; struct MemoryDealer; struct SoftwareRenderer; struct Surface; Loading Loading @@ -214,6 +216,7 @@ private: uint32_t mBufferID; sp<ABuffer> mData; sp<ABuffer> mEncryptedData; sp<IMemory> mSharedEncryptedBuffer; sp<AMessage> mNotify; sp<AMessage> mFormat; bool mOwnedByClient; Loading @@ -232,6 +235,7 @@ private: sp<AMessage> mOutputFormat; sp<AMessage> mInputFormat; sp<AMessage> mCallback; sp<MemoryDealer> mDealer; bool mBatteryStatNotified; bool mIsVideo; Loading
media/libmedia/ICrypto.cpp +15 −9 Original line number Diff line number Diff line Loading @@ -19,6 +19,7 @@ #include <utils/Log.h> #include <binder/Parcel.h> #include <binder/IMemory.h> #include <media/ICrypto.h> #include <media/stagefright/MediaErrors.h> #include <media/stagefright/foundation/ADebug.h> Loading Loading @@ -97,7 +98,7 @@ struct BpCrypto : public BpInterface<ICrypto> { const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const sp<IMemory> &sharedBuffer, size_t offset, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg) { Loading Loading @@ -126,7 +127,8 @@ struct BpCrypto : public BpInterface<ICrypto> { } data.writeInt32(totalSize); data.write(srcPtr, totalSize); data.writeStrongBinder(IInterface::asBinder(sharedBuffer)); data.writeInt32(offset); data.writeInt32(numSubSamples); data.write(subSamples, sizeof(CryptoPlugin::SubSample) * numSubSamples); Loading Loading @@ -245,8 +247,9 @@ status_t BnCrypto::onTransact( data.read(iv, sizeof(iv)); size_t totalSize = data.readInt32(); void *srcData = malloc(totalSize); data.read(srcData, totalSize); sp<IMemory> sharedBuffer = interface_cast<IMemory>(data.readStrongBinder()); int32_t offset = data.readInt32(); int32_t numSubSamples = data.readInt32(); Loading @@ -265,15 +268,21 @@ status_t BnCrypto::onTransact( } AString errorDetailMsg; ssize_t result = decrypt( ssize_t result; if (offset + totalSize > sharedBuffer->size()) { result = -EINVAL; } else { result = decrypt( secure, key, iv, mode, srcData, sharedBuffer, offset, subSamples, numSubSamples, dstPtr, &errorDetailMsg); } reply->writeInt32(result); Loading @@ -294,9 +303,6 @@ status_t BnCrypto::onTransact( delete[] subSamples; subSamples = NULL; free(srcData); srcData = NULL; return OK; } Loading
media/libmediaplayerservice/Crypto.cpp +4 −1 Original line number Diff line number Diff line Loading @@ -22,6 +22,7 @@ #include "Crypto.h" #include <binder/IMemory.h> #include <media/hardware/CryptoAPI.h> #include <media/stagefright/foundation/ADebug.h> #include <media/stagefright/foundation/AString.h> Loading Loading @@ -238,7 +239,7 @@ ssize_t Crypto::decrypt( const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const sp<IMemory> &sharedBuffer, size_t offset, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg) { Loading @@ -252,6 +253,8 @@ ssize_t Crypto::decrypt( return -EINVAL; } const void *srcPtr = static_cast<uint8_t *>(sharedBuffer->pointer()) + offset; return mPlugin->decrypt( secure, key, iv, mode, srcPtr, subSamples, numSubSamples, dstPtr, errorDetailMsg); Loading
media/libmediaplayerservice/Crypto.h +1 −1 Original line number Diff line number Diff line Loading @@ -52,7 +52,7 @@ struct Crypto : public BnCrypto { const uint8_t key[16], const uint8_t iv[16], CryptoPlugin::Mode mode, const void *srcPtr, const sp<IMemory> &sharedBuffer, size_t offset, const CryptoPlugin::SubSample *subSamples, size_t numSubSamples, void *dstPtr, AString *errorDetailMsg); Loading