Bug: 8621588 Merge of the following CLs from the Widevine CDM repository: https://widevine-internal-review.googlesource.com/#/c/5602/ https://widevine-internal-review.googlesource.com/#/c/5431/ https://widevine-internal-review.googlesource.com/#/c/5660/ Change-Id: If37940e2535e1a1eca95e4394d8cf9bf689e9c3a
62 lines
1.7 KiB
C++
62 lines
1.7 KiB
C++
// Copyright 2012 Google Inc. All Rights Reserved.
|
|
|
|
#ifndef CDM_BASE_LICENSE_H_
|
|
#define CDM_BASE_LICENSE_H_
|
|
|
|
#include "license_protocol.pb.h"
|
|
#include "wv_cdm_types.h"
|
|
|
|
namespace wvcdm {
|
|
|
|
using video_widevine_server::sdk::LicenseIdentification;
|
|
using video_widevine_server::sdk::SignedMessage;
|
|
|
|
class CryptoSession;
|
|
class PolicyEngine;
|
|
|
|
class CdmLicense {
|
|
|
|
public:
|
|
|
|
CdmLicense();
|
|
~CdmLicense();
|
|
|
|
bool Init(const std::string& token, CryptoSession* session,
|
|
PolicyEngine* policy_engine);
|
|
|
|
bool PrepareKeyRequest(const CdmInitData& pssh_data,
|
|
const CdmLicenseType license_type,
|
|
const CdmAppParameterMap& app_parameters,
|
|
CdmKeyMessage* signed_request,
|
|
std::string* server_url);
|
|
bool PrepareKeyUpdateRequest(bool is_renewal,
|
|
CdmKeyMessage* signed_request,
|
|
std::string* server_url);
|
|
CdmResponseType HandleKeyResponse(const CdmKeyResponse& license_response);
|
|
CdmResponseType HandleKeyUpdateResponse(
|
|
bool is_renewal,
|
|
const CdmKeyResponse& license_response);
|
|
|
|
bool RestoreOfflineLicense(CdmKeyMessage& license_request,
|
|
CdmKeyResponse& license_response,
|
|
CdmKeyResponse& license_renewal_response);
|
|
|
|
private:
|
|
CdmResponseType HandleKeyErrorResponse(const SignedMessage& signed_message);
|
|
|
|
LicenseIdentification license_id_;
|
|
CryptoSession* session_;
|
|
PolicyEngine* policy_engine_;
|
|
std::string server_url_;
|
|
std::string token_;
|
|
|
|
// Used for certificate based licensing
|
|
CdmKeyMessage key_request_;
|
|
|
|
CORE_DISALLOW_COPY_AND_ASSIGN(CdmLicense);
|
|
};
|
|
|
|
} // namespace wvcdm
|
|
|
|
#endif // CDM_BASE_LICENSE_H_
|