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_BASE_PLAYER_TRACKER_H_ | 5 #ifndef MEDIA_BASE_PLAYER_TRACKER_H_ |
6 #define MEDIA_BASE_PLAYER_TRACKER_H_ | 6 #define MEDIA_BASE_PLAYER_TRACKER_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/callback.h" | 9 #include "base/callback.h" |
10 #include "media/base/media_export.h" | 10 #include "media/base/media_export.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 // An interface for players to register to be notified when a new decryption key | 14 // An interface for players to register to be notified when a new decryption key |
15 // becomes available or when the CDM is unset. | 15 // becomes available or when the CDM is unset. |
16 class MEDIA_EXPORT PlayerTracker { | 16 class MEDIA_EXPORT PlayerTracker { |
17 public: | 17 public: |
18 virtual ~PlayerTracker(); | 18 virtual ~PlayerTracker(); |
19 | 19 |
20 // Registers player callbacks with the CDM. | 20 // Registers player callbacks with the CDM. |
21 // - |new_key_cb| is fired when a new decryption key becomes available. | 21 // - |new_key_cb| is fired when a new decryption key becomes available. |
22 // - |cdm_unset_cb| is fired when the CDM is detached from the player. | 22 // - |cdm_unset_cb| is fired when the CDM is detached from the player. The |
| 23 // player should stop using the CDM and release any ref-count to the CDM. |
23 // Returns a registration ID which can be used to unregister a player. | 24 // Returns a registration ID which can be used to unregister a player. |
24 virtual int RegisterPlayer(const base::Closure& new_key_cb, | 25 virtual int RegisterPlayer(const base::Closure& new_key_cb, |
25 const base::Closure& cdm_unset_cb) = 0; | 26 const base::Closure& cdm_unset_cb) = 0; |
26 | 27 |
27 // Unregisters a previously registered player. This should be called when | 28 // Unregisters a previously registered player. This should be called when |
28 // the CDM is detached from the player (e.g. setMediaKeys(0)), or when the | 29 // the CDM is detached from the player (e.g. setMediaKeys(0)), or when the |
29 // player is destroyed. | 30 // player is destroyed. |
30 virtual void UnregisterPlayer(int registration_id) = 0; | 31 virtual void UnregisterPlayer(int registration_id) = 0; |
31 | 32 |
32 protected: | 33 protected: |
33 PlayerTracker(); | 34 PlayerTracker(); |
34 | 35 |
35 private: | 36 private: |
36 DISALLOW_COPY_AND_ASSIGN(PlayerTracker); | 37 DISALLOW_COPY_AND_ASSIGN(PlayerTracker); |
37 }; | 38 }; |
38 | 39 |
39 } // namespace media | 40 } // namespace media |
40 | 41 |
41 #endif // MEDIA_BASE_PLAYER_TRACKER_H_ | 42 #endif // MEDIA_BASE_PLAYER_TRACKER_H_ |
OLD | NEW |