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_CDM_CONTEXT_H_ | 5 #ifndef MEDIA_BASE_CDM_CONTEXT_H_ |
6 #define MEDIA_BASE_CDM_CONTEXT_H_ | 6 #define MEDIA_BASE_CDM_CONTEXT_H_ |
7 | 7 |
8 #include "base/callback.h" | 8 #include "base/callback.h" |
9 #include "base/macros.h" | 9 #include "base/macros.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 class Decryptor; | 14 class Decryptor; |
15 | 15 |
16 // An interface representing the context that a media pipeline needs from a | 16 // An interface representing the context that a media player needs from a |
17 // content decryption module (CDM) to decrypt (and decode) encrypted buffers. | 17 // content decryption module (CDM) to decrypt (and decode) encrypted buffers. |
18 // Only used for implementing SetCdm(). | 18 // This is used to pass the CDM to the media player (e.g. SetCdm()). |
19 class MEDIA_EXPORT CdmContext { | 19 class MEDIA_EXPORT CdmContext { |
20 public: | 20 public: |
21 // Indicates an invalid CDM ID. See GetCdmId() for details. | 21 // Indicates an invalid CDM ID. See GetCdmId() for details. |
22 static const int kInvalidCdmId = 0; | 22 static const int kInvalidCdmId = 0; |
23 | 23 |
24 virtual ~CdmContext(); | 24 virtual ~CdmContext(); |
25 | 25 |
26 // Gets the Decryptor object associated with the CDM. Returns nullptr if the | 26 // Gets the Decryptor object associated with the CDM. Returns nullptr if the |
27 // CDM does not support a Decryptor. Must not return nullptr if GetCdmId() | 27 // CDM does not support a Decryptor. The returned object is only guaranteed to |
ddorwin
2016/03/22 17:20:12
nit: Should we add something like "(i.e. platform-
xhwang
2016/03/22 17:35:10
Done.
| |
28 // returns kInvalidCdmId. The returned object is only guaranteed to be valid | 28 // be valid during the CDM's lifetime. |
29 // during the CDM's lifetime. | |
30 virtual Decryptor* GetDecryptor() = 0; | 29 virtual Decryptor* GetDecryptor() = 0; |
31 | 30 |
32 // Returns an ID that identifies a CDM, or kInvalidCdmId. The interpretation | 31 // Returns an ID that can be used to identify a CDM remotely, in which case |
ddorwin
2016/03/22 17:20:12
nit: I'm not sure what "identify... remotely" mean
xhwang
2016/03/22 17:35:10
Done.
| |
33 // is implementation-specific; current implementations use the ID to locate a | 32 // this CDM serves as a proxy to the remote CDM. Returns kInvalidCdmId when |
34 // remote CDM in a different process. The return value will not be | 33 // remote CDM is not supported (e.g. this CDM is a concrete CDM). |
ddorwin
2016/03/22 17:20:12
nit: I'm not sure what a "concrete CDM" is. Perhap
xhwang
2016/03/22 17:35:10
Done. Used "local" in comparison to "remote".
| |
35 // kInvalidCdmId if GetDecryptor() returns nullptr. | |
36 virtual int GetCdmId() const = 0; | 34 virtual int GetCdmId() const = 0; |
37 | 35 |
38 protected: | 36 protected: |
39 CdmContext(); | 37 CdmContext(); |
40 | 38 |
41 private: | 39 private: |
42 DISALLOW_COPY_AND_ASSIGN(CdmContext); | 40 DISALLOW_COPY_AND_ASSIGN(CdmContext); |
43 }; | 41 }; |
44 | 42 |
45 // Callback to notify that the CdmContext has been completely attached to | 43 // Callback to notify that the CdmContext has been completely attached to |
46 // the media pipeline. Parameter indicates whether the operation succeeded. | 44 // the media pipeline. Parameter indicates whether the operation succeeded. |
47 typedef base::Callback<void(bool)> CdmAttachedCB; | 45 typedef base::Callback<void(bool)> CdmAttachedCB; |
48 | 46 |
49 // A dummy implementation of CdmAttachedCB. | 47 // A dummy implementation of CdmAttachedCB. |
50 MEDIA_EXPORT void IgnoreCdmAttached(bool success); | 48 MEDIA_EXPORT void IgnoreCdmAttached(bool success); |
51 | 49 |
52 } // namespace media | 50 } // namespace media |
53 | 51 |
54 #endif // MEDIA_BASE_CDM_CONTEXT_H_ | 52 #endif // MEDIA_BASE_CDM_CONTEXT_H_ |
OLD | NEW |