Shaka Player Embedded
Classes | Public Member Functions | Friends | List of all members
shaka::eme::ClearKeyImplementation Class Referencefinal

#include <clearkey_implementation.h>

Inheritance diagram for shaka::eme::ClearKeyImplementation:
shaka::eme::Implementation

Public Member Functions

 ClearKeyImplementation (ImplementationHelper *helper)
 
 ~ClearKeyImplementation () override
 
bool GetExpiration (const std::string &session_id, int64_t *expiration) const override
 
bool GetKeyStatuses (const std::string &session_id, std::vector< KeyStatusInfo > *statuses) const override
 
void SetServerCertificate (EmePromise promise, Data cert) override
 
void CreateSessionAndGenerateRequest (EmePromise promise, std::function< void(const std::string &)> set_session_id, MediaKeySessionType session_type, MediaKeyInitDataType init_data_type, Data data) override
 
void Load (const std::string &session_id, EmePromise promise) override
 
void Update (const std::string &session_id, EmePromise promise, Data data) override
 
void Close (const std::string &session_id, EmePromise promise) override
 
void Remove (const std::string &session_id, EmePromise promise) override
 
DecryptStatus Decrypt (const FrameEncryptionInfo *info, const uint8_t *data, size_t data_size, uint8_t *dest) const override
 
- Public Member Functions inherited from shaka::eme::Implementation
 Implementation ()
 
virtual ~ Implementation ()
 
 Implementation (const Implementation &)=delete
 
Implementationoperator= (const Implementation &)=delete
 
 Implementation (Implementation &&)=delete
 
Implementationoperator= (Implementation &&)=delete
 

Friends

class ClearKeyImplementationTest
 
class media::DecoderIntegration
 
class media::DecoderDecryptIntegration
 

Detailed Description

Definition at line 39 of file clearkey_implementation.h.

Constructor & Destructor Documentation

§ ClearKeyImplementation()

shaka::eme::ClearKeyImplementation::ClearKeyImplementation ( ImplementationHelper helper)
explicit

Definition at line 214 of file clearkey_implementation.cc.

§ ~ClearKeyImplementation()

shaka::eme::ClearKeyImplementation::~ClearKeyImplementation ( )
override

Definition at line 216 of file clearkey_implementation.cc.

Member Function Documentation

§ Close()

void shaka::eme::ClearKeyImplementation::Close ( const std::string &  session_id,
EmePromise  promise 
)
overridevirtual

Closes the given session. This does NOT delete persistent sessions, it only closes the current running session and any runtime data.

Parameters
session_idThe session ID to close.
promiseThe Promise object.

Implements shaka::eme::Implementation.

Definition at line 304 of file clearkey_implementation.cc.

§ CreateSessionAndGenerateRequest()

void shaka::eme::ClearKeyImplementation::CreateSessionAndGenerateRequest ( EmePromise  promise,
std::function< void(const std::string &)>  set_session_id,
MediaKeySessionType  session_type,
MediaKeyInitDataType  init_data_type,
Data  data 
)
overridevirtual

This method creates a new session and generates a license request. This is only called for new session, not for loading persistent sessions.

This should call set_session_id before sending any messages so the session ID is set. The function must only be called once.

This method should create a message to send the license request. This will only be called with init data types where ImplementationFactory::SupportsInitDataType() returns true.

The Promise should be resolved when the request has been generated, NOT when the response comes back. This should call ImplementationHelper::OnMessage() before resolving the Promise.

There are situations where this may not generate the license request immediately, for example if the device isn't provisioned. This will still generate a message, but it may not be a license request.

Parameters
promiseThe Promise object.
set_session_idA function that accepts the session ID of the new session.
session_typeThe type of session to create.
init_data_typeThe type of init data given
dataThe data contents of the request.

Implements shaka::eme::Implementation.

Definition at line 241 of file clearkey_implementation.cc.

§ Decrypt()

DecryptStatus shaka::eme::ClearKeyImplementation::Decrypt ( const FrameEncryptionInfo info,
const uint8_t *  data,
size_t  data_size,
uint8_t *  dest 
) const
overridevirtual

