This commit is a combination of the following: * http://go/wvgerrit/117003 * http://go/wvgerrit/118303 Bug: 162255728 Test: MediaDrmTest#testGetLogMessages Change-Id: I5699b64d5c4bab463e5b587595fa7d324dc1d93f
93 lines
2.5 KiB
C++
93 lines
2.5 KiB
C++
//
|
|
// Copyright 2018 Google LLC. All Rights Reserved. This file and proprietary
|
|
// source code may only be used and distributed under the Widevine License
|
|
// Agreement.
|
|
//
|
|
|
|
#ifndef WV_CRYPTO_PLUGIN_H_
|
|
#define WV_CRYPTO_PLUGIN_H_
|
|
|
|
#include <android/hidl/memory/1.0/IMemory.h>
|
|
|
|
#include "HidlTypes.h"
|
|
#include "log.h"
|
|
#include "wv_content_decryption_module.h"
|
|
#include "WVTypes.h"
|
|
|
|
namespace wvdrm {
|
|
namespace hardware {
|
|
namespace drm {
|
|
namespace V1_4 {
|
|
namespace widevine {
|
|
|
|
using ::android::hidl::memory::V1_0::IMemory;
|
|
|
|
struct WVCryptoPlugin : public ::drm::V1_4::ICryptoPlugin {
|
|
WVCryptoPlugin(const void* data, size_t size,
|
|
const sp<wvcdm::WvContentDecryptionModule>& cdm);
|
|
virtual ~WVCryptoPlugin();
|
|
|
|
Return<bool> requiresSecureDecoderComponent(const hidl_string& mime)
|
|
override;
|
|
|
|
Return<void> notifyResolution(uint32_t width, uint32_t height) override;
|
|
|
|
Return<Status> setMediaDrmSession(const hidl_vec<uint8_t>& sessionId)
|
|
override;
|
|
|
|
Return<void> setSharedBufferBase(const hidl_memory& base,
|
|
uint32_t bufferId) override;
|
|
|
|
Return<void> decrypt(
|
|
bool secure,
|
|
const hidl_array<uint8_t, 16>& keyId,
|
|
const hidl_array<uint8_t, 16>& iv,
|
|
Mode mode,
|
|
const Pattern& pattern,
|
|
const hidl_vec<SubSample>& subSamples,
|
|
const SharedBuffer& source,
|
|
uint64_t offset,
|
|
const DestinationBuffer& destination,
|
|
decrypt_cb _hidl_cb) override;
|
|
|
|
Return<void> decrypt_1_2(
|
|
bool secure,
|
|
const hidl_array<uint8_t, 16>& keyId,
|
|
const hidl_array<uint8_t, 16>& iv,
|
|
Mode mode,
|
|
const Pattern& pattern,
|
|
const hidl_vec<SubSample>& subSamples,
|
|
const SharedBuffer& source,
|
|
uint64_t offset,
|
|
const DestinationBuffer& destination,
|
|
decrypt_1_2_cb _hidl_cb) override;
|
|
|
|
Return<void> getLogMessages(
|
|
getLogMessages_cb _hidl_cb) override;
|
|
|
|
private:
|
|
WVDRM_DISALLOW_COPY_AND_ASSIGN_AND_NEW(WVCryptoPlugin);
|
|
|
|
// List this field first so it is destructed last; ensure logging uid
|
|
// is cleared right before plugin is destructed.
|
|
wvcdm::LoggingUidSetter mLoggingUidSetter;
|
|
|
|
wvcdm::CdmSessionId mSessionId;
|
|
std::map<uint32_t, sp<IMemory> > mSharedBufferMap;
|
|
|
|
sp<wvcdm::WvContentDecryptionModule> const mCDM;
|
|
uint32_t mUserId;
|
|
|
|
Status_V1_2 attemptDecrypt(
|
|
const wvcdm::CdmDecryptionParametersV16& params,
|
|
bool haveEncryptedSubsamples, std::string* errorDetailMsg);
|
|
};
|
|
|
|
} // namespace widevine
|
|
} // namespace V1_4
|
|
} // namespace drm
|
|
} // namespace hardware
|
|
} // namespace wvdrm
|
|
|
|
#endif // WV_CRYPTO_PLUGIN_H_
|