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

A key source that uses PlayReady for encryption. More...

#include <playready_key_source.h>

Inheritance diagram for shaka::media::PlayReadyKeySource:
shaka::media::KeySource

Public Member Functions

 PlayReadyKeySource (const std::string &server_url, int protection_systems_flags, FourCC protection_scheme)
 
 PlayReadyKeySource (const std::string &server_url, const std::string &client_cert_file, const std::string &client_cert_private_key_file, const std::string &client_cert_private_key_password, int protection_systems_flags, FourCC protection_scheme)
 
virtual Status FetchKeysWithProgramIdentifier (const std::string &program_identifier)
 
void SetCaFile (const std::string &ca_file)
 Sets the Certificate Authority file for validating self-signed certificates.
 
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, const std::string &stream_label, EncryptionKey *key) override
 
- Public Member Functions inherited from shaka::media::KeySource
 KeySource (int protection_systems_flags, FourCC protection_scheme)
 

Static Public Member Functions

static std::unique_ptr< PlayReadyKeySourceCreateFromKeyAndKeyId (const std::vector< uint8_t > &key_id, const std::vector< uint8_t > &key)
 

Additional Inherited Members

- Protected Member Functions inherited from shaka::media::KeySource
Status UpdateProtectionSystemInfo (EncryptionKeyMap *encryption_key_map)
 

Detailed Description

A key source that uses PlayReady for encryption.

Definition at line 20 of file playready_key_source.h.

Constructor & Destructor Documentation

◆ PlayReadyKeySource() [1/2]

shaka::media::PlayReadyKeySource::PlayReadyKeySource ( const std::string &  server_url,
int  protection_systems_flags,
FourCC  protection_scheme 
)

Creates a new PlayReadyKeySource from the given packaging information.

Parameters
server_urlPlayReady packaging server url.
protection_systems_flagsis the flags 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 65 of file playready_key_source.cc.

◆ PlayReadyKeySource() [2/2]

shaka::media::PlayReadyKeySource::PlayReadyKeySource ( const std::string &  server_url,
const std::string &  client_cert_file,
const std::string &  client_cert_private_key_file,
const std::string &  client_cert_private_key_password,
int  protection_systems_flags,
FourCC  protection_scheme 
)

Creates a new PlayReadyKeySource from the given packaging information.

Parameters
server_urlPlayReady packaging server url.
client_cert_fileabsolute path to a client certificate.
client_cert_private_key_fileabsolute path to the private file for the client certificate.
client_cert_private_key_passwordpassword for the private key.
protection_systems_flagsis the flags 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 79 of file playready_key_source.cc.

Member Function Documentation

◆ CreateFromKeyAndKeyId()

static std::unique_ptr<PlayReadyKeySource> shaka::media::PlayReadyKeySource::CreateFromKeyAndKeyId ( const std::vector< uint8_t > &  key_id,
const std::vector< uint8_t > &  key 
)
static

Creates a new PlayReadyKeySource from the given data. Returns null if the strings are invalid. Note: GetKey on the created key source will always return the same key for all track types.

◆ FetchKeys()

Status shaka::media::PlayReadyKeySource::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 200 of file playready_key_source.cc.

◆ GetCryptoPeriodKey()

Status shaka::media::PlayReadyKeySource::GetCryptoPeriodKey ( uint32_t  crypto_period_index,
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.
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 227 of file playready_key_source.cc.

◆ GetKey() [1/2]

Status shaka::media::PlayReadyKeySource::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 206 of file playready_key_source.cc.

◆ GetKey() [2/2]

Status shaka::media::PlayReadyKeySource::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 217 of file playready_key_source.cc.


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