OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ |
| 6 #define CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ |
| 7 |
| 8 #include "media/base/decryptor.h" |
| 9 #include "media/base/demuxer.h" |
| 10 #include "third_party/WebKit/public/platform/WebMediaPlayer.h" |
| 11 |
| 12 namespace blink { |
| 13 class WebContentDecryptionModule; |
| 14 class WebContentDecryptionModuleResult; |
| 15 class WebLocalFrame; |
| 16 class WebMediaPlayerClient; |
| 17 class WebString; |
| 18 } |
| 19 |
| 20 namespace content { |
| 21 |
| 22 class EncryptedMediaPlayerSupport { |
| 23 public: |
| 24 // Creates a new instance of EncryptedMediaPlayerSupport for |client|. This |
| 25 // method must always return a valid pointer. |
| 26 static scoped_ptr<EncryptedMediaPlayerSupport> Create( |
| 27 blink::WebMediaPlayerClient* client); |
| 28 |
| 29 EncryptedMediaPlayerSupport(); |
| 30 virtual ~EncryptedMediaPlayerSupport(); |
| 31 |
| 32 // Prefixed API methods. |
| 33 virtual blink::WebMediaPlayer::MediaKeyException GenerateKeyRequest( |
| 34 blink::WebLocalFrame* frame, |
| 35 const blink::WebString& key_system, |
| 36 const unsigned char* init_data, |
| 37 unsigned init_data_length) = 0; |
| 38 |
| 39 virtual blink::WebMediaPlayer::MediaKeyException AddKey( |
| 40 const blink::WebString& key_system, |
| 41 const unsigned char* key, |
| 42 unsigned key_length, |
| 43 const unsigned char* init_data, |
| 44 unsigned init_data_length, |
| 45 const blink::WebString& session_id) = 0; |
| 46 |
| 47 virtual blink::WebMediaPlayer::MediaKeyException CancelKeyRequest( |
| 48 const blink::WebString& key_system, |
| 49 const blink::WebString& session_id) = 0; |
| 50 |
| 51 |
| 52 // Unprefixed API methods. |
| 53 virtual void SetContentDecryptionModule( |
| 54 blink::WebContentDecryptionModule* cdm) = 0; |
| 55 virtual void SetContentDecryptionModule( |
| 56 blink::WebContentDecryptionModule* cdm, |
| 57 blink::WebContentDecryptionModuleResult result) = 0; |
| 58 virtual void SetContentDecryptionModuleSync( |
| 59 blink::WebContentDecryptionModule* cdm) = 0; |
| 60 |
| 61 |
| 62 // Callback factory and notification methods used by WebMediaPlayerImpl. |
| 63 |
| 64 // Creates a callback that Demuxers can use to signal that the content |
| 65 // requires a key. This method make sure the callback returned can be safely |
| 66 // invoked from any thread. |
| 67 virtual media::Demuxer::NeedKeyCB CreateNeedKeyCB() = 0; |
| 68 |
| 69 // Creates a callback that renderers can use to set decryptor |
| 70 // ready callback. This method make sure the callback returned can be safely |
| 71 // invoked from any thread. |
| 72 virtual media::SetDecryptorReadyCB CreateSetDecryptorReadyCB() = 0; |
| 73 |
| 74 // Called to inform this object that the media pipeline encountered |
| 75 // and handled a decryption error. |
| 76 virtual void OnPipelineDecryptError() = 0; |
| 77 |
| 78 private: |
| 79 DISALLOW_COPY_AND_ASSIGN(EncryptedMediaPlayerSupport); |
| 80 }; |
| 81 |
| 82 } // namespace content |
| 83 |
| 84 #endif // CONTENT_RENDERER_MEDIA_CRYPTO_ENCRYPTED_MEDIA_PLAYER_SUPPORT_H_ |
OLD | NEW |