Builds libwvmdrmengine.so, which is loaded by the new MediaDrm APIs to support playback of Widevine/CENC protected content. Change-Id: I6f57dd37083dfd96c402cb9dd137c7d74edc8f1c
62 lines
1.3 KiB
C++
62 lines
1.3 KiB
C++
// Copyright 2012 Google Inc. All Rights Reserved.
|
|
//
|
|
// OEMCrypto Client - wrapper class for C-style OEMCrypto interface
|
|
//
|
|
#ifndef CDM_BASE_CRYPTO_ENGINE_H_
|
|
#define CDM_BASE_CRYPTO_ENGINE_H_
|
|
|
|
#include "crypto_session.h"
|
|
#include "lock.h"
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
typedef std::map<CdmSessionId,CryptoSession*> CryptoSessionMap;
|
|
|
|
class CryptoEngine {
|
|
|
|
friend class CryptoSession;
|
|
|
|
private:
|
|
|
|
CryptoEngine();
|
|
~CryptoEngine();
|
|
|
|
public:
|
|
|
|
// get an instance of Crypto engine
|
|
static CryptoEngine* GetInstance();
|
|
|
|
bool Init();
|
|
bool Terminate();
|
|
bool ValidateKeybox();
|
|
|
|
CryptoSession* CreateSession(const CdmSessionId& session_id);
|
|
CryptoSession* FindSession(const CdmSessionId& session_id);
|
|
bool DestroySession(const CdmSessionId& session_id);
|
|
bool DestroySessions();
|
|
|
|
bool GetToken(std::string* token);
|
|
|
|
private:
|
|
|
|
void DeleteInstance();
|
|
static CryptoEngine* CreateSingleton();
|
|
|
|
CryptoSession* FindSessionInternal(const CdmSessionId& session_id);
|
|
|
|
static CryptoEngine* crypto_engine_;
|
|
static Lock crypto_engine_lock_;
|
|
|
|
bool initialized_;
|
|
mutable Lock crypto_lock_;
|
|
mutable Lock sessions_lock_;
|
|
CryptoSessionMap sessions_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(CryptoEngine);
|
|
};
|
|
|
|
}; // namespace wvcdm
|
|
|
|
#endif // CDM_BASE_CRYPTO_ENGINE_H_
|