namespace cdm {
-class AudioFrames_2;
-typedef AudioFrames_2 AudioFrames;
+class AudioFrames;
-class Host_4;
-class Host_5;
class Host_6;
class DecryptedBlock;
kInvalidAccessError = 15,
kQuotaExceededError = 22,
- // Additional exceptions that don't have assigned codes.
+ // Additional exceptions that do not have assigned codes.
// There are other non-EME-specific values, not included in this list.
kUnknownError = 30,
};
// Represents an input buffer to be decrypted (and possibly decoded). It does
-// not own any pointers in this struct.
-// Deprecated: New CDM implementations should use InputBuffer.
-struct InputBuffer_1 {
- InputBuffer_1()
- : data(NULL),
- data_size(0),
- data_offset(0),
- key_id(NULL),
- key_id_size(0),
- iv(NULL),
- iv_size(0),
- subsamples(NULL),
- num_subsamples(0),
- timestamp(0) {}
-
- const uint8_t* data; // Pointer to the beginning of the input data.
- uint32_t data_size; // Size (in bytes) of |data|.
-
- uint32_t data_offset; // Number of bytes to be discarded before decryption.
-
- const uint8_t* key_id; // Key ID to identify the decryption key.
- uint32_t key_id_size; // Size (in bytes) of |key_id|.
-
- const uint8_t* iv; // Initialization vector.
- uint32_t iv_size; // Size (in bytes) of |iv|.
-
- const struct SubsampleEntry* subsamples;
- uint32_t num_subsamples; // Number of subsamples in |subsamples|.
-
- int64_t timestamp; // Presentation timestamp in microseconds.
-};
-
-// Represents an input buffer to be decrypted (and possibly decoded). It does
// not own any pointers in this struct. If |iv_size| = 0, the data is
// unencrypted.
-struct InputBuffer_2 {
- InputBuffer_2()
+struct InputBuffer {
+ InputBuffer()
: data(NULL),
data_size(0),
key_id(NULL),
int64_t timestamp; // Presentation timestamp in microseconds.
};
-typedef InputBuffer_2 InputBuffer;
-
struct AudioDecoderConfig {
enum AudioCodec {
kUnknownAudioCodec = 0,
// FileIO interface provides a way for the CDM to store data in a file in
// persistent storage. This interface aims only at providing basic read/write
// capabilities and should not be used as a full fledged file IO API.
-// Each domain (e.g. "example.com") and each CDM has it's own persistent
-// storage. All instances of a given CDM associated with a given domain share
-// the same persistent storage.
+// Each CDM and origin (e.g. HTTPS, "foo.example.com", 443) combination has
+// its own persistent storage. All instances of a given CDM associated with a
+// given origin share the same persistent storage.
+// Note to implementors of this interface:
+// Per-origin storage and the ability for users to clear it are important.
+// See http://www.w3.org/TR/encrypted-media/#privacy-storedinfo.
class FileIO {
public:
// Opens the file with |file_name| for read and write.
// - When the file is opened by a CDM instance, it will be classified as "in
// use". In this case other CDM instances in the same domain may receive
// kInUse status when trying to open it.
- // - |file_name| should not include path separators.
+ // - |file_name| must not contain forward slash ('/') or backslash ('\'), and
+ // must not start with an underscore ('_').
virtual void Open(const char* file_name, uint32_t file_name_size) = 0;
// Reads the contents of the file. FileIOClient::OnReadComplete() will be
};
// Responses to FileIO calls. All responses will be called asynchronously.
+// When kError is returned, the FileIO object could be in an error state. All
+// following calls (other than Close()) could return kError. The CDM should
+// still call Close() to destroy the FileIO object.
class FileIOClient {
public:
enum Status {
// - kSuccess indicates that all contents of the file has been successfully
// read. In this case, 0 |data_size| means that the file is empty.
// - kInUse indicates that there are other read/write operations pending.
- // - kError indicates read failure, e.g. the storage isn't open or cannot be
+ // - kError indicates read failure, e.g. the storage is not open or cannot be
// fully read.
virtual void OnReadComplete(Status status,
const uint8_t* data, uint32_t data_size) = 0;
// - kSuccess indicates that all the data has been written into the file
// successfully.
// - kInUse indicates that there are other read/write operations pending.
- // - kError indicates write failure, e.g. the storage isn't open or cannot be
+ // - kError indicates write failure, e.g. the storage is not open or cannot be
// fully written. Upon write failure, the contents of the file should be
// regarded as corrupt and should not used.
virtual void OnWriteComplete(Status status) = 0;
// provided in CreateCdmInstance() to allocate any Buffer that needs to
// be passed back to the caller. Implementations must call Buffer::Destroy()
// when a Buffer is created that will never be returned to the caller.
-class ContentDecryptionModule_4 {
- public:
- static const int kVersion = 4;
- typedef Host_4 Host;
-
- // CreateSession(), UpdateSession(), and ReleaseSession() get passed a
- // |session_id| for a MediaKeySession object. It must be used in the reply via
- // Host methods (e.g. Host::OnSessionMessage()).
- // Note: |session_id| is different from MediaKeySession's sessionId attribute,
- // which is referred to as |web_session_id| in this file.
-
- // Creates a session given |type| and |init_data|.
- virtual void CreateSession(
- uint32_t session_id,
- const char* type, uint32_t type_size,
- const uint8_t* init_data, uint32_t init_data_size) = 0;
-
- // Loads a session that has |web_session_id|.
- virtual void LoadSession(
- uint32_t session_id,
- const char* web_session_id, uint32_t web_session_id_length) = 0;
-
- // Updates the session with |response|.
- virtual void UpdateSession(
- uint32_t session_id,
- const uint8_t* response, uint32_t response_size) = 0;
-
- // Releases the resources for the session.
- virtual void ReleaseSession(uint32_t session_id) = 0;
-
- // Performs scheduled operation with |context| when the timer fires.
- virtual void TimerExpired(void* context) = 0;
-
- // Decrypts the |encrypted_buffer|.
- //
- // Returns kSuccess if decryption succeeded, in which case the callee
- // should have filled the |decrypted_buffer| and passed the ownership of
- // |data| in |decrypted_buffer| to the caller.
- // Returns kNoKey if the CDM did not have the necessary decryption key
- // to decrypt.
- // Returns kDecryptError if any other error happened.
- // If the return value is not kSuccess, |decrypted_buffer| should be ignored
- // by the caller.
- virtual Status Decrypt(const InputBuffer_1& encrypted_buffer,
- DecryptedBlock* decrypted_buffer) = 0;
-
- // Initializes the CDM audio decoder with |audio_decoder_config|. This
- // function must be called before DecryptAndDecodeSamples() is called.
- //
- // Returns kSuccess if the |audio_decoder_config| is supported and the CDM
- // audio decoder is successfully initialized.
- // Returns kSessionError if |audio_decoder_config| is not supported. The CDM
- // may still be able to do Decrypt().
- // Returns kDeferredInitialization if the CDM is not ready to initialize the
- // decoder at this time. Must call Host::OnDeferredInitializationDone() once
- // initialization is complete.
- virtual Status InitializeAudioDecoder(
- const AudioDecoderConfig& audio_decoder_config) = 0;
-
- // Initializes the CDM video decoder with |video_decoder_config|. This
- // function must be called before DecryptAndDecodeFrame() is called.
- //
- // Returns kSuccess if the |video_decoder_config| is supported and the CDM
- // video decoder is successfully initialized.
- // Returns kSessionError if |video_decoder_config| is not supported. The CDM
- // may still be able to do Decrypt().
- // Returns kDeferredInitialization if the CDM is not ready to initialize the
- // decoder at this time. Must call Host::OnDeferredInitializationDone() once
- // initialization is complete.
- virtual Status InitializeVideoDecoder(
- const VideoDecoderConfig& video_decoder_config) = 0;
-
- // De-initializes the CDM decoder and sets it to an uninitialized state. The
- // caller can initialize the decoder again after this call to re-initialize
- // it. This can be used to reconfigure the decoder if the configuration
- // changes.
- virtual void DeinitializeDecoder(StreamType decoder_type) = 0;
-
- // Resets the CDM decoder to an initialized clean state. All internal buffers
- // MUST be flushed.
- virtual void ResetDecoder(StreamType decoder_type) = 0;
-
- // Decrypts the |encrypted_buffer| and decodes the decrypted buffer into a
- // |video_frame|. Upon end-of-stream, the caller should call this function
- // repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty
- // |video_frame| (|format| == kEmptyVideoFrame) is produced.
- //
- // Returns kSuccess if decryption and decoding both succeeded, in which case
- // the callee will have filled the |video_frame| and passed the ownership of
- // |frame_buffer| in |video_frame| to the caller.
- // Returns kNoKey if the CDM did not have the necessary decryption key
- // to decrypt.
- // Returns kNeedMoreData if more data was needed by the decoder to generate
- // a decoded frame (e.g. during initialization and end-of-stream).
- // Returns kDecryptError if any decryption error happened.
- // Returns kDecodeError if any decoding error happened.
- // If the return value is not kSuccess, |video_frame| should be ignored by
- // the caller.
- virtual Status DecryptAndDecodeFrame(const InputBuffer_1& encrypted_buffer,
- VideoFrame* video_frame) = 0;
-
- // Decrypts the |encrypted_buffer| and decodes the decrypted buffer into
- // |audio_frames|. Upon end-of-stream, the caller should call this function
- // repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty
- // |audio_frames| is produced.
- //
- // Returns kSuccess if decryption and decoding both succeeded, in which case
- // the callee will have filled |audio_frames| and passed the ownership of
- // |data| in |audio_frames| to the caller.
- // Returns kNoKey if the CDM did not have the necessary decryption key
- // to decrypt.
- // Returns kNeedMoreData if more data was needed by the decoder to generate
- // audio samples (e.g. during initialization and end-of-stream).
- // Returns kDecryptError if any decryption error happened.
- // Returns kDecodeError if any decoding error happened.
- // If the return value is not kSuccess, |audio_frames| should be ignored by
- // the caller.
- virtual Status DecryptAndDecodeSamples(const InputBuffer_1& encrypted_buffer,
- AudioFrames* audio_frames) = 0;
-
- // Called by the host after a platform challenge was initiated via
- // Host::SendPlatformChallenge().
- virtual void OnPlatformChallengeResponse(
- const PlatformChallengeResponse& response) = 0;
-
- // Called by the host after a call to Host::QueryOutputProtectionStatus(). The
- // |link_mask| is a bit mask of OutputLinkTypes. The |output_protection_mask|
- // is a bit mask of OutputProtectionMethods, indicating whether all
- // protectable links in |link_mask| are protected. Protectable links include
- // HDMI, DVI and DisplayPort.
- virtual void OnQueryOutputProtectionStatus(
- uint32_t link_mask, uint32_t output_protection_mask) = 0;
-
- // Destroys the object in the same context as it was created.
- virtual void Destroy() = 0;
-
- protected:
- ContentDecryptionModule_4() {}
- virtual ~ContentDecryptionModule_4() {}
-};
-
-// ContentDecryptionModule interface that all CDMs need to implement.
-// The interface is versioned for backward compatibility.
-// Note: ContentDecryptionModule implementations must use the allocator
-// provided in CreateCdmInstance() to allocate any Buffer that needs to
-// be passed back to the caller. Implementations must call Buffer::Destroy()
-// when a Buffer is created that will never be returned to the caller.
-class ContentDecryptionModule_5 {
- public:
- static const int kVersion = 5;
- typedef Host_5 Host;
-
- // CreateSession(), LoadSession(), UpdateSession(), and ReleaseSession()
- // accept a |promise_id|, which must be passed to the completion Host method
- // (e.g. Host::OnResolveNewSessionPromise()).
-
- // Creates a session given |init_data_type|, |init_data| and |session_type|.
- // The CDM must respond by calling either Host::OnResolveNewSessionPromise()
- // or Host::OnRejectPromise().
- virtual void CreateSession(
- uint32_t promise_id,
- const char* init_data_type, uint32_t init_data_type_size,
- const uint8_t* init_data, uint32_t init_data_size,
- SessionType session_type) = 0;
-
- // Loads the session with |web_session_id|. The CDM must respond by calling
- // either Host::OnResolveNewSessionPromise() or Host::OnRejectPromise().
- // If the session is not found, call Host::OnResolveNewSessionPromise()
- // with web_session_id = NULL.
- virtual void LoadSession(
- uint32_t promise_id,
- const char* web_session_id, uint32_t web_session_id_length) = 0;
-
- // Updates the session with |response|. The CDM must respond by calling
- // either Host::OnResolvePromise() or Host::OnRejectPromise().
- virtual void UpdateSession(
- uint32_t promise_id,
- const char* web_session_id, uint32_t web_session_id_length,
- const uint8_t* response, uint32_t response_size) = 0;
-
- // Releases the resources for the session. The CDM must respond by calling
- // either Host::OnResolvePromise() or Host::OnRejectPromise().
- // Once the session is closed, Host::OnSessionClosed() must also be called.
- virtual void ReleaseSession(
- uint32_t promise_id,
- const char* web_session_id, uint32_t web_session_id_length) = 0;
-
- // Provides a server certificate to be used to encrypt messages to the
- // license server.
- virtual void SetServerCertificate(
- uint32_t promise_id,
- const uint8_t* server_certificate_data,
- uint32_t server_certificate_data_size) = 0;
-
- // Performs scheduled operation with |context| when the timer fires.
- virtual void TimerExpired(void* context) = 0;
-
- // Decrypts the |encrypted_buffer|.
- //
- // Returns kSuccess if decryption succeeded, in which case the callee
- // should have filled the |decrypted_buffer| and passed the ownership of
- // |data| in |decrypted_buffer| to the caller.
- // Returns kNoKey if the CDM did not have the necessary decryption key
- // to decrypt.
- // Returns kDecryptError if any other error happened.
- // If the return value is not kSuccess, |decrypted_buffer| should be ignored
- // by the caller.
- virtual Status Decrypt(const InputBuffer_1& encrypted_buffer,
- DecryptedBlock* decrypted_buffer) = 0;
-
- // Initializes the CDM audio decoder with |audio_decoder_config|. This
- // function must be called before DecryptAndDecodeSamples() is called.
- //
- // Returns kSuccess if the |audio_decoder_config| is supported and the CDM
- // audio decoder is successfully initialized.
- // Returns kSessionError if |audio_decoder_config| is not supported. The CDM
- // may still be able to do Decrypt().
- // Returns kDeferredInitialization if the CDM is not ready to initialize the
- // decoder at this time. Must call Host::OnDeferredInitializationDone() once
- // initialization is complete.
- virtual Status InitializeAudioDecoder(
- const AudioDecoderConfig& audio_decoder_config) = 0;
-
- // Initializes the CDM video decoder with |video_decoder_config|. This
- // function must be called before DecryptAndDecodeFrame() is called.
- //
- // Returns kSuccess if the |video_decoder_config| is supported and the CDM
- // video decoder is successfully initialized.
- // Returns kSessionError if |video_decoder_config| is not supported. The CDM
- // may still be able to do Decrypt().
- // Returns kDeferredInitialization if the CDM is not ready to initialize the
- // decoder at this time. Must call Host::OnDeferredInitializationDone() once
- // initialization is complete.
- virtual Status InitializeVideoDecoder(
- const VideoDecoderConfig& video_decoder_config) = 0;
-
- // De-initializes the CDM decoder and sets it to an uninitialized state. The
- // caller can initialize the decoder again after this call to re-initialize
- // it. This can be used to reconfigure the decoder if the configuration
- // changes.
- virtual void DeinitializeDecoder(StreamType decoder_type) = 0;
-
- // Resets the CDM decoder to an initialized clean state. All internal buffers
- // MUST be flushed.
- virtual void ResetDecoder(StreamType decoder_type) = 0;
-
- // Decrypts the |encrypted_buffer| and decodes the decrypted buffer into a
- // |video_frame|. Upon end-of-stream, the caller should call this function
- // repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty
- // |video_frame| (|format| == kEmptyVideoFrame) is produced.
- //
- // Returns kSuccess if decryption and decoding both succeeded, in which case
- // the callee will have filled the |video_frame| and passed the ownership of
- // |frame_buffer| in |video_frame| to the caller.
- // Returns kNoKey if the CDM did not have the necessary decryption key
- // to decrypt.
- // Returns kNeedMoreData if more data was needed by the decoder to generate
- // a decoded frame (e.g. during initialization and end-of-stream).
- // Returns kDecryptError if any decryption error happened.
- // Returns kDecodeError if any decoding error happened.
- // If the return value is not kSuccess, |video_frame| should be ignored by
- // the caller.
- virtual Status DecryptAndDecodeFrame(const InputBuffer_1& encrypted_buffer,
- VideoFrame* video_frame) = 0;
-
- // Decrypts the |encrypted_buffer| and decodes the decrypted buffer into
- // |audio_frames|. Upon end-of-stream, the caller should call this function
- // repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty
- // |audio_frames| is produced.
- //
- // Returns kSuccess if decryption and decoding both succeeded, in which case
- // the callee will have filled |audio_frames| and passed the ownership of
- // |data| in |audio_frames| to the caller.
- // Returns kNoKey if the CDM did not have the necessary decryption key
- // to decrypt.
- // Returns kNeedMoreData if more data was needed by the decoder to generate
- // audio samples (e.g. during initialization and end-of-stream).
- // Returns kDecryptError if any decryption error happened.
- // Returns kDecodeError if any decoding error happened.
- // If the return value is not kSuccess, |audio_frames| should be ignored by
- // the caller.
- virtual Status DecryptAndDecodeSamples(const InputBuffer_1& encrypted_buffer,
- AudioFrames* audio_frames) = 0;
-
- // Called by the host after a platform challenge was initiated via
- // Host::SendPlatformChallenge().
- virtual void OnPlatformChallengeResponse(
- const PlatformChallengeResponse& response) = 0;
-
- // Called by the host after a call to Host::QueryOutputProtectionStatus(). The
- // |link_mask| is a bit mask of OutputLinkTypes and |output_protection_mask|
- // is a bit mask of OutputProtectionMethods.
- virtual void OnQueryOutputProtectionStatus(
- uint32_t link_mask, uint32_t output_protection_mask) = 0;
-
- // Destroys the object in the same context as it was created.
- virtual void Destroy() = 0;
-
- protected:
- ContentDecryptionModule_5() {}
- virtual ~ContentDecryptionModule_5() {}
-};
-
-// ContentDecryptionModule interface that all CDMs need to implement.
-// The interface is versioned for backward compatibility.
-// Note: ContentDecryptionModule implementations must use the allocator
-// provided in CreateCdmInstance() to allocate any Buffer that needs to
-// be passed back to the caller. Implementations must call Buffer::Destroy()
-// when a Buffer is created that will never be returned to the caller.
class ContentDecryptionModule_6 {
public:
static const int kVersion = 6;
// Requests the key IDs for keys in the session that the CDM knows are
// currently usable to decrypt media data. The CDM must respond by calling
- // either Host::OnResolveGetUsableKeyIdsPromise() or Host::OnRejectPromise().
+ // either Host::OnResolveKeyIdsPromise() or Host::OnRejectPromise().
virtual void GetUsableKeyIds(
uint32_t promise_id,
const char* web_session_id, uint32_t web_session_id_length) = 0;
void operator=(const Buffer&);
};
-class Host_4 {
- public:
- static const int kVersion = 4;
-
- // Returns a Buffer* containing non-zero members upon success, or NULL on
- // failure. The caller owns the Buffer* after this call. The buffer is not
- // guaranteed to be zero initialized. The capacity of the allocated Buffer
- // is guaranteed to be not less than |capacity|.
- virtual Buffer* Allocate(uint32_t capacity) = 0;
-
- // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms|
- // from now with |context|.
- virtual void SetTimer(int64_t delay_ms, void* context) = 0;
-
- // Returns the current epoch wall time in seconds.
- virtual double GetCurrentWallTimeInSeconds() = 0;
-
- // Called by the CDM when a session is created or loaded and the value for the
- // MediaKeySession's sessionId attribute is available (|web_session_id|).
- // This must be called before OnSessionMessage() or OnSessionReady() is called
- // for |session_id|. |web_session_id_length| should not include null
- // termination.
- // When called in response to LoadSession(), the |web_session_id| must be the
- // same as the |web_session_id| passed in LoadSession().
- virtual void OnSessionCreated(
- uint32_t session_id,
- const char* web_session_id, uint32_t web_session_id_length) = 0;
-
- // Called by the CDM when it has a message for session |session_id|.
- // Length parameters should not include null termination.
- virtual void OnSessionMessage(
- uint32_t session_id,
- const char* message, uint32_t message_length,
- const char* destination_url, uint32_t destination_url_length) = 0;
-
- // Called by the CDM when session |session_id| is ready.
- // Note: "ready" event is deprecated. This is only used for the prefixed EME
- // API's "keyAdded" event. Drop this when we deprecate prefixed EME API.
- virtual void OnSessionReady(uint32_t session_id) = 0;
-
- // Called by the CDM when session |session_id| is closed.
- virtual void OnSessionClosed(uint32_t session_id) = 0;
-
- // Called by the CDM when an error occurs in session |session_id|.
- virtual void OnSessionError(uint32_t session_id,
- MediaKeyError error_code,
- uint32_t system_code) = 0;
-
- // The following are optional methods that may not be implemented on all
- // platforms.
-
- // Sends a platform challenge for the given |service_id|. |challenge| is at
- // most 256 bits of data to be signed. Once the challenge has been completed,
- // the host will call ContentDecryptionModule::OnPlatformChallengeResponse()
- // with the signed challenge response and platform certificate. Length
- // parameters should not include null termination.
- virtual void SendPlatformChallenge(
- const char* service_id, uint32_t service_id_length,
- const char* challenge, uint32_t challenge_length) = 0;
-
- // Attempts to enable output protection (e.g. HDCP) on the display link. The
- // |desired_protection_mask| is a bit mask of OutputProtectionMethods. No
- // status callback is issued, the CDM must call QueryOutputProtectionStatus()
- // periodically to ensure the desired protections are applied.
- virtual void EnableOutputProtection(uint32_t desired_protection_mask) = 0;
-
- // Requests the current output protection status. Once the host has the status
- // it will call ContentDecryptionModule::OnQueryOutputProtectionStatus().
- virtual void QueryOutputProtectionStatus() = 0;
-
- // Must be called by the CDM if it returned kDeferredInitialization during
- // InitializeAudioDecoder() or InitializeVideoDecoder().
- virtual void OnDeferredInitializationDone(StreamType stream_type,
- Status decoder_status) = 0;
-
- // Creates a FileIO object from the host to do file IO operation. Returns NULL
- // if a FileIO object cannot be obtained. Once a valid FileIO object is
- // returned, |client| must be valid until FileIO::Close() is called. The
- // CDM can call this method multiple times to operate on different files.
- virtual FileIO* CreateFileIO(FileIOClient* client) = 0;
-
- protected:
- Host_4() {}
- virtual ~Host_4() {}
-};
-
-class Host_5 {
- public:
- static const int kVersion = 5;
-
- // Returns a Buffer* containing non-zero members upon success, or NULL on
- // failure. The caller owns the Buffer* after this call. The buffer is not
- // guaranteed to be zero initialized. The capacity of the allocated Buffer
- // is guaranteed to be not less than |capacity|.
- virtual Buffer* Allocate(uint32_t capacity) = 0;
-
- // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms|
- // from now with |context|.
- virtual void SetTimer(int64_t delay_ms, void* context) = 0;
-
- // Returns the current wall time in seconds.
- virtual Time GetCurrentTime() = 0;
-
- // Called by the CDM when a session is created or loaded and the value for the
- // MediaKeySession's sessionId attribute is available (|web_session_id|).
- // This must be called before OnSessionMessage() or OnSessionReady() is called
- // for the same session. |web_session_id_length| should not include null
- // termination.
- // When called in response to LoadSession(), the |web_session_id| must be the
- // same as the |web_session_id| passed in LoadSession(), or NULL if the
- // session could not be loaded.
- virtual void OnResolveNewSessionPromise(
- uint32_t promise_id,
- const char* web_session_id, uint32_t web_session_id_length) = 0;
-
- // Called by the CDM when a session is updated or released.
- virtual void OnResolvePromise(uint32_t promise_id) = 0;
-
- // Called by the CDM when an error occurs as a result of one of the
- // ContentDecryptionModule calls that accept a |promise_id|.
- // |error| must be specified, |error_message| and |system_code|
- // are optional. Length parameters should not include null termination.
- virtual void OnRejectPromise(
- uint32_t promise_id,
- Error error,
- uint32_t system_code,
- const char* error_message, uint32_t error_message_length) = 0;
-
- // Called by the CDM when it has a message for session |web_session_id|.
- // Length parameters should not include null termination.
- virtual void OnSessionMessage(
- const char* web_session_id, uint32_t web_session_id_length,
- const char* message, uint32_t message_length,
- const char* destination_url, uint32_t destination_url_length) = 0;
-
- // Called by the CDM when there has been a change in usable keys for
- // session |web_session_id|. |has_additional_usable_key| should be set if a
- // key is newly usable (e.g. new key available, previously expired key has
- // been renewed, etc.) and the browser should attempt to resume playback.
- // Length parameter should not include null termination.
- virtual void OnSessionKeysChange(
- const char* web_session_id, uint32_t web_session_id_length,
- bool has_additional_usable_key) = 0;
-
- // Called by the CDM when there has been a change in the expiration time for
- // session |web_session_id|. This can happen as the result of an Update() call
- // or some other event. If this happens as a result of a call to Update(),
- // it must be called before resolving the Update() promise. |new_expiry_time|
- // can be 0 to represent "undefined". Length parameter should not include
- // null termination.
- virtual void OnExpirationChange(
- const char* web_session_id, uint32_t web_session_id_length,
- Time new_expiry_time) = 0;
-
- // Called by the CDM when session |web_session_id| is ready.
- // Note: "ready" event is deprecated. This is only used for the prefixed EME
- // API's "keyAdded" event. Drop this when we deprecate prefixed EME API.
- // Length parameter should not include null termination.
- virtual void OnSessionReady(
- const char* web_session_id, uint32_t web_session_id_length) = 0;
-
- // Called by the CDM when session |web_session_id| is closed. Length
- // parameter should not include null termination.
- virtual void OnSessionClosed(
- const char* web_session_id, uint32_t web_session_id_length) = 0;
-
- // Called by the CDM when an error occurs in session |web_session_id|
- // unrelated to one of the ContentDecryptionModule calls that accept a
- // |promise_id|. |error| must be specified, |error_message| and
- // |system_code| are optional. Length parameters should not include null
- // termination.
- virtual void OnSessionError(
- const char* web_session_id, uint32_t web_session_id_length,
- Error error,
- uint32_t system_code,
- const char* error_message, uint32_t error_message_length) = 0;
-
- // The following are optional methods that may not be implemented on all
- // platforms.
-
- // Sends a platform challenge for the given |service_id|. |challenge| is at
- // most 256 bits of data to be signed. Once the challenge has been completed,
- // the host will call ContentDecryptionModule::OnPlatformChallengeResponse()
- // with the signed challenge response and platform certificate. Length
- // parameters should not include null termination.
- virtual void SendPlatformChallenge(
- const char* service_id, uint32_t service_id_length,
- const char* challenge, uint32_t challenge_length) = 0;
-
- // Attempts to enable output protection (e.g. HDCP) on the display link. The
- // |desired_protection_mask| is a bit mask of OutputProtectionMethods. No
- // status callback is issued, the CDM must call QueryOutputProtectionStatus()
- // periodically to ensure the desired protections are applied.
- virtual void EnableOutputProtection(uint32_t desired_protection_mask) = 0;
-
- // Requests the current output protection status. Once the host has the status
- // it will call ContentDecryptionModule::OnQueryOutputProtectionStatus().
- virtual void QueryOutputProtectionStatus() = 0;
-
- // Must be called by the CDM if it returned kDeferredInitialization during
- // InitializeAudioDecoder() or InitializeVideoDecoder().
- virtual void OnDeferredInitializationDone(StreamType stream_type,
- Status decoder_status) = 0;
-
- // Creates a FileIO object from the host to do file IO operation. Returns NULL
- // if a FileIO object cannot be obtained. Once a valid FileIO object is
- // returned, |client| must be valid until FileIO::Close() is called. The
- // CDM can call this method multiple times to operate on different files.
- virtual FileIO* CreateFileIO(FileIOClient* client) = 0;
-
- protected:
- Host_5() {}
- virtual ~Host_5() {}
-};
-
class Host_6 {
public:
static const int kVersion = 6;
//
// |<----------------- AudioFrames ------------------>|
// | audio buffer 0 | audio buffer 1 | audio buffer 2 |
-class AudioFrames_2 {
+class AudioFrames {
public:
virtual void SetFrameBuffer(Buffer* buffer) = 0;
virtual Buffer* FrameBuffer() = 0;
virtual AudioFormat Format() const = 0;
protected:
- AudioFrames_2() {}
- virtual ~AudioFrames_2() {}
+ AudioFrames() {}
+ virtual ~AudioFrames() {}
};
} // namespace cdm