| 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 CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 66 virtual void DecryptAndDecodeAudio( | 66 virtual void DecryptAndDecodeAudio( |
| 67 const scoped_refptr<media::DecoderBuffer>& encrypted, | 67 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 68 const AudioDecodeCB& audio_decode_cb) OVERRIDE; | 68 const AudioDecodeCB& audio_decode_cb) OVERRIDE; |
| 69 virtual void DecryptAndDecodeVideo( | 69 virtual void DecryptAndDecodeVideo( |
| 70 const scoped_refptr<media::DecoderBuffer>& encrypted, | 70 const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 71 const VideoDecodeCB& video_decode_cb) OVERRIDE; | 71 const VideoDecodeCB& video_decode_cb) OVERRIDE; |
| 72 virtual void ResetDecoder(StreamType stream_type) OVERRIDE; | 72 virtual void ResetDecoder(StreamType stream_type) OVERRIDE; |
| 73 virtual void DeinitializeDecoder(StreamType stream_type) OVERRIDE; | 73 virtual void DeinitializeDecoder(StreamType stream_type) OVERRIDE; |
| 74 | 74 |
| 75 private: | 75 private: |
| 76 PpapiDecryptor(const scoped_refptr<PepperPluginInstanceImpl>& plugin_instance, | 76 PpapiDecryptor(const std::string& key_system, |
| 77 const scoped_refptr<PepperPluginInstanceImpl>& plugin_instance, |
| 77 ContentDecryptorDelegate* plugin_cdm_delegate, | 78 ContentDecryptorDelegate* plugin_cdm_delegate, |
| 78 const media::SessionCreatedCB& session_created_cb, | 79 const media::SessionCreatedCB& session_created_cb, |
| 79 const media::SessionMessageCB& session_message_cb, | 80 const media::SessionMessageCB& session_message_cb, |
| 80 const media::SessionReadyCB& session_ready_cb, | 81 const media::SessionReadyCB& session_ready_cb, |
| 81 const media::SessionClosedCB& session_closed_cb, | 82 const media::SessionClosedCB& session_closed_cb, |
| 82 const media::SessionErrorCB& session_error_cb, | 83 const media::SessionErrorCB& session_error_cb, |
| 83 const base::Closure& destroy_plugin_cb); | 84 const base::Closure& destroy_plugin_cb); |
| 84 | 85 |
| 85 void ReportFailureToCallPlugin(uint32 session_id); | 86 void ReportFailureToCallPlugin(uint32 session_id); |
| 86 | 87 |
| 87 void OnDecoderInitialized(StreamType stream_type, bool success); | 88 void OnDecoderInitialized(StreamType stream_type, bool success); |
| 88 | 89 |
| 89 // Callbacks for |plugin_cdm_delegate_| to fire session events. | 90 // Callbacks for |plugin_cdm_delegate_| to fire session events. |
| 90 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); | 91 void OnSessionCreated(uint32 session_id, const std::string& web_session_id); |
| 91 void OnSessionMessage(uint32 session_id, | 92 void OnSessionMessage(uint32 session_id, |
| 92 const std::vector<uint8>& message, | 93 const std::vector<uint8>& message, |
| 93 const std::string& destination_url); | 94 const std::string& destination_url); |
| 94 void OnSessionReady(uint32 session_id); | 95 void OnSessionReady(uint32 session_id); |
| 95 void OnSessionClosed(uint32 session_id); | 96 void OnSessionClosed(uint32 session_id); |
| 96 void OnSessionError(uint32 session_id, | 97 void OnSessionError(uint32 session_id, |
| 97 media::MediaKeys::KeyError error_code, | 98 media::MediaKeys::KeyError error_code, |
| 98 int system_code); | 99 int system_code); |
| 99 | 100 |
| 101 // Callback to notify that a fatal error happened in |plugin_cdm_delegate_|. |
| 102 // The error is terminal and |plugin_cdm_delegate_| should not be used after |
| 103 // this call. |
| 104 void OnFatalPluginError(); |
| 105 |
| 100 base::WeakPtr<PpapiDecryptor> weak_this_; | 106 base::WeakPtr<PpapiDecryptor> weak_this_; |
| 101 | 107 |
| 102 // Hold a reference of the plugin instance to make sure the plugin outlives | 108 // Hold a reference of the plugin instance to make sure the plugin outlives |
| 103 // the |plugin_cdm_delegate_|. This is needed because |plugin_cdm_delegate_| | 109 // the |plugin_cdm_delegate_|. This is needed because |plugin_cdm_delegate_| |
| 104 // is owned by the |plugin_instance_|. | 110 // is owned by the |plugin_instance_|. |
| 105 scoped_refptr<PepperPluginInstanceImpl> plugin_instance_; | 111 scoped_refptr<PepperPluginInstanceImpl> plugin_instance_; |
| 106 | 112 |
| 107 ContentDecryptorDelegate* plugin_cdm_delegate_; | 113 ContentDecryptorDelegate* plugin_cdm_delegate_; |
| 108 | 114 |
| 109 // Callbacks for firing session events. | 115 // Callbacks for firing session events. |
| (...skipping 14 matching lines...) Expand all Loading... |
| 124 NewKeyCB new_video_key_cb_; | 130 NewKeyCB new_video_key_cb_; |
| 125 | 131 |
| 126 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; | 132 base::WeakPtrFactory<PpapiDecryptor> weak_ptr_factory_; |
| 127 | 133 |
| 128 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); | 134 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); |
| 129 }; | 135 }; |
| 130 | 136 |
| 131 } // namespace content | 137 } // namespace content |
| 132 | 138 |
| 133 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ | 139 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
| OLD | NEW |