Changes for calling the level 1 decrypt callout

Change-Id: Iccf76b59a64491952ee11ee2ed1a0e707a529f88
This commit is contained in:
Jeffrey Tinker
2011-08-30 17:59:53 -07:00
parent ceac204c61
commit f5fa8f2017
6 changed files with 145 additions and 3 deletions

View File

@@ -0,0 +1,49 @@
/*******************************************************************************
*
* Subset of the OEMCrypto APIs required for L1 support since they are called
* from libwvm.
*
******************************************************************************/
#ifndef _OEMCRYPTO_L1_H
#define _OEMCRYPTO_L1_H
typedef unsigned char OEMCrypto_UINT8;
typedef char OEMCrypto_INT8;
typedef unsigned int OEMCrypto_UINT32;
typedef unsigned int OEMCrypto_SECURE_BUFFER;
typedef enum OEMCryptoResult {
OEMCrypto_SUCCESS = 0
} OEMCryptoResult;
#ifdef __cplusplus
extern "C" {
#endif
#define OEMCrypto_Initialize _oec01
#define OEMCrypto_Terminate _oec02
#define OEMCrypto_DecryptVideo _oec05
#define OEMCrypto_DecryptAudio _oec06
OEMCryptoResult OEMCrypto_Initialize(void);
OEMCryptoResult OEMCrypto_Terminate(void);
OEMCryptoResult OEMCrypto_DecryptVideo(const OEMCrypto_UINT8*,
const OEMCrypto_UINT8*, const OEMCrypto_UINT32,
OEMCrypto_UINT32, OEMCrypto_UINT32, OEMCrypto_UINT32 *);
OEMCryptoResult OEMCrypto_DecryptAudio(const OEMCrypto_UINT8*,
const OEMCrypto_UINT8*, const OEMCrypto_UINT32,
OEMCrypto_UINT8 *, OEMCrypto_UINT32 *);
#ifdef __cplusplus
}
#endif
#endif
/***************************** End of File *****************************/

View File

@@ -24,6 +24,9 @@
#include <media/stagefright/MetaData.h>
#include <media/stagefright/MediaBufferGroup.h>
#include <utils/RefBase.h>
#ifdef REQUIRE_SECURE_BUFFERS
#include "OEMCrypto_L1.h"
#endif
namespace android {
@@ -48,6 +51,24 @@ public:
static int sLastError;
#ifdef REQUIRE_SECURE_BUFFERS
class DecryptContext {
public:
void Initialize(MediaBuffer *mediaBuf) {
mMediaBuf = mediaBuf;
mOffset = 0;
memset(mIV, 0, sizeof(mIV));
}
MediaBuffer *mMediaBuf;
size_t mOffset;
static const int kCryptoBlockSize = 16;
unsigned char mIV[kCryptoBlockSize];
};
static void DecryptCallback(WVEsSelector esType, void* input, void* output,
size_t length, int key);
static DecryptContext sDecryptContext[2]; // audio vs. video
#endif
protected:
virtual ~WVMMediaSource();