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.
5 #ifndef MEDIA_BASE_PLAYER_TRACKER_H_
6 #define MEDIA_BASE_PLAYER_TRACKER_H_
8 #include "base/basictypes.h"
9 #include "base/callback.h"
10 #include "media/base/media_export.h"
14 // An interface for players to register to be notified when a new decryption key
15 // becomes available or when the CDM is unset.
16 class MEDIA_EXPORT PlayerTracker
{
18 virtual ~PlayerTracker();
20 // Registers player callbacks with the CDM.
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.
23 // Returns a registration ID which can be used to unregister a player.
24 virtual int RegisterPlayer(const base::Closure
& new_key_cb
,
25 const base::Closure
& cdm_unset_cb
) = 0;
27 // 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 // player is destroyed.
30 virtual void UnregisterPlayer(int registration_id
) = 0;
36 DISALLOW_COPY_AND_ASSIGN(PlayerTracker
);
41 #endif // MEDIA_BASE_PLAYER_TRACKER_H_