Shaka Player Embedded
|
#include <implementation.h>
Public Member Functions | |
Implementation () | |
virtual | ~ Implementation () |
Implementation (const Implementation &)=delete | |
Implementation & | operator= (const Implementation &)=delete |
Implementation (Implementation &&)=delete | |
Implementation & | operator= (Implementation &&)=delete |
virtual bool | GetExpiration (const std::string &session_id, int64_t *expiration) const =0 |
virtual bool | GetKeyStatuses (const std::string &session_id, std::vector< KeyStatusInfo > *statuses) const =0 |
virtual void | SetServerCertificate (EmePromise promise, Data cert)=0 |
virtual void | CreateSessionAndGenerateRequest (EmePromise promise, std::function< void(const std::string &)> set_session_id, MediaKeySessionType session_type, MediaKeyInitDataType init_data_type, Data data)=0 |
virtual void | Load (const std::string &session_id, EmePromise promise)=0 |
virtual void | Update (const std::string &session_id, EmePromise promise, Data data)=0 |
virtual void | Close (const std::string &session_id, EmePromise promise)=0 |
virtual void | Remove (const std::string &session_id, EmePromise promise)=0 |
virtual DecryptStatus | Decrypt (const FrameEncryptionInfo *info, const uint8_t *data, size_t data_size, uint8_t *dest) const =0 |
An interface for an EME implementation instance. This represents an adapter to a CDM instance. This is a one-to-one mapping to a MediaKeys object in EME. This should create and manage a single CDM instance. This object must remain alive until the Destroy() method is called.
This can spawn background threads as needed to monitor the system. These thread(s) must be deleted inside Destroy().
It is ok to manipulate the filesystem, but it should be done inside the ImplementationHelper::DataPathPrefix directory.
Many of the actions here are asynchronous. Some are completed by the end of the call here, but are run asynchronously with respect to JavaScript. In either case, those methods are given a promise
. Once the operation is complete (error or success), one of the methods on it MUST be called. It is ok to synchronously call those methods.
Most methods here are only called on the JS main thread; the exception is Decrypt, which can be called from any thread, including concurrently with other Decrypt calls. It is highly suggested to avoid exclusive locks in Decrypt so we can get parallel decrypt operations.
Definition at line 86 of file implementation.h.
shaka::eme::Implementation::Implementation | ( | ) |
|
virtual |
|
delete |
|
delete |
|
pure virtual |
Closes the given session. This does NOT delete persistent sessions, it only closes the current running session and any runtime data.
session_id | The session ID to close. |
promise | The Promise object. |
Implemented in shaka::eme::ClearKeyImplementation.
|
pure virtual |
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.
promise | The Promise object. |
set_session_id | A function that accepts the session ID of the new session. |
session_type | The type of session to create. |
init_data_type | The type of init data given |
data | The data contents of the request. |
Implemented in shaka::eme::ClearKeyImplementation.
|
pure virtual |
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").
info | Contains information about how the frame is encrypted. |
data | The data to decrypt. |
data_size | The size of |data|. |
dest | The destination buffer to hold the decrypted data. Is at least |data_size| bytes large. |
Implemented in shaka::eme::ClearKeyImplementation.
|
pure virtual |
Gets the expiration of the session. This should give the time in milliseconds since the epoch, or -1 if the session never expires.
session_id | The ID of the session to get the expiration for. |
expiration | [OUT] Where to put the expiration time. |
Implemented in shaka::eme::ClearKeyImplementation.
|
pure virtual |
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).
session_id | The ID of the session to query. |
statuses | [OUT] Where to put the resulting statuses. |
Implemented in shaka::eme::ClearKeyImplementation.
|
pure virtual |
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.
session_id | The session ID to load. |
promise | The Promise object. |
Implemented in shaka::eme::ClearKeyImplementation.
|
delete |
|
delete |
|
pure virtual |
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.
session_id | The session ID to delete. |
promise | The Promise object. |
Implemented in shaka::eme::ClearKeyImplementation.
|
pure virtual |
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.
promise | The Promise object. |
cert | The data contents of the certificate. |
Implemented in shaka::eme::ClearKeyImplementation.
|
pure virtual |
Updates the given session with a response from the server.
session_id | The session ID to use. |
promise | The Promise object. |
data | The data contents of the response. |
Implemented in shaka::eme::ClearKeyImplementation.