| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #ifndef CDM_CONTENT_DECRYPTION_MODULE_H_ | 5 #ifndef CDM_CONTENT_DECRYPTION_MODULE_H_ |
| 6 #define CDM_CONTENT_DECRYPTION_MODULE_H_ | 6 #define CDM_CONTENT_DECRYPTION_MODULE_H_ |
| 7 | 7 |
| 8 #if defined(_MSC_VER) | 8 #if defined(_MSC_VER) |
| 9 typedef unsigned char uint8_t; | 9 typedef unsigned char uint8_t; |
| 10 typedef unsigned int uint32_t; | 10 typedef unsigned int uint32_t; |
| (...skipping 451 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 462 | 462 |
| 463 // Creates a session given |init_data_type|, |init_data| and |session_type|. | 463 // Creates a session given |init_data_type|, |init_data| and |session_type|. |
| 464 // The CDM must respond by calling either Host::OnResolveNewSessionPromise() | 464 // The CDM must respond by calling either Host::OnResolveNewSessionPromise() |
| 465 // or Host::OnRejectPromise(). | 465 // or Host::OnRejectPromise(). |
| 466 virtual void CreateSession( | 466 virtual void CreateSession( |
| 467 uint32_t promise_id, | 467 uint32_t promise_id, |
| 468 const char* init_data_type, uint32_t init_data_type_size, | 468 const char* init_data_type, uint32_t init_data_type_size, |
| 469 const uint8_t* init_data, uint32_t init_data_size, | 469 const uint8_t* init_data, uint32_t init_data_size, |
| 470 SessionType session_type) = 0; | 470 SessionType session_type) = 0; |
| 471 | 471 |
| 472 // Loads the session with |web_session_id|. The CDM must respond by calling | 472 // Loads the session with |session_id|. The CDM must respond by calling |
| 473 // either Host::OnResolveNewSessionPromise() or Host::OnRejectPromise(). | 473 // either Host::OnResolveNewSessionPromise() or Host::OnRejectPromise(). |
| 474 // If the session is not found, call Host::OnResolveNewSessionPromise() | 474 // If the session is not found, call Host::OnResolveNewSessionPromise() |
| 475 // with web_session_id = NULL. | 475 // with session_id = NULL. |
| 476 virtual void LoadSession( | 476 virtual void LoadSession( |
| 477 uint32_t promise_id, | 477 uint32_t promise_id, |
| 478 const char* web_session_id, uint32_t web_session_id_length) = 0; | 478 const char* session_id, uint32_t session_id_length) = 0; |
| 479 | 479 |
| 480 // Updates the session with |response|. The CDM must respond by calling | 480 // Updates the session with |response|. The CDM must respond by calling |
| 481 // either Host::OnResolvePromise() or Host::OnRejectPromise(). | 481 // either Host::OnResolvePromise() or Host::OnRejectPromise(). |
| 482 virtual void UpdateSession( | 482 virtual void UpdateSession( |
| 483 uint32_t promise_id, | 483 uint32_t promise_id, |
| 484 const char* web_session_id, uint32_t web_session_id_length, | 484 const char* session_id, uint32_t session_id_length, |
| 485 const uint8_t* response, uint32_t response_size) = 0; | 485 const uint8_t* response, uint32_t response_size) = 0; |
| 486 | 486 |
| 487 // Requests that the CDM close the session. The CDM must respond by calling | 487 // Requests that the CDM close the session. The CDM must respond by calling |
| 488 // either Host::OnResolvePromise() or Host::OnRejectPromise() when the request | 488 // either Host::OnResolvePromise() or Host::OnRejectPromise() when the request |
| 489 // has been processed. This may be before the session is closed. Once the | 489 // has been processed. This may be before the session is closed. Once the |
| 490 // session is closed, Host::OnSessionClosed() must also be called. | 490 // session is closed, Host::OnSessionClosed() must also be called. |
| 491 virtual void CloseSession( | 491 virtual void CloseSession( |
| 492 uint32_t promise_id, | 492 uint32_t promise_id, |
| 493 const char* web_session_id, uint32_t web_session_id_length) = 0; | 493 const char* session_id, uint32_t session_id_length) = 0; |
| 494 | 494 |
| 495 // Removes any stored session data associated with this session. Will only be | 495 // Removes any stored session data associated with this session. Will only be |
| 496 // called for persistent sessions. The CDM must respond by calling either | 496 // called for persistent sessions. The CDM must respond by calling either |
| 497 // Host::OnResolvePromise() or Host::OnRejectPromise() when the request has | 497 // Host::OnResolvePromise() or Host::OnRejectPromise() when the request has |
| 498 // been processed. | 498 // been processed. |
| 499 virtual void RemoveSession( | 499 virtual void RemoveSession( |
| 500 uint32_t promise_id, | 500 uint32_t promise_id, |
| 501 const char* web_session_id, uint32_t web_session_id_length) = 0; | 501 const char* session_id, uint32_t session_id_length) = 0; |
| 502 | 502 |
| 503 // Requests the key IDs for keys in the session that the CDM knows are | 503 // Requests the key IDs for keys in the session that the CDM knows are |
| 504 // currently usable to decrypt media data. The CDM must respond by calling | 504 // currently usable to decrypt media data. The CDM must respond by calling |
| 505 // either Host::OnResolveKeyIdsPromise() or Host::OnRejectPromise(). | 505 // either Host::OnResolveKeyIdsPromise() or Host::OnRejectPromise(). |
| 506 virtual void GetUsableKeyIds( | 506 virtual void GetUsableKeyIds( |
| 507 uint32_t promise_id, | 507 uint32_t promise_id, |
| 508 const char* web_session_id, uint32_t web_session_id_length) = 0; | 508 const char* session_id, uint32_t session_id_length) = 0; |
| 509 | 509 |
| 510 // Provides a server certificate to be used to encrypt messages to the | 510 // Provides a server certificate to be used to encrypt messages to the |
| 511 // license server. The CDM must respond by calling either | 511 // license server. The CDM must respond by calling either |
| 512 // Host::OnResolvePromise() or Host::OnRejectPromise(). | 512 // Host::OnResolvePromise() or Host::OnRejectPromise(). |
| 513 virtual void SetServerCertificate( | 513 virtual void SetServerCertificate( |
| 514 uint32_t promise_id, | 514 uint32_t promise_id, |
| 515 const uint8_t* server_certificate_data, | 515 const uint8_t* server_certificate_data, |
| 516 uint32_t server_certificate_data_size) = 0; | 516 uint32_t server_certificate_data_size) = 0; |
| 517 | 517 |
| 518 // Performs scheduled operation with |context| when the timer fires. | 518 // Performs scheduled operation with |context| when the timer fires. |
| (...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 836 virtual Buffer* Allocate(uint32_t capacity) = 0; | 836 virtual Buffer* Allocate(uint32_t capacity) = 0; |
| 837 | 837 |
| 838 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| | 838 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| |
| 839 // from now with |context|. | 839 // from now with |context|. |
| 840 virtual void SetTimer(int64_t delay_ms, void* context) = 0; | 840 virtual void SetTimer(int64_t delay_ms, void* context) = 0; |
| 841 | 841 |
| 842 // Returns the current wall time in seconds. | 842 // Returns the current wall time in seconds. |
| 843 virtual Time GetCurrentWallTime() = 0; | 843 virtual Time GetCurrentWallTime() = 0; |
| 844 | 844 |
| 845 // Called by the CDM when a session is created or loaded and the value for the | 845 // Called by the CDM when a session is created or loaded and the value for the |
| 846 // MediaKeySession's sessionId attribute is available (|web_session_id|). | 846 // MediaKeySession's sessionId attribute is available (|session_id|). |
| 847 // This must be called before OnSessionMessage() or | 847 // This must be called before OnSessionMessage() or |
| 848 // OnSessionUsableKeysChange() is called for the same session. | 848 // OnSessionUsableKeysChange() is called for the same session. |
| 849 // |web_session_id_length| should not include null termination. | 849 // |session_id_length| should not include null termination. |
| 850 // When called in response to LoadSession(), the |web_session_id| must be the | 850 // When called in response to LoadSession(), the |session_id| must be the |
| 851 // same as the |web_session_id| passed in LoadSession(), or NULL if the | 851 // same as the |session_id| passed in LoadSession(), or NULL if the |
| 852 // session could not be loaded. | 852 // session could not be loaded. |
| 853 virtual void OnResolveNewSessionPromise( | 853 virtual void OnResolveNewSessionPromise( |
| 854 uint32_t promise_id, | 854 uint32_t promise_id, |
| 855 const char* web_session_id, uint32_t web_session_id_length) = 0; | 855 const char* session_id, uint32_t session_id_length) = 0; |
| 856 | 856 |
| 857 // Called by the CDM when a session is updated or released. | 857 // Called by the CDM when a session is updated or released. |
| 858 virtual void OnResolvePromise(uint32_t promise_id) = 0; | 858 virtual void OnResolvePromise(uint32_t promise_id) = 0; |
| 859 | 859 |
| 860 // Called by the CDM to return a list of key IDs. The caller owns the | 860 // Called by the CDM to return a list of key IDs. The caller owns the |
| 861 // BinaryData array and the values the elements reference. | 861 // BinaryData array and the values the elements reference. |
| 862 virtual void OnResolveKeyIdsPromise( | 862 virtual void OnResolveKeyIdsPromise( |
| 863 uint32_t promise_id, | 863 uint32_t promise_id, |
| 864 const BinaryData* key_ids, uint32_t key_ids_length) = 0; | 864 const BinaryData* key_ids, uint32_t key_ids_length) = 0; |
| 865 | 865 |
| 866 // Called by the CDM when an error occurs as a result of one of the | 866 // Called by the CDM when an error occurs as a result of one of the |
| 867 // ContentDecryptionModule calls that accept a |promise_id|. | 867 // ContentDecryptionModule calls that accept a |promise_id|. |
| 868 // |error| must be specified, |error_message| and |system_code| | 868 // |error| must be specified, |error_message| and |system_code| |
| 869 // are optional. Length parameters should not include null termination. | 869 // are optional. Length parameters should not include null termination. |
| 870 virtual void OnRejectPromise( | 870 virtual void OnRejectPromise( |
| 871 uint32_t promise_id, | 871 uint32_t promise_id, |
| 872 Error error, | 872 Error error, |
| 873 uint32_t system_code, | 873 uint32_t system_code, |
| 874 const char* error_message, uint32_t error_message_length) = 0; | 874 const char* error_message, uint32_t error_message_length) = 0; |
| 875 | 875 |
| 876 // Called by the CDM when it has a message for session |web_session_id|. | 876 // Called by the CDM when it has a message for session |session_id|. |
| 877 // Length parameters should not include null termination. | 877 // Length parameters should not include null termination. |
| 878 virtual void OnSessionMessage( | 878 virtual void OnSessionMessage( |
| 879 const char* web_session_id, uint32_t web_session_id_length, | 879 const char* session_id, uint32_t session_id_length, |
| 880 const char* message, uint32_t message_length, | 880 const char* message, uint32_t message_length, |
| 881 const char* destination_url, uint32_t destination_url_length) = 0; | 881 const char* destination_url, uint32_t destination_url_length) = 0; |
| 882 | 882 |
| 883 // Called by the CDM when there has been a change in usable keys for | 883 // Called by the CDM when there has been a change in usable keys for |
| 884 // session |web_session_id|. |has_additional_usable_key| should be set if a | 884 // session |session_id|. |has_additional_usable_key| should be set if a |
| 885 // key is newly usable (e.g. new key available, previously expired key has | 885 // key is newly usable (e.g. new key available, previously expired key has |
| 886 // been renewed, etc.) and the browser should attempt to resume playback. | 886 // been renewed, etc.) and the browser should attempt to resume playback. |
| 887 // Length parameter should not include null termination. | 887 // Length parameter should not include null termination. |
| 888 virtual void OnSessionUsableKeysChange( | 888 virtual void OnSessionUsableKeysChange( |
| 889 const char* web_session_id, uint32_t web_session_id_length, | 889 const char* session_id, uint32_t session_id_length, |
| 890 bool has_additional_usable_key) = 0; | 890 bool has_additional_usable_key) = 0; |
| 891 | 891 |
| 892 // Called by the CDM when there has been a change in the expiration time for | 892 // Called by the CDM when there has been a change in the expiration time for |
| 893 // session |web_session_id|. This can happen as the result of an Update() call | 893 // session |session_id|. This can happen as the result of an Update() call |
| 894 // or some other event. If this happens as a result of a call to Update(), | 894 // or some other event. If this happens as a result of a call to Update(), |
| 895 // it must be called before resolving the Update() promise. |new_expiry_time| | 895 // it must be called before resolving the Update() promise. |new_expiry_time| |
| 896 // can be 0 to represent "undefined". Length parameter should not include | 896 // can be 0 to represent "undefined". Length parameter should not include |
| 897 // null termination. | 897 // null termination. |
| 898 virtual void OnExpirationChange( | 898 virtual void OnExpirationChange( |
| 899 const char* web_session_id, uint32_t web_session_id_length, | 899 const char* session_id, uint32_t session_id_length, |
| 900 Time new_expiry_time) = 0; | 900 Time new_expiry_time) = 0; |
| 901 | 901 |
| 902 // Called by the CDM when session |web_session_id| is closed. Length | 902 // Called by the CDM when session |session_id| is closed. Length |
| 903 // parameter should not include null termination. | 903 // parameter should not include null termination. |
| 904 virtual void OnSessionClosed( | 904 virtual void OnSessionClosed( |
| 905 const char* web_session_id, uint32_t web_session_id_length) = 0; | 905 const char* session_id, uint32_t session_id_length) = 0; |
| 906 | 906 |
| 907 // Called by the CDM when an error occurs in session |web_session_id| | 907 // Called by the CDM when an error occurs in session |session_id| |
| 908 // unrelated to one of the ContentDecryptionModule calls that accept a | 908 // unrelated to one of the ContentDecryptionModule calls that accept a |
| 909 // |promise_id|. |error| must be specified, |error_message| and | 909 // |promise_id|. |error| must be specified, |error_message| and |
| 910 // |system_code| are optional. Length parameters should not include null | 910 // |system_code| are optional. Length parameters should not include null |
| 911 // termination. | 911 // termination. |
| 912 virtual void OnSessionError( | 912 virtual void OnSessionError( |
| 913 const char* web_session_id, uint32_t web_session_id_length, | 913 const char* session_id, uint32_t session_id_length, |
| 914 Error error, | 914 Error error, |
| 915 uint32_t system_code, | 915 uint32_t system_code, |
| 916 const char* error_message, uint32_t error_message_length) = 0; | 916 const char* error_message, uint32_t error_message_length) = 0; |
| 917 | 917 |
| 918 // The following are optional methods that may not be implemented on all | 918 // The following are optional methods that may not be implemented on all |
| 919 // platforms. | 919 // platforms. |
| 920 | 920 |
| 921 // Sends a platform challenge for the given |service_id|. |challenge| is at | 921 // Sends a platform challenge for the given |service_id|. |challenge| is at |
| 922 // most 256 bits of data to be signed. Once the challenge has been completed, | 922 // most 256 bits of data to be signed. Once the challenge has been completed, |
| 923 // the host will call ContentDecryptionModule::OnPlatformChallengeResponse() | 923 // the host will call ContentDecryptionModule::OnPlatformChallengeResponse() |
| (...skipping 237 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1161 virtual AudioFormat Format() const = 0; | 1161 virtual AudioFormat Format() const = 0; |
| 1162 | 1162 |
| 1163 protected: | 1163 protected: |
| 1164 AudioFrames() {} | 1164 AudioFrames() {} |
| 1165 virtual ~AudioFrames() {} | 1165 virtual ~AudioFrames() {} |
| 1166 }; | 1166 }; |
| 1167 | 1167 |
| 1168 } // namespace cdm | 1168 } // namespace cdm |
| 1169 | 1169 |
| 1170 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ | 1170 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ |
| OLD | NEW |