Index: media/base/player_tracker.h |
diff --git a/media/base/player_tracker.h b/media/base/player_tracker.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..6f934fd3fe36283cce0acb4190311e1175c1cd7c |
--- /dev/null |
+++ b/media/base/player_tracker.h |
@@ -0,0 +1,39 @@ |
+// Copyright 2014 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#ifndef MEDIA_BASE_PLAYER_TRACKER_H_ |
+#define MEDIA_BASE_PLAYER_TRACKER_H_ |
+ |
+#include "base/basictypes.h" |
+#include "base/callback.h" |
+#include "media/base/media_export.h" |
+ |
+namespace media { |
+ |
+// An interface that helps CDMs notify players when a new decryption key becomes |
ddorwin
2014/05/30 20:50:05
nit: "An interface for players to register to be n
xhwang
2014/06/02 20:11:43
Done.
|
+// available or when the CDM is destroyed. |
+class MEDIA_EXPORT PlayerTracker { |
+ public: |
+ PlayerTracker(); |
ddorwin
2014/05/30 20:50:05
ditto
xhwang
2014/06/02 20:11:43
Done.
|
+ virtual ~PlayerTracker(); |
+ |
+ // Registers player callbacks with the CDM. |
+ // - |new_key_cb| is fired when a new decryption key becomes available. |
+ // - |cdm_destroyed_cb| is fired when the CDM is destroyed. |
ddorwin
2014/05/30 20:50:05
ditto on the name
xhwang
2014/06/02 20:11:43
Done.
|
+ // Returns a registration ID which can be used to unregister a player. |
+ virtual int RegisterPlayer(const base::Closure& new_key_cb, |
+ const base::Closure& cdm_destroyed_cb) = 0; |
damienv1
2014/05/30 15:10:15
There is an implicit assumption that the CDM and t
xhwang
2014/05/30 17:18:53
The current plan is to use this only for BrowserCd
ddorwin
2014/05/30 20:50:05
Can we add DCHECKs on the thread?
xhwang
2014/06/02 20:11:43
Done.
|
+ |
+ // Unregisters a previously registered player. This should be called when |
+ // the CDM is detached from the player (e.g. setMediaKeys(0)), or when the |
+ // player is destroyed. |
+ virtual void UnregisterPlayer(int registration_id) = 0; |
+ |
+ private: |
+ DISALLOW_COPY_AND_ASSIGN(PlayerTracker); |
+}; |
+ |
+} // namespace media |
+ |
+#endif // MEDIA_BASE_PLAYER_TRACKER_H_ |