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 pipeline 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. |
sandersd (OOO until July 31)
2015/06/04 22:53:07
Add that CdmContext is only used for calling SetCd
xhwang
2015/06/05 18:14:52
Done.
| |
18 class MEDIA_EXPORT CdmContext { | 18 class MEDIA_EXPORT CdmContext { |
19 public: | 19 public: |
20 // Indicates an invalid CDM ID. See GetCdmId() for details. | 20 // Indicates an invalid CDM ID. See GetCdmId() for details. |
21 static const int kInvalidCdmId = 0; | 21 static const int kInvalidCdmId = 0; |
22 | 22 |
23 virtual ~CdmContext(); | 23 virtual ~CdmContext(); |
24 | 24 |
25 // Gets the Decryptor object associated with the CDM. Returns NULL if the CDM | 25 // Gets the Decryptor object associated with the CDM. Returns NULL if the CDM |
26 // does not support a Decryptor. The returned object is only guaranteed to be | 26 // does not support a Decryptor. The returned object is only guaranteed to be |
27 // valid during the CDM's lifetime. | 27 // valid during the CDM's lifetime. |
sandersd (OOO until July 31)
2015/06/04 22:53:07
Add that if the return value will not be NULL if G
xhwang
2015/06/05 18:14:51
Done.
| |
28 virtual Decryptor* GetDecryptor() = 0; | 28 virtual Decryptor* GetDecryptor() = 0; |
29 | 29 |
30 // Returns an ID associated with the CDM, which can be used to locate the real | 30 // Returns an ID associated with the CDM, which can be used to locate the real |
31 // CDM instance. This is useful when the CDM is hosted remotely, e.g. in a | 31 // CDM instance. This is useful when the CDM is hosted remotely, e.g. in a |
32 // different process. | 32 // different process. |
sandersd (OOO until July 31)
2015/06/04 22:53:07
This sentence is confusing. I would say:
Returns
xhwang
2015/06/05 18:14:51
Done with s/the browser/a different/ because we ca
| |
33 // Returns kInvalidCdmId if the CDM cannot be used remotely. In this case, | 33 // Returns kInvalidCdmId if the CDM cannot be used remotely. In this case, |
34 // GetDecryptor() should return a non-null Decryptor. | 34 // GetDecryptor() should return a non-null Decryptor. |
sandersd (OOO until July 31)
2015/06/04 22:53:07
I would say:
The return value will not be kInvali
xhwang
2015/06/05 18:14:52
Done.
| |
35 virtual int GetCdmId() const = 0; | 35 virtual int GetCdmId() const = 0; |
36 | 36 |
37 protected: | 37 protected: |
38 CdmContext(); | 38 CdmContext(); |
39 | 39 |
40 private: | 40 private: |
41 DISALLOW_COPY_AND_ASSIGN(CdmContext); | 41 DISALLOW_COPY_AND_ASSIGN(CdmContext); |
42 }; | 42 }; |
43 | 43 |
44 // An interface that provides the access to a CdmContext through |cdm_id|. | |
sandersd (OOO until July 31)
2015/06/04 22:53:07
An interface for looking up CdmContext objects by
xhwang
2015/06/05 18:14:51
Done.
| |
45 // This is typically used when CDMs are hosted remotely. | |
sandersd (OOO until July 31)
2015/06/04 22:53:07
This is confusing because a CdmContextProvider onl
xhwang
2015/06/05 18:14:52
Done.
| |
46 class MEDIA_EXPORT CdmContextProvider { | |
47 public: | |
48 virtual ~CdmContextProvider(); | |
49 | |
50 // Returns the CdmContext corresponding to |cdm_id|. Returns nullptr if no | |
51 // such CdmContext can be found. | |
52 // Note: |cdm_id| is not necessarily the same as GetCdmId() of the returned | |
53 // CdmContext. The former is used to locate the real CDM, which typically | |
54 // is a local CDM and cannot be used remotely. So GetCdmId() on the returned | |
55 // CdmContext should return kInvalidCdmId. | |
sandersd (OOO until July 31)
2015/06/04 22:53:07
I would say:
Note: Calling GetCdmId() on the retu
xhwang
2015/06/05 18:14:52
Done.
| |
56 virtual CdmContext* GetCdmContext(int cdm_id) = 0; | |
57 | |
58 protected: | |
59 CdmContextProvider(); | |
60 | |
61 private: | |
62 DISALLOW_COPY_AND_ASSIGN(CdmContextProvider); | |
63 }; | |
64 | |
44 // Callback to notify that the CdmContext has been completely attached to | 65 // Callback to notify that the CdmContext has been completely attached to |
45 // the media pipeline. Parameter indicates whether the operation succeeded. | 66 // the media pipeline. Parameter indicates whether the operation succeeded. |
46 typedef base::Callback<void(bool)> CdmAttachedCB; | 67 typedef base::Callback<void(bool)> CdmAttachedCB; |
47 | 68 |
48 // A dummy implementation of CdmAttachedCB. | 69 // A dummy implementation of CdmAttachedCB. |
49 MEDIA_EXPORT void IgnoreCdmAttached(bool success); | 70 MEDIA_EXPORT void IgnoreCdmAttached(bool success); |
50 | 71 |
51 } // namespace media | 72 } // namespace media |
52 | 73 |
53 #endif // MEDIA_BASE_CDM_CONTEXT_H_ | 74 #endif // MEDIA_BASE_CDM_CONTEXT_H_ |
OLD | NEW |