| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ | 5 #ifndef MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ |
| 6 #define MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ | 6 #define MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ |
| 7 | 7 |
| 8 #include <string> | 8 #include <string> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| 11 #include "base/callback.h" | 11 #include "base/callback.h" |
| 12 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
| 13 #include "base/memory/weak_ptr.h" | 13 #include "base/memory/weak_ptr.h" |
| 14 #include "media/base/cdm_context.h" | 14 #include "media/base/cdm_context.h" |
| 15 #include "media/base/cdm_factory.h" | 15 #include "media/base/cdm_factory.h" |
| 16 #include "media/base/demuxer.h" | 16 #include "media/base/demuxer.h" |
| 17 #include "media/base/eme_constants.h" | 17 #include "media/base/eme_constants.h" |
| 18 #include "media/cdm/proxy_decryptor.h" | 18 #include "media/cdm/proxy_decryptor.h" |
| 19 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" | 19 #include "third_party/WebKit/public/platform/WebContentDecryptionModuleResult.h" |
| 20 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" | 20 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 21 | 21 |
| 22 namespace blink { | 22 namespace blink { |
| 23 class WebContentDecryptionModule; | 23 class WebContentDecryptionModule; |
| 24 class WebLocalFrame; | 24 class WebLocalFrame; |
| 25 class WebMediaPlayerClient; | 25 class WebMediaPlayerEncryptedMediaClient; |
| 26 class WebString; | 26 class WebString; |
| 27 } | 27 } |
| 28 | 28 |
| 29 namespace media { | 29 namespace media { |
| 30 | 30 |
| 31 class MediaPermission; | 31 class MediaPermission; |
| 32 class WebContentDecryptionModuleImpl; | 32 class WebContentDecryptionModuleImpl; |
| 33 | 33 |
| 34 // Provides support to prefixed EME implementation. | 34 // Provides support to prefixed EME implementation. |
| 35 // Do NOT add unprefixed EME functionality to this class! | 35 // Do NOT add unprefixed EME functionality to this class! |
| 36 // TODO(xhwang): When deprecating prefixed EME support, drop this whole file. | 36 // TODO(xhwang): When deprecating prefixed EME support, drop this whole file. |
| 37 class EncryptedMediaPlayerSupport | 37 class EncryptedMediaPlayerSupport |
| 38 : public base::SupportsWeakPtr<EncryptedMediaPlayerSupport> { | 38 : public base::SupportsWeakPtr<EncryptedMediaPlayerSupport> { |
| 39 public: | 39 public: |
| 40 using CdmContextReadyCB = ProxyDecryptor::CdmContextReadyCB; | 40 using CdmContextReadyCB = ProxyDecryptor::CdmContextReadyCB; |
| 41 | 41 |
| 42 // |cdm_context_ready_cb| is called when the CDM instance creation completes. | 42 // |cdm_context_ready_cb| is called when the CDM instance creation completes. |
| 43 EncryptedMediaPlayerSupport(CdmFactory* cdm_factory, | 43 EncryptedMediaPlayerSupport(CdmFactory* cdm_factory, |
| 44 blink::WebMediaPlayerClient* client, | 44 blink::WebMediaPlayerEncryptedMediaClient* client, |
| 45 MediaPermission* media_permission, | 45 MediaPermission* media_permission, |
| 46 const CdmContextReadyCB& cdm_context_ready_cb); | 46 const CdmContextReadyCB& cdm_context_ready_cb); |
| 47 ~EncryptedMediaPlayerSupport(); | 47 ~EncryptedMediaPlayerSupport(); |
| 48 | 48 |
| 49 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( | 49 blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( |
| 50 blink::WebLocalFrame* frame, | 50 blink::WebLocalFrame* frame, |
| 51 const blink::WebString& key_system, | 51 const blink::WebString& key_system, |
| 52 const unsigned char* init_data, | 52 const unsigned char* init_data, |
| 53 unsigned init_data_length); | 53 unsigned init_data_length); |
| 54 | 54 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 88 void OnKeyAdded(const std::string& session_id); | 88 void OnKeyAdded(const std::string& session_id); |
| 89 void OnKeyError(const std::string& session_id, | 89 void OnKeyError(const std::string& session_id, |
| 90 MediaKeys::KeyError error_code, | 90 MediaKeys::KeyError error_code, |
| 91 uint32 system_code); | 91 uint32 system_code); |
| 92 void OnKeyMessage(const std::string& session_id, | 92 void OnKeyMessage(const std::string& session_id, |
| 93 const std::vector<uint8>& message, | 93 const std::vector<uint8>& message, |
| 94 const GURL& destination_url); | 94 const GURL& destination_url); |
| 95 | 95 |
| 96 CdmFactory* cdm_factory_; | 96 CdmFactory* cdm_factory_; |
| 97 | 97 |
| 98 blink::WebMediaPlayerClient* client_; | 98 blink::WebMediaPlayerEncryptedMediaClient* client_; |
| 99 | 99 |
| 100 MediaPermission* media_permission_; | 100 MediaPermission* media_permission_; |
| 101 | 101 |
| 102 // The currently selected key system. Empty string means that no key system | 102 // The currently selected key system. Empty string means that no key system |
| 103 // has been selected. | 103 // has been selected. |
| 104 std::string current_key_system_; | 104 std::string current_key_system_; |
| 105 | 105 |
| 106 // We assume all streams are from the same container, thus have the same | 106 // We assume all streams are from the same container, thus have the same |
| 107 // init data type. | 107 // init data type. |
| 108 EmeInitDataType init_data_type_; | 108 EmeInitDataType init_data_type_; |
| 109 | 109 |
| 110 CdmContextReadyCB cdm_context_ready_cb_; | 110 CdmContextReadyCB cdm_context_ready_cb_; |
| 111 | 111 |
| 112 // Manages decryption keys and decrypts encrypted frames. | 112 // Manages decryption keys and decrypts encrypted frames. |
| 113 scoped_ptr<ProxyDecryptor> proxy_decryptor_; | 113 scoped_ptr<ProxyDecryptor> proxy_decryptor_; |
| 114 | 114 |
| 115 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport); | 115 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport); |
| 116 }; | 116 }; |
| 117 | 117 |
| 118 } // namespace media | 118 } // namespace media |
| 119 | 119 |
| 120 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ | 120 #endif // MEDIA_BLINK_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ |
| OLD | NEW |