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" |
(...skipping 23 matching lines...) Expand all Loading... |
34 // GetDecryptor() should return a non-null Decryptor. | 34 // GetDecryptor() should return a non-null Decryptor. |
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|. |
| 45 // This is typically used when CDMs are hosted remotely. |
| 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 irrelevant to GetCdmId() of the returned CdmContext. |
| 53 // The former is used to locate the real CDM (the latter), which could just |
| 54 // be a local CDM that doesn't support a CDM ID. |
| 55 virtual CdmContext* GetCdmContext(int cdm_id) = 0; |
| 56 |
| 57 protected: |
| 58 CdmContextProvider(); |
| 59 |
| 60 private: |
| 61 DISALLOW_COPY_AND_ASSIGN(CdmContextProvider); |
| 62 }; |
| 63 |
44 // Callback to notify that the CdmContext has been completely attached to | 64 // Callback to notify that the CdmContext has been completely attached to |
45 // the media pipeline. Parameter indicates whether the operation succeeded. | 65 // the media pipeline. Parameter indicates whether the operation succeeded. |
46 typedef base::Callback<void(bool)> CdmAttachedCB; | 66 typedef base::Callback<void(bool)> CdmAttachedCB; |
47 | 67 |
48 // A dummy implementation of CdmAttachedCB. | 68 // A dummy implementation of CdmAttachedCB. |
49 MEDIA_EXPORT void IgnoreCdmAttached(bool success); | 69 MEDIA_EXPORT void IgnoreCdmAttached(bool success); |
50 | 70 |
51 } // namespace media | 71 } // namespace media |
52 | 72 |
53 #endif // MEDIA_BASE_CDM_CONTEXT_H_ | 73 #endif // MEDIA_BASE_CDM_CONTEXT_H_ |
OLD | NEW |