OLD | NEW |
---|---|
(Empty) | |
1 // Copyright 2017 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 MEDIA_CDM_CDM_MANAGER_H_ | |
6 #define MEDIA_CDM_CDM_MANAGER_H_ | |
7 | |
8 #include <map> | |
9 | |
10 #include "base/macros.h" | |
11 #include "base/memory/ref_counted.h" | |
12 #include "base/synchronization/lock.h" | |
13 | |
14 namespace media { | |
15 | |
16 class ContentDecryptionModule; | |
17 | |
18 // Provides a singleton registry of CDM instances. This is used to share | |
19 // ContentDecryptionModules between the MojoMediaService and | |
20 // AndroidVideoDecodeAccelerator, and should be removed along with AVDA in the | |
21 // future. (MojoCdmContext serves the same purpose for Media Mojo services, | |
xhwang
2017/05/04 01:41:41
nit: MojoCdmContext -> MojoCdmServiceContext
sandersd (OOO until July 31)
2017/05/04 19:56:11
Done.
| |
22 // but scoped to a single InterfaceFactory.) | |
23 class CdmManager { | |
24 public: | |
25 CdmManager(); | |
26 ~CdmManager(); | |
27 | |
28 static CdmManager* GetInstance(); | |
29 | |
30 // Returns the CDM associated with |cdm_id|. Can be called on any thread. | |
31 scoped_refptr<ContentDecryptionModule> GetCdm(int cdm_id); | |
32 | |
33 // Registers the |cdm| for |cdm_id|. | |
34 void RegisterCdm(int cdm_id, scoped_refptr<ContentDecryptionModule> cdm); | |
35 | |
36 // Unregisters the CDM associated with |cdm_id|. | |
37 void UnregisterCdm(int cdm_id); | |
38 | |
39 private: | |
40 base::Lock lock_; | |
41 std::map<int, scoped_refptr<ContentDecryptionModule>> cdm_map_; | |
42 | |
43 DISALLOW_COPY_AND_ASSIGN(CdmManager); | |
44 }; | |
45 | |
46 } // namespace media | |
47 | |
48 #endif // MEDIA_CDM_CDM_MANAGER_H_ | |
OLD | NEW |