Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Side by Side Diff: media/cdm/cdm_manager.h

Issue 2857953006: Extract CdmManager from MojoCdmService. (Closed)
Patch Set: Switch to component(). Created 3 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(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 #include "media/base/media_export.h"
14
15 namespace media {
16
17 class ContentDecryptionModule;
18
19 // Provides a singleton registry of CDM instances. This is used to share
20 // ContentDecryptionModules between the MojoMediaService and
21 // AndroidVideoDecodeAccelerator, and should be removed along with AVDA in the
22 // future. (MojoCdmServiceContext serves the same purpose for Media Mojo
23 // services, but scoped to a single InterfaceFactory.)
24 class MEDIA_EXPORT CdmManager {
25 public:
26 CdmManager();
27 ~CdmManager();
28
29 static CdmManager* GetInstance();
30
31 // Returns the CDM associated with |cdm_id|. Can be called on any thread.
32 scoped_refptr<ContentDecryptionModule> GetCdm(int cdm_id);
33
34 // Registers the |cdm| for |cdm_id|.
35 void RegisterCdm(int cdm_id, scoped_refptr<ContentDecryptionModule> cdm);
36
37 // Unregisters the CDM associated with |cdm_id|.
38 void UnregisterCdm(int cdm_id);
39
40 private:
41 base::Lock lock_;
42 std::map<int, scoped_refptr<ContentDecryptionModule>> cdm_map_;
43
44 DISALLOW_COPY_AND_ASSIGN(CdmManager);
45 };
46
47 } // namespace media
48
49 #endif // MEDIA_CDM_CDM_MANAGER_H_
OLDNEW
« media/BUILD.gn ('K') | « media/BUILD.gn ('k') | media/cdm/cdm_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698