OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
| 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
| 7 |
| 8 #include <string> |
| 9 |
| 10 #include "base/memory/ref_counted.h" |
| 11 #include "media/base/decryptor.h" |
| 12 |
| 13 namespace media { |
| 14 class DecryptorClient; |
| 15 } |
| 16 |
| 17 namespace webkit { |
| 18 namespace ppapi { |
| 19 class PluginInstance; |
| 20 } |
| 21 } |
| 22 |
| 23 namespace webkit_media { |
| 24 |
| 25 class PpapiDecryptor : public media::Decryptor { |
| 26 public: |
| 27 PpapiDecryptor( |
| 28 media::DecryptorClient* client, |
| 29 const scoped_refptr<webkit::ppapi::PluginInstance>& plugin_instance); |
| 30 virtual ~PpapiDecryptor(); |
| 31 |
| 32 // media::Decryptor implementation. |
| 33 virtual void GenerateKeyRequest(const std::string& key_system, |
| 34 const uint8* init_data, |
| 35 int init_data_length) OVERRIDE; |
| 36 virtual void AddKey(const std::string& key_system, |
| 37 const uint8* key, |
| 38 int key_length, |
| 39 const uint8* init_data, |
| 40 int init_data_length, |
| 41 const std::string& session_id) OVERRIDE; |
| 42 virtual void CancelKeyRequest(const std::string& key_system, |
| 43 const std::string& session_id) OVERRIDE; |
| 44 virtual void Decrypt(const scoped_refptr<media::DecoderBuffer>& encrypted, |
| 45 const DecryptCB& decrypt_cb) OVERRIDE; |
| 46 |
| 47 private: |
| 48 // Callback for the plugin to hand back the decrypted data. |
| 49 void DataReady(const DecryptCB& decrypt_cb, const uint8* data, int data_size); |
| 50 |
| 51 // TODO(xhwang): Need to figure out how the CDM plugin fires key events |
| 52 // (e.g. KeyMessage). |
| 53 media::DecryptorClient* client_; |
| 54 scoped_refptr<webkit::ppapi::PluginInstance> cdm_plugin_; |
| 55 |
| 56 DISALLOW_COPY_AND_ASSIGN(PpapiDecryptor); |
| 57 }; |
| 58 |
| 59 } // namespace webkit_media |
| 60 |
| 61 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_DECRYPTOR_H_ |
OLD | NEW |