| 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 CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ | 5 #ifndef CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
| 6 #define CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ | 6 #define CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
| 7 | 7 |
| 8 #include <stdint.h> | 8 #include <stdint.h> |
| 9 | 9 |
| 10 #include <map> | 10 #include <map> |
| (...skipping 11 matching lines...) Expand all Loading... |
| 22 // BrowserCdmCast is an extension of BrowserCdm that provides common | 22 // BrowserCdmCast is an extension of BrowserCdm that provides common |
| 23 // functionality across CDM implementations. | 23 // functionality across CDM implementations. |
| 24 // All these additional functions are synchronous so: | 24 // All these additional functions are synchronous so: |
| 25 // - either both the CDM and the media pipeline must be running on the same | 25 // - either both the CDM and the media pipeline must be running on the same |
| 26 // thread, | 26 // thread, |
| 27 // - or BrowserCdmCast implementations must use some locks. | 27 // - or BrowserCdmCast implementations must use some locks. |
| 28 // | 28 // |
| 29 class BrowserCdmCast : public ::media::BrowserCdm { | 29 class BrowserCdmCast : public ::media::BrowserCdm { |
| 30 public: | 30 public: |
| 31 BrowserCdmCast(); | 31 BrowserCdmCast(); |
| 32 virtual ~BrowserCdmCast() override; | 32 ~BrowserCdmCast() override; |
| 33 | 33 |
| 34 // PlayerTracker implementation. | 34 // PlayerTracker implementation. |
| 35 int RegisterPlayer(const base::Closure& new_key_cb, | 35 int RegisterPlayer(const base::Closure& new_key_cb, |
| 36 const base::Closure& cdm_unset_cb) override; | 36 const base::Closure& cdm_unset_cb) override; |
| 37 void UnregisterPlayer(int registration_id) override; | 37 void UnregisterPlayer(int registration_id) override; |
| 38 | 38 |
| 39 // Returns the decryption context needed to decrypt frames encrypted with | 39 // Returns the decryption context needed to decrypt frames encrypted with |
| 40 // |key_id|. | 40 // |key_id|. |
| 41 // Returns null if |key_id| is not available. | 41 // Returns null if |key_id| is not available. |
| 42 virtual scoped_refptr<DecryptContext> GetDecryptContext( | 42 virtual scoped_refptr<DecryptContext> GetDecryptContext( |
| 43 const std::string& key_id) const = 0; | 43 const std::string& key_id) const = 0; |
| 44 | 44 |
| 45 protected: | 45 protected: |
| 46 // Notifies all listeners a new key was added on the next message loop cycle. | 46 // Notifies all listeners a new key was added on the next message loop cycle. |
| 47 void NotifyKeyAdded() const; | 47 void NotifyKeyAdded() const; |
| 48 | 48 |
| 49 private: | 49 private: |
| 50 uint32_t next_registration_id_; | 50 uint32_t next_registration_id_; |
| 51 std::map<uint32_t, base::Closure> new_key_callbacks_; | 51 std::map<uint32_t, base::Closure> new_key_callbacks_; |
| 52 std::map<uint32_t, base::Closure> cdm_unset_callbacks_; | 52 std::map<uint32_t, base::Closure> cdm_unset_callbacks_; |
| 53 | 53 |
| 54 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCast); | 54 DISALLOW_COPY_AND_ASSIGN(BrowserCdmCast); |
| 55 }; | 55 }; |
| 56 | 56 |
| 57 } // namespace media | 57 } // namespace media |
| 58 } // namespace chromecast | 58 } // namespace chromecast |
| 59 | 59 |
| 60 #endif // CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ | 60 #endif // CHROMECAST_MEDIA_CDM_BROWSER_CDM_CAST_H_ |
| OLD | NEW |