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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 } | 74 } |
75 | 75 |
76 namespace cdm { | 76 namespace cdm { |
77 | 77 |
78 class AudioFrames; | 78 class AudioFrames; |
79 class DecryptedBlock; | 79 class DecryptedBlock; |
80 class VideoFrame; | 80 class VideoFrame; |
81 | 81 |
82 class Host_6; | 82 class Host_6; |
83 class Host_7; | 83 class Host_7; |
| 84 class Host_8; |
84 | 85 |
85 enum Status { | 86 enum Status { |
86 kSuccess = 0, | 87 kSuccess = 0, |
87 kNeedMoreData, // Decoder needs more data to produce a decoded frame/sample. | 88 kNeedMoreData, // Decoder needs more data to produce a decoded frame/sample. |
88 kNoKey, // The required decryption key is not available. | 89 kNoKey, // The required decryption key is not available. |
89 kSessionError, // Session management error. | 90 kSessionError, // Session management error. |
90 kDecryptError, // Decryption failed. | 91 kDecryptError, // Decryption failed. |
91 kDecodeError, // Error decoding audio or video. | 92 kDecodeError, // Error decoding audio or video. |
92 kDeferredInitialization // Decoder is not ready for initialization. | 93 kDeferredInitialization // Decoder is not ready for initialization. |
93 }; | 94 }; |
(...skipping 204 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
298 const uint8_t* data; | 299 const uint8_t* data; |
299 uint32_t length; | 300 uint32_t length; |
300 }; | 301 }; |
301 | 302 |
302 // The current status of the associated key. The valid types are defined in the | 303 // The current status of the associated key. The valid types are defined in the |
303 // spec: https://w3c.github.io/encrypted-media/#idl-def-MediaKeyStatus | 304 // spec: https://w3c.github.io/encrypted-media/#idl-def-MediaKeyStatus |
304 enum KeyStatus { | 305 enum KeyStatus { |
305 kUsable = 0, | 306 kUsable = 0, |
306 kInternalError = 1, | 307 kInternalError = 1, |
307 kExpired = 2, | 308 kExpired = 2, |
308 kOutputNotAllowed = 3 | 309 kOutputNotAllowed = 3, |
| 310 kOutputDownscaled = 4, |
| 311 kStatusPending = 5 |
309 }; | 312 }; |
310 | 313 |
311 // Used when passing arrays of key information. Does not own the referenced | 314 // Used when passing arrays of key information. Does not own the referenced |
312 // data. |system_code| is an additional error code for unusable keys and | 315 // data. |system_code| is an additional error code for unusable keys and |
313 // should be 0 when |status| == kUsable. | 316 // should be 0 when |status| == kUsable. |
314 struct KeyInformation { | 317 struct KeyInformation { |
315 KeyInformation() | 318 KeyInformation() |
316 : key_id(NULL), key_id_size(0), status(kInternalError), system_code(0) {} | 319 : key_id(NULL), key_id_size(0), status(kInternalError), system_code(0) {} |
317 const uint8_t* key_id; | 320 const uint8_t* key_id; |
318 uint32_t key_id_size; | 321 uint32_t key_id_size; |
(...skipping 19 matching lines...) Expand all Loading... |
338 kLinkTypeDisplayPort = 1 << 5, | 341 kLinkTypeDisplayPort = 1 << 5, |
339 kLinkTypeNetwork = 1 << 6 | 342 kLinkTypeNetwork = 1 << 6 |
340 }; | 343 }; |
341 | 344 |
342 // Result of the QueryOutputProtectionStatus() call. | 345 // Result of the QueryOutputProtectionStatus() call. |
343 enum QueryResult { | 346 enum QueryResult { |
344 kQuerySucceeded = 0, | 347 kQuerySucceeded = 0, |
345 kQueryFailed | 348 kQueryFailed |
346 }; | 349 }; |
347 | 350 |
| 351 // The Initialization Data Type. The valid types are defined in the spec: |
| 352 // http://w3c.github.io/encrypted-media/initdata-format-registry.html#registry |
| 353 enum InitDataType { |
| 354 kCenc = 0, |
| 355 kKeyIds = 1, |
| 356 kWebM = 2 |
| 357 }; |
| 358 |
348 // The type of session to create. The valid types are defined in the spec: | 359 // The type of session to create. The valid types are defined in the spec: |
349 // https://w3c.github.io/encrypted-media/#idl-def-SessionType | 360 // https://w3c.github.io/encrypted-media/#idl-def-SessionType |
350 enum SessionType { | 361 enum SessionType { |
351 kTemporary = 0, | 362 kTemporary = 0, |
352 kPersistentLicense = 1, | 363 kPersistentLicense = 1, |
353 kPersistentKeyRelease = 2 | 364 kPersistentKeyRelease = 2 |
354 }; | 365 }; |
355 | 366 |
356 // The type of the message event. The valid types are defined in the spec: | 367 // The type of the message event. The valid types are defined in the spec: |
357 // https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType | 368 // https://w3c.github.io/encrypted-media/#idl-def-MediaKeyMessageType |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
796 uint32_t output_protection_mask) = 0; | 807 uint32_t output_protection_mask) = 0; |
797 | 808 |
798 // Destroys the object in the same context as it was created. | 809 // Destroys the object in the same context as it was created. |
799 virtual void Destroy() = 0; | 810 virtual void Destroy() = 0; |
800 | 811 |
801 protected: | 812 protected: |
802 ContentDecryptionModule_7() {} | 813 ContentDecryptionModule_7() {} |
803 virtual ~ContentDecryptionModule_7() {} | 814 virtual ~ContentDecryptionModule_7() {} |
804 }; | 815 }; |
805 | 816 |
806 typedef ContentDecryptionModule_7 ContentDecryptionModule; | 817 // ContentDecryptionModule interface that all CDMs need to implement. |
| 818 // The interface is versioned for backward compatibility. |
| 819 // Note: ContentDecryptionModule implementations must use the allocator |
| 820 // provided in CreateCdmInstance() to allocate any Buffer that needs to |
| 821 // be passed back to the caller. Implementations must call Buffer::Destroy() |
| 822 // when a Buffer is created that will never be returned to the caller. |
| 823 class ContentDecryptionModule_8 { |
| 824 public: |
| 825 static const int kVersion = 8; |
| 826 typedef Host_8 Host; |
| 827 |
| 828 // Initializes the CDM instance, providing information about permitted |
| 829 // functionalities. |
| 830 // If |allow_distinctive_identifier| is false, messages from the CDM, |
| 831 // such as message events, must not contain a Distinctive Identifier, |
| 832 // even in an encrypted form. |
| 833 // If |allow_persistent_state| is false, the CDM must not attempt to |
| 834 // persist state. Calls to CreateFileIO() will fail. |
| 835 virtual void Initialize(bool allow_distinctive_identifier, |
| 836 bool allow_persistent_state) = 0; |
| 837 |
| 838 // SetServerCertificate(), CreateSessionAndGenerateRequest(), LoadSession(), |
| 839 // UpdateSession(), CloseSession(), and RemoveSession() all accept a |
| 840 // |promise_id|, which must be passed to the completion Host method |
| 841 // (e.g. Host::OnResolveNewSessionPromise()). |
| 842 |
| 843 // Provides a server certificate to be used to encrypt messages to the |
| 844 // license server. The CDM must respond by calling either |
| 845 // Host::OnResolvePromise() or Host::OnRejectPromise(). |
| 846 virtual void SetServerCertificate(uint32_t promise_id, |
| 847 const uint8_t* server_certificate_data, |
| 848 uint32_t server_certificate_data_size) = 0; |
| 849 |
| 850 // Creates a session given |session_type|, |init_data_type|, and |init_data|. |
| 851 // The CDM must respond by calling either Host::OnResolveNewSessionPromise() |
| 852 // or Host::OnRejectPromise(). |
| 853 virtual void CreateSessionAndGenerateRequest(uint32_t promise_id, |
| 854 SessionType session_type, |
| 855 InitDataType init_data_type, |
| 856 const uint8_t* init_data, |
| 857 uint32_t init_data_size) = 0; |
| 858 |
| 859 // Loads the session of type |session_type| specified by |session_id|. |
| 860 // The CDM must respond by calling either Host::OnResolveNewSessionPromise() |
| 861 // or Host::OnRejectPromise(). If the session is not found, call |
| 862 // Host::OnResolveNewSessionPromise() with session_id = NULL. |
| 863 virtual void LoadSession(uint32_t promise_id, |
| 864 SessionType session_type, |
| 865 const char* session_id, |
| 866 uint32_t session_id_size) = 0; |
| 867 |
| 868 // Updates the session with |response|. The CDM must respond by calling |
| 869 // either Host::OnResolvePromise() or Host::OnRejectPromise(). |
| 870 virtual void UpdateSession(uint32_t promise_id, |
| 871 const char* session_id, |
| 872 uint32_t session_id_size, |
| 873 const uint8_t* response, |
| 874 uint32_t response_size) = 0; |
| 875 |
| 876 // Requests that the CDM close the session. The CDM must respond by calling |
| 877 // either Host::OnResolvePromise() or Host::OnRejectPromise() when the request |
| 878 // has been processed. This may be before the session is closed. Once the |
| 879 // session is closed, Host::OnSessionClosed() must also be called. |
| 880 virtual void CloseSession(uint32_t promise_id, |
| 881 const char* session_id, |
| 882 uint32_t session_id_size) = 0; |
| 883 |
| 884 // Removes any stored session data associated with this session. Will only be |
| 885 // called for persistent sessions. The CDM must respond by calling either |
| 886 // Host::OnResolvePromise() or Host::OnRejectPromise() when the request has |
| 887 // been processed. |
| 888 virtual void RemoveSession(uint32_t promise_id, |
| 889 const char* session_id, |
| 890 uint32_t session_id_size) = 0; |
| 891 |
| 892 // Performs scheduled operation with |context| when the timer fires. |
| 893 virtual void TimerExpired(void* context) = 0; |
| 894 |
| 895 // Decrypts the |encrypted_buffer|. |
| 896 // |
| 897 // Returns kSuccess if decryption succeeded, in which case the callee |
| 898 // should have filled the |decrypted_buffer| and passed the ownership of |
| 899 // |data| in |decrypted_buffer| to the caller. |
| 900 // Returns kNoKey if the CDM did not have the necessary decryption key |
| 901 // to decrypt. |
| 902 // Returns kDecryptError if any other error happened. |
| 903 // If the return value is not kSuccess, |decrypted_buffer| should be ignored |
| 904 // by the caller. |
| 905 virtual Status Decrypt(const InputBuffer& encrypted_buffer, |
| 906 DecryptedBlock* decrypted_buffer) = 0; |
| 907 |
| 908 // Initializes the CDM audio decoder with |audio_decoder_config|. This |
| 909 // function must be called before DecryptAndDecodeSamples() is called. |
| 910 // |
| 911 // Returns kSuccess if the |audio_decoder_config| is supported and the CDM |
| 912 // audio decoder is successfully initialized. |
| 913 // Returns kSessionError if |audio_decoder_config| is not supported. The CDM |
| 914 // may still be able to do Decrypt(). |
| 915 // Returns kDeferredInitialization if the CDM is not ready to initialize the |
| 916 // decoder at this time. Must call Host::OnDeferredInitializationDone() once |
| 917 // initialization is complete. |
| 918 virtual Status InitializeAudioDecoder( |
| 919 const AudioDecoderConfig& audio_decoder_config) = 0; |
| 920 |
| 921 // Initializes the CDM video decoder with |video_decoder_config|. This |
| 922 // function must be called before DecryptAndDecodeFrame() is called. |
| 923 // |
| 924 // Returns kSuccess if the |video_decoder_config| is supported and the CDM |
| 925 // video decoder is successfully initialized. |
| 926 // Returns kSessionError if |video_decoder_config| is not supported. The CDM |
| 927 // may still be able to do Decrypt(). |
| 928 // Returns kDeferredInitialization if the CDM is not ready to initialize the |
| 929 // decoder at this time. Must call Host::OnDeferredInitializationDone() once |
| 930 // initialization is complete. |
| 931 virtual Status InitializeVideoDecoder( |
| 932 const VideoDecoderConfig& video_decoder_config) = 0; |
| 933 |
| 934 // De-initializes the CDM decoder and sets it to an uninitialized state. The |
| 935 // caller can initialize the decoder again after this call to re-initialize |
| 936 // it. This can be used to reconfigure the decoder if the configuration |
| 937 // changes. |
| 938 virtual void DeinitializeDecoder(StreamType decoder_type) = 0; |
| 939 |
| 940 // Resets the CDM decoder to an initialized clean state. All internal buffers |
| 941 // MUST be flushed. |
| 942 virtual void ResetDecoder(StreamType decoder_type) = 0; |
| 943 |
| 944 // Decrypts the |encrypted_buffer| and decodes the decrypted buffer into a |
| 945 // |video_frame|. Upon end-of-stream, the caller should call this function |
| 946 // repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty |
| 947 // |video_frame| (|format| == kEmptyVideoFrame) is produced. |
| 948 // |
| 949 // Returns kSuccess if decryption and decoding both succeeded, in which case |
| 950 // the callee will have filled the |video_frame| and passed the ownership of |
| 951 // |frame_buffer| in |video_frame| to the caller. |
| 952 // Returns kNoKey if the CDM did not have the necessary decryption key |
| 953 // to decrypt. |
| 954 // Returns kNeedMoreData if more data was needed by the decoder to generate |
| 955 // a decoded frame (e.g. during initialization and end-of-stream). |
| 956 // Returns kDecryptError if any decryption error happened. |
| 957 // Returns kDecodeError if any decoding error happened. |
| 958 // If the return value is not kSuccess, |video_frame| should be ignored by |
| 959 // the caller. |
| 960 virtual Status DecryptAndDecodeFrame(const InputBuffer& encrypted_buffer, |
| 961 VideoFrame* video_frame) = 0; |
| 962 |
| 963 // Decrypts the |encrypted_buffer| and decodes the decrypted buffer into |
| 964 // |audio_frames|. Upon end-of-stream, the caller should call this function |
| 965 // repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty |
| 966 // |audio_frames| is produced. |
| 967 // |
| 968 // Returns kSuccess if decryption and decoding both succeeded, in which case |
| 969 // the callee will have filled |audio_frames| and passed the ownership of |
| 970 // |data| in |audio_frames| to the caller. |
| 971 // Returns kNoKey if the CDM did not have the necessary decryption key |
| 972 // to decrypt. |
| 973 // Returns kNeedMoreData if more data was needed by the decoder to generate |
| 974 // audio samples (e.g. during initialization and end-of-stream). |
| 975 // Returns kDecryptError if any decryption error happened. |
| 976 // Returns kDecodeError if any decoding error happened. |
| 977 // If the return value is not kSuccess, |audio_frames| should be ignored by |
| 978 // the caller. |
| 979 virtual Status DecryptAndDecodeSamples(const InputBuffer& encrypted_buffer, |
| 980 AudioFrames* audio_frames) = 0; |
| 981 |
| 982 // Called by the host after a platform challenge was initiated via |
| 983 // Host::SendPlatformChallenge(). |
| 984 virtual void OnPlatformChallengeResponse( |
| 985 const PlatformChallengeResponse& response) = 0; |
| 986 |
| 987 // Called by the host after a call to Host::QueryOutputProtectionStatus(). The |
| 988 // |link_mask| is a bit mask of OutputLinkTypes and |output_protection_mask| |
| 989 // is a bit mask of OutputProtectionMethods. If |result| is kQueryFailed, |
| 990 // then |link_mask| and |output_protection_mask| are undefined and should |
| 991 // be ignored. |
| 992 virtual void OnQueryOutputProtectionStatus( |
| 993 QueryResult result, |
| 994 uint32_t link_mask, |
| 995 uint32_t output_protection_mask) = 0; |
| 996 |
| 997 // Destroys the object in the same context as it was created. |
| 998 virtual void Destroy() = 0; |
| 999 |
| 1000 protected: |
| 1001 ContentDecryptionModule_8() {} |
| 1002 virtual ~ContentDecryptionModule_8() {} |
| 1003 }; |
| 1004 |
| 1005 typedef ContentDecryptionModule_8 ContentDecryptionModule; |
807 | 1006 |
808 // Represents a buffer created by Allocator implementations. | 1007 // Represents a buffer created by Allocator implementations. |
809 class Buffer { | 1008 class Buffer { |
810 public: | 1009 public: |
811 // Destroys the buffer in the same context as it was created. | 1010 // Destroys the buffer in the same context as it was created. |
812 virtual void Destroy() = 0; | 1011 virtual void Destroy() = 0; |
813 | 1012 |
814 virtual uint32_t Capacity() const = 0; | 1013 virtual uint32_t Capacity() const = 0; |
815 virtual uint8_t* Data() = 0; | 1014 virtual uint8_t* Data() = 0; |
816 virtual void SetSize(uint32_t size) = 0; | 1015 virtual void SetSize(uint32_t size) = 0; |
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1083 // if a FileIO object cannot be obtained. Once a valid FileIO object is | 1282 // if a FileIO object cannot be obtained. Once a valid FileIO object is |
1084 // returned, |client| must be valid until FileIO::Close() is called. The | 1283 // returned, |client| must be valid until FileIO::Close() is called. The |
1085 // CDM can call this method multiple times to operate on different files. | 1284 // CDM can call this method multiple times to operate on different files. |
1086 virtual FileIO* CreateFileIO(FileIOClient* client) = 0; | 1285 virtual FileIO* CreateFileIO(FileIOClient* client) = 0; |
1087 | 1286 |
1088 protected: | 1287 protected: |
1089 Host_7() {} | 1288 Host_7() {} |
1090 virtual ~Host_7() {} | 1289 virtual ~Host_7() {} |
1091 }; | 1290 }; |
1092 | 1291 |
| 1292 class Host_8 { |
| 1293 public: |
| 1294 static const int kVersion = 8; |
| 1295 |
| 1296 // Returns a Buffer* containing non-zero members upon success, or NULL on |
| 1297 // failure. The caller owns the Buffer* after this call. The buffer is not |
| 1298 // guaranteed to be zero initialized. The capacity of the allocated Buffer |
| 1299 // is guaranteed to be not less than |capacity|. |
| 1300 virtual Buffer* Allocate(uint32_t capacity) = 0; |
| 1301 |
| 1302 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| |
| 1303 // from now with |context|. |
| 1304 virtual void SetTimer(int64_t delay_ms, void* context) = 0; |
| 1305 |
| 1306 // Returns the current wall time in seconds. |
| 1307 virtual Time GetCurrentWallTime() = 0; |
| 1308 |
| 1309 // Called by the CDM when a session is created or loaded and the value for the |
| 1310 // MediaKeySession's sessionId attribute is available (|session_id|). |
| 1311 // This must be called before OnSessionMessage() or |
| 1312 // OnSessionKeysChange() is called for the same session. |session_id_size| |
| 1313 // should not include null termination. |
| 1314 // When called in response to LoadSession(), the |session_id| must be the |
| 1315 // same as the |session_id| passed in LoadSession(), or NULL if the |
| 1316 // session could not be loaded. |
| 1317 virtual void OnResolveNewSessionPromise(uint32_t promise_id, |
| 1318 const char* session_id, |
| 1319 uint32_t session_id_size) = 0; |
| 1320 |
| 1321 // Called by the CDM when a session is updated or released. |
| 1322 virtual void OnResolvePromise(uint32_t promise_id) = 0; |
| 1323 |
| 1324 // Called by the CDM when an error occurs as a result of one of the |
| 1325 // ContentDecryptionModule calls that accept a |promise_id|. |
| 1326 // |error| must be specified, |error_message| and |system_code| |
| 1327 // are optional. |error_message_size| should not include null termination. |
| 1328 virtual void OnRejectPromise(uint32_t promise_id, |
| 1329 Error error, |
| 1330 uint32_t system_code, |
| 1331 const char* error_message, |
| 1332 uint32_t error_message_size) = 0; |
| 1333 |
| 1334 // Called by the CDM when it has a message for session |session_id|. |
| 1335 // Size parameters should not include null termination. |
| 1336 // |legacy_destination_url| is only for supporting the prefixed EME API and |
| 1337 // is ignored by unprefixed EME. It should only be non-null if |message_type| |
| 1338 // is kLicenseRenewal. |
| 1339 virtual void OnSessionMessage(const char* session_id, |
| 1340 uint32_t session_id_size, |
| 1341 MessageType message_type, |
| 1342 const char* message, |
| 1343 uint32_t message_size, |
| 1344 const char* legacy_destination_url, |
| 1345 uint32_t legacy_destination_url_length) = 0; |
| 1346 |
| 1347 // Called by the CDM when there has been a change in keys or their status for |
| 1348 // session |session_id|. |has_additional_usable_key| should be set if a |
| 1349 // key is newly usable (e.g. new key available, previously expired key has |
| 1350 // been renewed, etc.) and the browser should attempt to resume playback. |
| 1351 // |key_ids| is the list of key ids for this session along with their |
| 1352 // current status. |key_ids_count| is the number of entries in |key_ids|. |
| 1353 // Size parameter for |session_id| should not include null termination. |
| 1354 virtual void OnSessionKeysChange(const char* session_id, |
| 1355 uint32_t session_id_size, |
| 1356 bool has_additional_usable_key, |
| 1357 const KeyInformation* keys_info, |
| 1358 uint32_t keys_info_count) = 0; |
| 1359 |
| 1360 // Called by the CDM when there has been a change in the expiration time for |
| 1361 // session |session_id|. This can happen as the result of an Update() call |
| 1362 // or some other event. If this happens as a result of a call to Update(), |
| 1363 // it must be called before resolving the Update() promise. |new_expiry_time| |
| 1364 // can be 0 to represent "undefined". Size parameter should not include |
| 1365 // null termination. |
| 1366 virtual void OnExpirationChange(const char* session_id, |
| 1367 uint32_t session_id_size, |
| 1368 Time new_expiry_time) = 0; |
| 1369 |
| 1370 // Called by the CDM when session |session_id| is closed. Size |
| 1371 // parameter should not include null termination. |
| 1372 virtual void OnSessionClosed(const char* session_id, |
| 1373 uint32_t session_id_size) = 0; |
| 1374 |
| 1375 // Called by the CDM when an error occurs in session |session_id| |
| 1376 // unrelated to one of the ContentDecryptionModule calls that accept a |
| 1377 // |promise_id|. |error| must be specified, |error_message| and |
| 1378 // |system_code| are optional. Length parameters should not include null |
| 1379 // termination. |
| 1380 // Note: |
| 1381 // - This method is only for supporting prefixed EME API. |
| 1382 // - This method will be ignored by unprefixed EME. All errors reported |
| 1383 // in this method should probably also be reported by one of other methods. |
| 1384 virtual void OnLegacySessionError( |
| 1385 const char* session_id, uint32_t session_id_length, |
| 1386 Error error, |
| 1387 uint32_t system_code, |
| 1388 const char* error_message, uint32_t error_message_length) = 0; |
| 1389 |
| 1390 // The following are optional methods that may not be implemented on all |
| 1391 // platforms. |
| 1392 |
| 1393 // Sends a platform challenge for the given |service_id|. |challenge| is at |
| 1394 // most 256 bits of data to be signed. Once the challenge has been completed, |
| 1395 // the host will call ContentDecryptionModule::OnPlatformChallengeResponse() |
| 1396 // with the signed challenge response and platform certificate. Size |
| 1397 // parameters should not include null termination. |
| 1398 virtual void SendPlatformChallenge(const char* service_id, |
| 1399 uint32_t service_id_size, |
| 1400 const char* challenge, |
| 1401 uint32_t challenge_size) = 0; |
| 1402 |
| 1403 // Attempts to enable output protection (e.g. HDCP) on the display link. The |
| 1404 // |desired_protection_mask| is a bit mask of OutputProtectionMethods. No |
| 1405 // status callback is issued, the CDM must call QueryOutputProtectionStatus() |
| 1406 // periodically to ensure the desired protections are applied. |
| 1407 virtual void EnableOutputProtection(uint32_t desired_protection_mask) = 0; |
| 1408 |
| 1409 // Requests the current output protection status. Once the host has the status |
| 1410 // it will call ContentDecryptionModule::OnQueryOutputProtectionStatus(). |
| 1411 virtual void QueryOutputProtectionStatus() = 0; |
| 1412 |
| 1413 // Must be called by the CDM if it returned kDeferredInitialization during |
| 1414 // InitializeAudioDecoder() or InitializeVideoDecoder(). |
| 1415 virtual void OnDeferredInitializationDone(StreamType stream_type, |
| 1416 Status decoder_status) = 0; |
| 1417 |
| 1418 // Creates a FileIO object from the host to do file IO operation. Returns NULL |
| 1419 // if a FileIO object cannot be obtained. Once a valid FileIO object is |
| 1420 // returned, |client| must be valid until FileIO::Close() is called. The |
| 1421 // CDM can call this method multiple times to operate on different files. |
| 1422 virtual FileIO* CreateFileIO(FileIOClient* client) = 0; |
| 1423 |
| 1424 protected: |
| 1425 Host_8() {} |
| 1426 virtual ~Host_8() {} |
| 1427 }; |
| 1428 |
1093 // Represents a decrypted block that has not been decoded. | 1429 // Represents a decrypted block that has not been decoded. |
1094 class DecryptedBlock { | 1430 class DecryptedBlock { |
1095 public: | 1431 public: |
1096 virtual void SetDecryptedBuffer(Buffer* buffer) = 0; | 1432 virtual void SetDecryptedBuffer(Buffer* buffer) = 0; |
1097 virtual Buffer* DecryptedBuffer() = 0; | 1433 virtual Buffer* DecryptedBuffer() = 0; |
1098 | 1434 |
1099 // TODO(tomfinegan): Figure out if timestamp is really needed. If it is not, | 1435 // TODO(tomfinegan): Figure out if timestamp is really needed. If it is not, |
1100 // we can just pass Buffer pointers around. | 1436 // we can just pass Buffer pointers around. |
1101 virtual void SetTimestamp(int64_t timestamp) = 0; | 1437 virtual void SetTimestamp(int64_t timestamp) = 0; |
1102 virtual int64_t Timestamp() const = 0; | 1438 virtual int64_t Timestamp() const = 0; |
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1161 virtual AudioFormat Format() const = 0; | 1497 virtual AudioFormat Format() const = 0; |
1162 | 1498 |
1163 protected: | 1499 protected: |
1164 AudioFrames() {} | 1500 AudioFrames() {} |
1165 virtual ~AudioFrames() {} | 1501 virtual ~AudioFrames() {} |
1166 }; | 1502 }; |
1167 | 1503 |
1168 } // namespace cdm | 1504 } // namespace cdm |
1169 | 1505 |
1170 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ | 1506 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ |
OLD | NEW |