Shaka Packager SDK
Public Member Functions | List of all members
shaka::media::WidevineKeySource Class Reference

#include <widevine_key_source.h>

Inheritance diagram for shaka::media::WidevineKeySource:
shaka::media::KeySource

Public Member Functions

 WidevineKeySource (const std::string &server_url, ProtectionSystem protection_systems, FourCC protection_scheme)
 
Status FetchKeys (const std::vector< uint8_t > &content_id, const std::string &policy)
 
void set_signer (std::unique_ptr< RequestSigner > signer)
 
void set_key_fetcher (std::unique_ptr< KeyFetcher > key_fetcher)
 
void set_group_id (const std::vector< uint8_t > &group_id)
 
void set_enable_entitlement_license (bool enable_entitlement_license)
 
KeySource implementation overrides.
Status FetchKeys (EmeInitDataType init_data_type, const std::vector< uint8_t > &init_data) override
 
Status GetKey (const std::string &stream_label, EncryptionKey *key) override
 
Status GetKey (const std::vector< uint8_t > &key_id, EncryptionKey *key) override
 
Status GetCryptoPeriodKey (uint32_t crypto_period_index, uint32_t crypto_period_duration_in_seconds, const std::string &stream_label, EncryptionKey *key) override
 

Detailed Description

WidevineKeySource talks to the Widevine encryption service to acquire the encryption keys.

Definition at line 29 of file widevine_key_source.h.

Constructor & Destructor Documentation

◆ WidevineKeySource()

shaka::media::WidevineKeySource::WidevineKeySource ( const std::string &  server_url,
ProtectionSystem  protection_systems,
FourCC  protection_scheme 
)
Parameters
server_urlis the Widevine common encryption server url.
protection_systemsis the enum indicating which PSSH should be included.
protection_schemeis the Protection Scheme to be used for encryption. It needs to be signalled in Widevine PSSH. This argument can be ignored if Widevine PSSH is not generated.

Definition at line 86 of file widevine_key_source.cc.

Member Function Documentation

◆ FetchKeys() [1/2]

Status shaka::media::WidevineKeySource::FetchKeys ( const std::vector< uint8_t > &  content_id,
const std::string &  policy 
)

Fetch keys for CENC from the key server.

Parameters
content_idthe unique id identify the content.
policyspecifies the DRM content rights.
Returns
OK on success, an error status otherwise.

Definition at line 118 of file widevine_key_source.cc.

◆ FetchKeys() [2/2]

Status shaka::media::WidevineKeySource::FetchKeys ( EmeInitDataType  init_data_type,
const std::vector< uint8_t > &  init_data 
)
overridevirtual

Fetch keys based on the specified encrypted media init data.

Parameters
init_data_typespecifies the encrypted media init data type.
init_datacontains the init data.
Returns
OK on success, an error status otherwise.

Implements shaka::media::KeySource.

Definition at line 133 of file widevine_key_source.cc.

◆ GetCryptoPeriodKey()

Status shaka::media::WidevineKeySource::GetCryptoPeriodKey ( uint32_t  crypto_period_index,
uint32_t  crypto_period_duration_in_seconds,
const std::string &  stream_label,
EncryptionKey key 
)
overridevirtual

Get encryption key of the specified track type at the specified index.

Parameters
crypto_period_indexis the sequence number of the key rotation period for which the key is being retrieved.
crypto_period_duration_in_secondsis the duration of the crypto period in seconds.
stream_labelis the label of stream for which retrieving the key.
keyis a pointer to the EncryptionKey which will hold the retrieved key. Owner retains ownership, and may not be NULL.
Returns
OK on success, an error status otherwise.

Implements shaka::media::KeySource.

Definition at line 219 of file widevine_key_source.cc.

◆ GetKey() [1/2]

Status shaka::media::WidevineKeySource::GetKey ( const std::string &  stream_label,
EncryptionKey key 
)
overridevirtual

Get encryption key of the specified stream label.

Parameters
stream_labelis the label of stream for which retrieving the key.
keyis a pointer to the EncryptionKey which will hold the retrieved key. Owner retains ownership, and may not be NULL.
Returns
OK on success, an error status otherwise.

Implements shaka::media::KeySource.

Definition at line 195 of file widevine_key_source.cc.

◆ GetKey() [2/2]

Status shaka::media::WidevineKeySource::GetKey ( const std::vector< uint8_t > &  key_id,
EncryptionKey key 
)
overridevirtual

Get the encryption key specified by the CENC key ID.

Parameters
key_idis the unique identifier for the key being retreived.
keyis a pointer to the EncryptionKey which will hold the retrieved key. Owner retains ownership, and may not be NULL.
Returns
OK on success, or an error status otherwise.

Implements shaka::media::KeySource.

Definition at line 206 of file widevine_key_source.cc.

◆ set_key_fetcher()

void shaka::media::WidevineKeySource::set_key_fetcher ( std::unique_ptr< KeyFetcher key_fetcher)

Inject an KeyFetcher object, mainly used for testing.

Parameters
key_fetcherpoints to the KeyFetcher object to be injected.

Definition at line 252 of file widevine_key_source.cc.

◆ set_signer()

void shaka::media::WidevineKeySource::set_signer ( std::unique_ptr< RequestSigner signer)

Set signer for the key source.

Parameters
signersigns the request message.

Definition at line 248 of file widevine_key_source.cc.


The documentation for this class was generated from the following files: