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 | |
xhwang
2015/03/19 17:16:22
nit: The order of these values are different from
jrummell
2015/03/19 19:08:50
I don't want to change the existing 0..3 due to ex
| |
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 | |
xhwang
2015/03/19 17:16:22
s/Webm/WebM/
jrummell
2015/03/19 19:08:50
Done.
| |
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 // Lets the CDM know whether distinctive identifiers are allowed or should | |
ddorwin
2015/03/19 02:42:00
If that's what it did, we would call it Set...().
jrummell
2015/03/19 19:08:50
Comment updated.
| |
829 // not be created. | |
830 virtual void Initialize(bool allow_distinctive_identifier) = 0; | |
ddorwin
2015/03/19 02:42:00
Should we have allow_persistent_state rather than
jrummell
2015/03/19 19:08:50
Done. The CDM may want to know this rather than wa
| |
831 | |
832 // SetServerCertificate(), CreateSessionAndGenerateRequest(), LoadSession(), | |
833 // UpdateSession(), CloseSession(), and RemoveSession() all accept a | |
834 // |promise_id|, which must be passed to the completion Host method | |
835 // (e.g. Host::OnResolveNewSessionPromise()). | |
836 | |
837 // Provides a server certificate to be used to encrypt messages to the | |
838 // license server. The CDM must respond by calling either | |
839 // Host::OnResolvePromise() or Host::OnRejectPromise(). | |
840 virtual void SetServerCertificate(uint32_t promise_id, | |
841 const uint8_t* server_certificate_data, | |
842 uint32_t server_certificate_data_size) = 0; | |
843 | |
844 // Creates a session given |session_type|, |init_data_type|, and |init_data|. | |
845 // The CDM must respond by calling either Host::OnResolveNewSessionPromise() | |
846 // or Host::OnRejectPromise(). | |
847 virtual void CreateSessionAndGenerateRequest(uint32_t promise_id, | |
848 SessionType session_type, | |
849 InitDataType init_data_type, | |
850 const uint8_t* init_data, | |
851 uint32_t init_data_size) = 0; | |
852 | |
853 // Loads the session of type |session_type| specified by |session_id|. | |
854 // The CDM must respond by calling either Host::OnResolveNewSessionPromise() | |
855 // or Host::OnRejectPromise(). If the session is not found, call | |
856 // Host::OnResolveNewSessionPromise() with session_id = NULL. | |
857 virtual void LoadSession(uint32_t promise_id, | |
858 SessionType session_type, | |
859 const char* session_id, | |
860 uint32_t session_id_size) = 0; | |
861 | |
862 // Updates the session with |response|. The CDM must respond by calling | |
863 // either Host::OnResolvePromise() or Host::OnRejectPromise(). | |
864 virtual void UpdateSession(uint32_t promise_id, | |
865 const char* session_id, | |
866 uint32_t session_id_size, | |
867 const uint8_t* response, | |
868 uint32_t response_size) = 0; | |
869 | |
870 // Requests that the CDM close the session. The CDM must respond by calling | |
871 // either Host::OnResolvePromise() or Host::OnRejectPromise() when the request | |
872 // has been processed. This may be before the session is closed. Once the | |
873 // session is closed, Host::OnSessionClosed() must also be called. | |
874 virtual void CloseSession(uint32_t promise_id, | |
875 const char* session_id, | |
876 uint32_t session_id_size) = 0; | |
877 | |
878 // Removes any stored session data associated with this session. Will only be | |
879 // called for persistent sessions. The CDM must respond by calling either | |
880 // Host::OnResolvePromise() or Host::OnRejectPromise() when the request has | |
881 // been processed. | |
882 virtual void RemoveSession(uint32_t promise_id, | |
883 const char* session_id, | |
884 uint32_t session_id_size) = 0; | |
885 | |
886 // Performs scheduled operation with |context| when the timer fires. | |
887 virtual void TimerExpired(void* context) = 0; | |
888 | |
889 // Decrypts the |encrypted_buffer|. | |
890 // | |
891 // Returns kSuccess if decryption succeeded, in which case the callee | |
892 // should have filled the |decrypted_buffer| and passed the ownership of | |
893 // |data| in |decrypted_buffer| to the caller. | |
894 // Returns kNoKey if the CDM did not have the necessary decryption key | |
895 // to decrypt. | |
896 // Returns kDecryptError if any other error happened. | |
897 // If the return value is not kSuccess, |decrypted_buffer| should be ignored | |
898 // by the caller. | |
899 virtual Status Decrypt(const InputBuffer& encrypted_buffer, | |
900 DecryptedBlock* decrypted_buffer) = 0; | |
901 | |
902 // Initializes the CDM audio decoder with |audio_decoder_config|. This | |
903 // function must be called before DecryptAndDecodeSamples() is called. | |
904 // | |
905 // Returns kSuccess if the |audio_decoder_config| is supported and the CDM | |
906 // audio decoder is successfully initialized. | |
907 // Returns kSessionError if |audio_decoder_config| is not supported. The CDM | |
908 // may still be able to do Decrypt(). | |
909 // Returns kDeferredInitialization if the CDM is not ready to initialize the | |
910 // decoder at this time. Must call Host::OnDeferredInitializationDone() once | |
911 // initialization is complete. | |
912 virtual Status InitializeAudioDecoder( | |
913 const AudioDecoderConfig& audio_decoder_config) = 0; | |
914 | |
915 // Initializes the CDM video decoder with |video_decoder_config|. This | |
916 // function must be called before DecryptAndDecodeFrame() is called. | |
917 // | |
918 // Returns kSuccess if the |video_decoder_config| is supported and the CDM | |
919 // video decoder is successfully initialized. | |
920 // Returns kSessionError if |video_decoder_config| is not supported. The CDM | |
921 // may still be able to do Decrypt(). | |
922 // Returns kDeferredInitialization if the CDM is not ready to initialize the | |
923 // decoder at this time. Must call Host::OnDeferredInitializationDone() once | |
924 // initialization is complete. | |
925 virtual Status InitializeVideoDecoder( | |
926 const VideoDecoderConfig& video_decoder_config) = 0; | |
927 | |
928 // De-initializes the CDM decoder and sets it to an uninitialized state. The | |
929 // caller can initialize the decoder again after this call to re-initialize | |
930 // it. This can be used to reconfigure the decoder if the configuration | |
931 // changes. | |
932 virtual void DeinitializeDecoder(StreamType decoder_type) = 0; | |
933 | |
934 // Resets the CDM decoder to an initialized clean state. All internal buffers | |
935 // MUST be flushed. | |
936 virtual void ResetDecoder(StreamType decoder_type) = 0; | |
937 | |
938 // Decrypts the |encrypted_buffer| and decodes the decrypted buffer into a | |
939 // |video_frame|. Upon end-of-stream, the caller should call this function | |
940 // repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty | |
941 // |video_frame| (|format| == kEmptyVideoFrame) is produced. | |
942 // | |
943 // Returns kSuccess if decryption and decoding both succeeded, in which case | |
944 // the callee will have filled the |video_frame| and passed the ownership of | |
945 // |frame_buffer| in |video_frame| to the caller. | |
946 // Returns kNoKey if the CDM did not have the necessary decryption key | |
947 // to decrypt. | |
948 // Returns kNeedMoreData if more data was needed by the decoder to generate | |
949 // a decoded frame (e.g. during initialization and end-of-stream). | |
950 // Returns kDecryptError if any decryption error happened. | |
951 // Returns kDecodeError if any decoding error happened. | |
952 // If the return value is not kSuccess, |video_frame| should be ignored by | |
953 // the caller. | |
954 virtual Status DecryptAndDecodeFrame(const InputBuffer& encrypted_buffer, | |
955 VideoFrame* video_frame) = 0; | |
956 | |
957 // Decrypts the |encrypted_buffer| and decodes the decrypted buffer into | |
958 // |audio_frames|. Upon end-of-stream, the caller should call this function | |
959 // repeatedly with empty |encrypted_buffer| (|data| == NULL) until only empty | |
960 // |audio_frames| is produced. | |
961 // | |
962 // Returns kSuccess if decryption and decoding both succeeded, in which case | |
963 // the callee will have filled |audio_frames| and passed the ownership of | |
964 // |data| in |audio_frames| to the caller. | |
965 // Returns kNoKey if the CDM did not have the necessary decryption key | |
966 // to decrypt. | |
967 // Returns kNeedMoreData if more data was needed by the decoder to generate | |
968 // audio samples (e.g. during initialization and end-of-stream). | |
969 // Returns kDecryptError if any decryption error happened. | |
970 // Returns kDecodeError if any decoding error happened. | |
971 // If the return value is not kSuccess, |audio_frames| should be ignored by | |
972 // the caller. | |
973 virtual Status DecryptAndDecodeSamples(const InputBuffer& encrypted_buffer, | |
974 AudioFrames* audio_frames) = 0; | |
975 | |
976 // Called by the host after a platform challenge was initiated via | |
977 // Host::SendPlatformChallenge(). | |
978 virtual void OnPlatformChallengeResponse( | |
979 const PlatformChallengeResponse& response) = 0; | |
980 | |
981 // Called by the host after a call to Host::QueryOutputProtectionStatus(). The | |
982 // |link_mask| is a bit mask of OutputLinkTypes and |output_protection_mask| | |
983 // is a bit mask of OutputProtectionMethods. If |result| is kQueryFailed, | |
984 // then |link_mask| and |output_protection_mask| are undefined and should | |
985 // be ignored. | |
986 virtual void OnQueryOutputProtectionStatus( | |
987 QueryResult result, | |
988 uint32_t link_mask, | |
989 uint32_t output_protection_mask) = 0; | |
990 | |
991 // Destroys the object in the same context as it was created. | |
992 virtual void Destroy() = 0; | |
993 | |
994 protected: | |
995 ContentDecryptionModule_8() {} | |
996 virtual ~ContentDecryptionModule_8() {} | |
997 }; | |
998 | |
999 typedef ContentDecryptionModule_8 ContentDecryptionModule; | |
807 | 1000 |
808 // Represents a buffer created by Allocator implementations. | 1001 // Represents a buffer created by Allocator implementations. |
809 class Buffer { | 1002 class Buffer { |
810 public: | 1003 public: |
811 // Destroys the buffer in the same context as it was created. | 1004 // Destroys the buffer in the same context as it was created. |
812 virtual void Destroy() = 0; | 1005 virtual void Destroy() = 0; |
813 | 1006 |
814 virtual uint32_t Capacity() const = 0; | 1007 virtual uint32_t Capacity() const = 0; |
815 virtual uint8_t* Data() = 0; | 1008 virtual uint8_t* Data() = 0; |
816 virtual void SetSize(uint32_t size) = 0; | 1009 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 | 1276 // 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 | 1277 // returned, |client| must be valid until FileIO::Close() is called. The |
1085 // CDM can call this method multiple times to operate on different files. | 1278 // CDM can call this method multiple times to operate on different files. |
1086 virtual FileIO* CreateFileIO(FileIOClient* client) = 0; | 1279 virtual FileIO* CreateFileIO(FileIOClient* client) = 0; |
1087 | 1280 |
1088 protected: | 1281 protected: |
1089 Host_7() {} | 1282 Host_7() {} |
1090 virtual ~Host_7() {} | 1283 virtual ~Host_7() {} |
1091 }; | 1284 }; |
1092 | 1285 |
1286 class Host_8 { | |
1287 public: | |
1288 static const int kVersion = 8; | |
1289 | |
1290 // Returns a Buffer* containing non-zero members upon success, or NULL on | |
1291 // failure. The caller owns the Buffer* after this call. The buffer is not | |
1292 // guaranteed to be zero initialized. The capacity of the allocated Buffer | |
1293 // is guaranteed to be not less than |capacity|. | |
1294 virtual Buffer* Allocate(uint32_t capacity) = 0; | |
1295 | |
1296 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| | |
1297 // from now with |context|. | |
1298 virtual void SetTimer(int64_t delay_ms, void* context) = 0; | |
1299 | |
1300 // Returns the current wall time in seconds. | |
1301 virtual Time GetCurrentWallTime() = 0; | |
1302 | |
1303 // Called by the CDM when a session is created or loaded and the value for the | |
1304 // MediaKeySession's sessionId attribute is available (|session_id|). | |
1305 // This must be called before OnSessionMessage() or | |
1306 // OnSessionKeysChange() is called for the same session. |session_id_size| | |
1307 // should not include null termination. | |
1308 // When called in response to LoadSession(), the |session_id| must be the | |
1309 // same as the |session_id| passed in LoadSession(), or NULL if the | |
1310 // session could not be loaded. | |
1311 virtual void OnResolveNewSessionPromise(uint32_t promise_id, | |
1312 const char* session_id, | |
1313 uint32_t session_id_size) = 0; | |
1314 | |
1315 // Called by the CDM when a session is updated or released. | |
1316 virtual void OnResolvePromise(uint32_t promise_id) = 0; | |
1317 | |
1318 // Called by the CDM when an error occurs as a result of one of the | |
1319 // ContentDecryptionModule calls that accept a |promise_id|. | |
1320 // |error| must be specified, |error_message| and |system_code| | |
1321 // are optional. |error_message_size| should not include null termination. | |
1322 virtual void OnRejectPromise(uint32_t promise_id, | |
1323 Error error, | |
1324 uint32_t system_code, | |
1325 const char* error_message, | |
1326 uint32_t error_message_size) = 0; | |
1327 | |
1328 // Called by the CDM when it has a message for session |session_id|. | |
1329 // Size parameters should not include null termination. | |
1330 // |legacy_destination_url| is only for supporting the prefixed EME API and | |
1331 // is ignored by unprefixed EME. It should only be non-null if |message_type| | |
1332 // is kLicenseRenewal. | |
1333 virtual void OnSessionMessage(const char* session_id, | |
1334 uint32_t session_id_size, | |
1335 MessageType message_type, | |
1336 const char* message, | |
1337 uint32_t message_size, | |
1338 const char* legacy_destination_url, | |
1339 uint32_t legacy_destination_url_length) = 0; | |
1340 | |
1341 // Called by the CDM when there has been a change in keys or their status for | |
1342 // session |session_id|. |has_additional_usable_key| should be set if a | |
1343 // key is newly usable (e.g. new key available, previously expired key has | |
1344 // been renewed, etc.) and the browser should attempt to resume playback. | |
1345 // |key_ids| is the list of key ids for this session along with their | |
1346 // current status. |key_ids_count| is the number of entries in |key_ids|. | |
1347 // Size parameter for |session_id| should not include null termination. | |
1348 virtual void OnSessionKeysChange(const char* session_id, | |
1349 uint32_t session_id_size, | |
1350 bool has_additional_usable_key, | |
1351 const KeyInformation* keys_info, | |
1352 uint32_t keys_info_count) = 0; | |
1353 | |
1354 // Called by the CDM when there has been a change in the expiration time for | |
1355 // session |session_id|. This can happen as the result of an Update() call | |
1356 // or some other event. If this happens as a result of a call to Update(), | |
1357 // it must be called before resolving the Update() promise. |new_expiry_time| | |
1358 // can be 0 to represent "undefined". Size parameter should not include | |
1359 // null termination. | |
1360 virtual void OnExpirationChange(const char* session_id, | |
1361 uint32_t session_id_size, | |
1362 Time new_expiry_time) = 0; | |
1363 | |
1364 // Called by the CDM when session |session_id| is closed. Size | |
1365 // parameter should not include null termination. | |
1366 virtual void OnSessionClosed(const char* session_id, | |
1367 uint32_t session_id_size) = 0; | |
1368 | |
1369 // Called by the CDM when an error occurs in session |session_id| | |
1370 // unrelated to one of the ContentDecryptionModule calls that accept a | |
1371 // |promise_id|. |error| must be specified, |error_message| and | |
1372 // |system_code| are optional. Length parameters should not include null | |
1373 // termination. | |
1374 // Note: | |
1375 // - This method is only for supporting prefixed EME API. | |
1376 // - This method will be ignored by unprefixed EME. All errors reported | |
1377 // in this method should probably also be reported by one of other methods. | |
1378 virtual void OnLegacySessionError( | |
1379 const char* session_id, uint32_t session_id_length, | |
1380 Error error, | |
1381 uint32_t system_code, | |
1382 const char* error_message, uint32_t error_message_length) = 0; | |
1383 | |
1384 // The following are optional methods that may not be implemented on all | |
1385 // platforms. | |
1386 | |
1387 // Sends a platform challenge for the given |service_id|. |challenge| is at | |
1388 // most 256 bits of data to be signed. Once the challenge has been completed, | |
1389 // the host will call ContentDecryptionModule::OnPlatformChallengeResponse() | |
1390 // with the signed challenge response and platform certificate. Size | |
1391 // parameters should not include null termination. | |
1392 virtual void SendPlatformChallenge(const char* service_id, | |
1393 uint32_t service_id_size, | |
1394 const char* challenge, | |
1395 uint32_t challenge_size) = 0; | |
1396 | |
1397 // Attempts to enable output protection (e.g. HDCP) on the display link. The | |
1398 // |desired_protection_mask| is a bit mask of OutputProtectionMethods. No | |
1399 // status callback is issued, the CDM must call QueryOutputProtectionStatus() | |
1400 // periodically to ensure the desired protections are applied. | |
1401 virtual void EnableOutputProtection(uint32_t desired_protection_mask) = 0; | |
1402 | |
1403 // Requests the current output protection status. Once the host has the status | |
1404 // it will call ContentDecryptionModule::OnQueryOutputProtectionStatus(). | |
1405 virtual void QueryOutputProtectionStatus() = 0; | |
1406 | |
1407 // Must be called by the CDM if it returned kDeferredInitialization during | |
1408 // InitializeAudioDecoder() or InitializeVideoDecoder(). | |
1409 virtual void OnDeferredInitializationDone(StreamType stream_type, | |
1410 Status decoder_status) = 0; | |
1411 | |
1412 // Creates a FileIO object from the host to do file IO operation. Returns NULL | |
1413 // if a FileIO object cannot be obtained. Once a valid FileIO object is | |
1414 // returned, |client| must be valid until FileIO::Close() is called. The | |
1415 // CDM can call this method multiple times to operate on different files. | |
1416 virtual FileIO* CreateFileIO(FileIOClient* client) = 0; | |
1417 | |
1418 protected: | |
1419 Host_8() {} | |
1420 virtual ~Host_8() {} | |
1421 }; | |
1422 | |
1093 // Represents a decrypted block that has not been decoded. | 1423 // Represents a decrypted block that has not been decoded. |
1094 class DecryptedBlock { | 1424 class DecryptedBlock { |
1095 public: | 1425 public: |
1096 virtual void SetDecryptedBuffer(Buffer* buffer) = 0; | 1426 virtual void SetDecryptedBuffer(Buffer* buffer) = 0; |
1097 virtual Buffer* DecryptedBuffer() = 0; | 1427 virtual Buffer* DecryptedBuffer() = 0; |
1098 | 1428 |
1099 // TODO(tomfinegan): Figure out if timestamp is really needed. If it is not, | 1429 // TODO(tomfinegan): Figure out if timestamp is really needed. If it is not, |
1100 // we can just pass Buffer pointers around. | 1430 // we can just pass Buffer pointers around. |
1101 virtual void SetTimestamp(int64_t timestamp) = 0; | 1431 virtual void SetTimestamp(int64_t timestamp) = 0; |
1102 virtual int64_t Timestamp() const = 0; | 1432 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; | 1491 virtual AudioFormat Format() const = 0; |
1162 | 1492 |
1163 protected: | 1493 protected: |
1164 AudioFrames() {} | 1494 AudioFrames() {} |
1165 virtual ~AudioFrames() {} | 1495 virtual ~AudioFrames() {} |
1166 }; | 1496 }; |
1167 | 1497 |
1168 } // namespace cdm | 1498 } // namespace cdm |
1169 | 1499 |
1170 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ | 1500 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ |
OLD | NEW |