Decrypts the given data. This is given a whole frame and is expected to decrypt the encrypted portions and copy over clear portions. This method doesn't need to handle containers or codecs, all it needs to do is decrypt and copy the data. If the data needs to be processed before decryption (e.g. for MPEG2-TS), it is done by the caller.

If pattern is (0, 0), then this is not using pattern encryption (e.g. for "cenc" or "cbc1").

Parameters
infoContains information about how the frame is encrypted.
dataThe data to decrypt.
data_sizeThe size of |data|.
destThe destination buffer to hold the decrypted data. Is at least |data_size| bytes large.
Returns
The resulting status code.

Implements shaka::eme::Implementation.

Definition at line 317 of file clearkey_implementation.cc.

§ GetExpiration()

bool shaka::eme::ClearKeyImplementation::GetExpiration ( const std::string &  session_id,
int64_t *  expiration 
) const
overridevirtual

Gets the expiration of the session. This should give the time in milliseconds since the epoch, or -1 if the session never expires.

Parameters
session_idThe ID of the session to get the expiration for.
expiration[OUT] Where to put the expiration time.
Returns
True on success, false on error.

Implements shaka::eme::Implementation.

Definition at line 218 of file clearkey_implementation.cc.

§ GetKeyStatuses()

bool shaka::eme::ClearKeyImplementation::GetKeyStatuses ( const std::string &  session_id,
std::vector< KeyStatusInfo > *  statuses 
) const
overridevirtual

Gets the status of each key in the given session. These values can be cached to avoid extra overhead. This means that the key status may have changed but not be reflected yet (e.g. they may have expired).

Parameters
session_idThe ID of the session to query.
statuses[OUT] Where to put the resulting statuses.
Returns
True on success, false on error.

Implements shaka::eme::Implementation.

Definition at line 224 of file clearkey_implementation.cc.

§ Load()

void shaka::eme::ClearKeyImplementation::Load ( const std::string &  session_id,
EmePromise  promise 
)
overridevirtual

Loads the given session from persistent storage.

This should use ResolveWith() and pass true if the session was found, false if the session didn't exist. This should still reject for errors.

Parameters
session_idThe session ID to load.
promiseThe Promise object.

Implements shaka::eme::Implementation.

Definition at line 269 of file clearkey_implementation.cc.

§ Remove()

void shaka::eme::ClearKeyImplementation::Remove ( const std::string &  session_id,
EmePromise  promise 
)
overridevirtual

Removes any persistent data associated with the given session.

This should generate a 'license-release' message. The session should not actually be deleted until the response is given to Update(). However, the Promise should be resolved once the message is generated.

Parameters
session_idThe session ID to delete.
promiseThe Promise object.

Implements shaka::eme::Implementation.

Definition at line 311 of file clearkey_implementation.cc.

§ SetServerCertificate()

void shaka::eme::ClearKeyImplementation::SetServerCertificate ( EmePromise  promise,
Data  cert 
)
overridevirtual

Sets the server certificate for the CDM.

This should use EmePromise::ResolveWith() and pass true for supported and false for not supported. This should only reject for errors in the certificate.

Parameters
promiseThe Promise object.
certThe data contents of the certificate.

Implements shaka::eme::Implementation.

Definition at line 236 of file clearkey_implementation.cc.

§ Update()

void shaka::eme::ClearKeyImplementation::Update ( const std::string &  session_id,
EmePromise  promise,
Data  data 
)
overridevirtual

Updates the given session with a response from the server.

Parameters
session_idThe session ID to use.
promiseThe Promise object.
dataThe data contents of the response.

Implements shaka::eme::Implementation.

Definition at line 275 of file clearkey_implementation.cc.

Friends And Related Function Documentation

§ ClearKeyImplementationTest

friend class ClearKeyImplementationTest
friend

Definition at line 93 of file clearkey_implementation.h.

§ media::DecoderDecryptIntegration

friend class media::DecoderDecryptIntegration
friend

Definition at line 95 of file clearkey_implementation.h.

§ media::DecoderIntegration

friend class media::DecoderIntegration
friend

Definition at line 94 of file clearkey_implementation.h.


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