Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_CLEAR_KEY_CDM_H_ | 5 #ifndef MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_CLEAR_KEY_CDM_H_ |
| 6 #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_CLEAR_KEY_CDM_H_ | 6 #define MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_CLEAR_KEY_CDM_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 uint32 init_data_size, | 42 uint32 init_data_size, |
| 43 cdm::SessionType session_type) OVERRIDE; | 43 cdm::SessionType session_type) OVERRIDE; |
| 44 virtual void LoadSession(uint32 promise_id, | 44 virtual void LoadSession(uint32 promise_id, |
| 45 const char* web_session_id, | 45 const char* web_session_id, |
| 46 uint32_t web_session_id_length) OVERRIDE; | 46 uint32_t web_session_id_length) OVERRIDE; |
| 47 virtual void UpdateSession(uint32 promise_id, | 47 virtual void UpdateSession(uint32 promise_id, |
| 48 const char* web_session_id, | 48 const char* web_session_id, |
| 49 uint32_t web_session_id_length, | 49 uint32_t web_session_id_length, |
| 50 const uint8* response, | 50 const uint8* response, |
| 51 uint32 response_size) OVERRIDE; | 51 uint32 response_size) OVERRIDE; |
| 52 virtual void ReleaseSession(uint32 promise_id, | 52 virtual void CloseSession(uint32 promise_id, |
| 53 const char* web_session_id, | 53 const char* web_session_id, |
| 54 uint32_t web_session_id_length) OVERRIDE; | 54 uint32_t web_session_id_length) OVERRIDE; |
| 55 virtual void RemoveSession(uint32 promise_id, | |
| 56 const char* web_session_id, | |
| 57 uint32_t web_session_id_length) OVERRIDE; | |
| 55 virtual void SetServerCertificate( | 58 virtual void SetServerCertificate( |
| 56 uint32 promise_id, | 59 uint32 promise_id, |
| 57 const uint8_t* server_certificate_data, | 60 const uint8_t* server_certificate_data, |
| 58 uint32_t server_certificate_data_size) OVERRIDE; | 61 uint32_t server_certificate_data_size) OVERRIDE; |
| 62 virtual void GetUsableKeyIds(uint32_t promise_id, | |
|
ddorwin
2014/08/08 23:36:25
nit: This should before the above function to matc
jrummell
2014/08/11 18:59:04
Done.
| |
| 63 const char* web_session_id, | |
| 64 uint32_t web_session_id_length) OVERRIDE; | |
| 59 virtual void TimerExpired(void* context) OVERRIDE; | 65 virtual void TimerExpired(void* context) OVERRIDE; |
| 60 virtual cdm::Status Decrypt(const cdm::InputBuffer_1& encrypted_buffer, | 66 virtual cdm::Status Decrypt(const cdm::InputBuffer& encrypted_buffer, |
| 61 cdm::DecryptedBlock* decrypted_block) OVERRIDE; | 67 cdm::DecryptedBlock* decrypted_block) OVERRIDE; |
| 62 virtual cdm::Status InitializeAudioDecoder( | 68 virtual cdm::Status InitializeAudioDecoder( |
| 63 const cdm::AudioDecoderConfig& audio_decoder_config) OVERRIDE; | 69 const cdm::AudioDecoderConfig& audio_decoder_config) OVERRIDE; |
| 64 virtual cdm::Status InitializeVideoDecoder( | 70 virtual cdm::Status InitializeVideoDecoder( |
| 65 const cdm::VideoDecoderConfig& video_decoder_config) OVERRIDE; | 71 const cdm::VideoDecoderConfig& video_decoder_config) OVERRIDE; |
| 66 virtual void DeinitializeDecoder(cdm::StreamType decoder_type) OVERRIDE; | 72 virtual void DeinitializeDecoder(cdm::StreamType decoder_type) OVERRIDE; |
| 67 virtual void ResetDecoder(cdm::StreamType decoder_type) OVERRIDE; | 73 virtual void ResetDecoder(cdm::StreamType decoder_type) OVERRIDE; |
| 68 virtual cdm::Status DecryptAndDecodeFrame( | 74 virtual cdm::Status DecryptAndDecodeFrame( |
| 69 const cdm::InputBuffer_1& encrypted_buffer, | 75 const cdm::InputBuffer& encrypted_buffer, |
| 70 cdm::VideoFrame* video_frame) OVERRIDE; | 76 cdm::VideoFrame* video_frame) OVERRIDE; |
| 71 virtual cdm::Status DecryptAndDecodeSamples( | 77 virtual cdm::Status DecryptAndDecodeSamples( |
| 72 const cdm::InputBuffer_1& encrypted_buffer, | 78 const cdm::InputBuffer& encrypted_buffer, |
| 73 cdm::AudioFrames* audio_frames) OVERRIDE; | 79 cdm::AudioFrames* audio_frames) OVERRIDE; |
| 74 virtual void Destroy() OVERRIDE; | 80 virtual void Destroy() OVERRIDE; |
| 75 virtual void OnPlatformChallengeResponse( | 81 virtual void OnPlatformChallengeResponse( |
| 76 const cdm::PlatformChallengeResponse& response) OVERRIDE; | 82 const cdm::PlatformChallengeResponse& response) OVERRIDE; |
| 77 virtual void OnQueryOutputProtectionStatus( | 83 virtual void OnQueryOutputProtectionStatus( |
| 78 uint32_t link_mask, uint32_t output_protection_mask) OVERRIDE; | 84 uint32_t link_mask, uint32_t output_protection_mask) OVERRIDE; |
| 79 | 85 |
| 80 private: | 86 private: |
| 81 // Emulates a session stored for |session_id_for_emulated_loadsession_|. This | 87 // Emulates a session stored for |session_id_for_emulated_loadsession_|. This |
| 82 // is necessary since aes_decryptor.cc does not support storing sessions. | 88 // is necessary since aes_decryptor.cc does not support storing sessions. |
| 83 void LoadLoadableSession(); | 89 void LoadLoadableSession(); |
| 84 | 90 |
| 85 // ContentDecryptionModule callbacks. | 91 // ContentDecryptionModule callbacks. |
| 86 void OnSessionMessage(const std::string& web_session_id, | 92 void OnSessionMessage(const std::string& web_session_id, |
| 87 const std::vector<uint8>& message, | 93 const std::vector<uint8>& message, |
| 88 const GURL& destination_url); | 94 const GURL& destination_url); |
| 89 void OnSessionClosed(const std::string& web_session_id); | 95 void OnSessionClosed(const std::string& web_session_id); |
| 90 | 96 |
| 91 // Handle the success/failure of a promise. These methods are responsible for | 97 // Handle the success/failure of a promise. These methods are responsible for |
| 92 // calling |host_| to resolve or reject the promise. | 98 // calling |host_| to resolve or reject the promise. |
| 93 void OnSessionCreated(uint32 promise_id, const std::string& web_session_id); | 99 void OnSessionCreated(uint32 promise_id, const std::string& web_session_id); |
| 94 void OnSessionLoaded(uint32 promise_id, const std::string& web_session_id); | 100 void OnSessionLoaded(uint32 promise_id, const std::string& web_session_id); |
| 95 void OnSessionUpdated(uint32 promise_id, const std::string& web_session_id); | 101 void OnSessionUpdated(uint32 promise_id, const std::string& web_session_id); |
| 96 void OnSessionReleased(uint32 promise_id, const std::string& web_session_id); | 102 void OnSessionReleased(uint32 promise_id, const std::string& web_session_id); |
| 103 void OnUsableKeyIdsObtained(uint32 promise_id, const KeyIdsVector& key_ids); | |
| 97 void OnPromiseFailed(uint32 promise_id, | 104 void OnPromiseFailed(uint32 promise_id, |
| 98 MediaKeys::Exception exception_code, | 105 MediaKeys::Exception exception_code, |
| 99 uint32 system_code, | 106 uint32 system_code, |
| 100 const std::string& error_message); | 107 const std::string& error_message); |
| 101 | 108 |
| 102 // Prepares next heartbeat message and sets a timer for it. | 109 // Prepares next heartbeat message and sets a timer for it. |
| 103 void ScheduleNextHeartBeat(); | 110 void ScheduleNextHeartBeat(); |
| 104 | 111 |
| 105 // Decrypts the |encrypted_buffer| and puts the result in |decrypted_buffer|. | 112 // Decrypts the |encrypted_buffer| and puts the result in |decrypted_buffer|. |
| 106 // Returns cdm::kSuccess if decryption succeeded. The decrypted result is | 113 // Returns cdm::kSuccess if decryption succeeded. The decrypted result is |
| 107 // put in |decrypted_buffer|. If |encrypted_buffer| is empty, the | 114 // put in |decrypted_buffer|. If |encrypted_buffer| is empty, the |
| 108 // |decrypted_buffer| is set to an empty (EOS) buffer. | 115 // |decrypted_buffer| is set to an empty (EOS) buffer. |
| 109 // Returns cdm::kNoKey if no decryption key was available. In this case | 116 // Returns cdm::kNoKey if no decryption key was available. In this case |
| 110 // |decrypted_buffer| should be ignored by the caller. | 117 // |decrypted_buffer| should be ignored by the caller. |
| 111 // Returns cdm::kDecryptError if any decryption error occurred. In this case | 118 // Returns cdm::kDecryptError if any decryption error occurred. In this case |
| 112 // |decrypted_buffer| should be ignored by the caller. | 119 // |decrypted_buffer| should be ignored by the caller. |
| 113 cdm::Status DecryptToMediaDecoderBuffer( | 120 cdm::Status DecryptToMediaDecoderBuffer( |
| 114 const cdm::InputBuffer_1& encrypted_buffer, | 121 const cdm::InputBuffer& encrypted_buffer, |
| 115 scoped_refptr<DecoderBuffer>* decrypted_buffer); | 122 scoped_refptr<DecoderBuffer>* decrypted_buffer); |
| 116 | 123 |
| 117 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) | 124 #if defined(CLEAR_KEY_CDM_USE_FAKE_AUDIO_DECODER) |
| 118 int64 CurrentTimeStampInMicroseconds() const; | 125 int64 CurrentTimeStampInMicroseconds() const; |
| 119 | 126 |
| 120 // Generates fake video frames with |duration_in_microseconds|. | 127 // Generates fake video frames with |duration_in_microseconds|. |
| 121 // Returns the number of samples generated in the |audio_frames|. | 128 // Returns the number of samples generated in the |audio_frames|. |
| 122 int GenerateFakeAudioFramesFromDuration(int64 duration_in_microseconds, | 129 int GenerateFakeAudioFramesFromDuration(int64 duration_in_microseconds, |
| 123 cdm::AudioFrames* audio_frames) const; | 130 cdm::AudioFrames* audio_frames) const; |
| 124 | 131 |
| (...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 172 scoped_ptr<CdmVideoDecoder> video_decoder_; | 179 scoped_ptr<CdmVideoDecoder> video_decoder_; |
| 173 | 180 |
| 174 scoped_ptr<FileIOTestRunner> file_io_test_runner_; | 181 scoped_ptr<FileIOTestRunner> file_io_test_runner_; |
| 175 | 182 |
| 176 DISALLOW_COPY_AND_ASSIGN(ClearKeyCdm); | 183 DISALLOW_COPY_AND_ASSIGN(ClearKeyCdm); |
| 177 }; | 184 }; |
| 178 | 185 |
| 179 } // namespace media | 186 } // namespace media |
| 180 | 187 |
| 181 #endif // MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_CLEAR_KEY_CDM_H_ | 188 #endif // MEDIA_CDM_PPAPI_EXTERNAL_CLEAR_KEY_CLEAR_KEY_CDM_H_ |
| OLD | NEW |