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

Side by Side Diff: media/base/cdm_context.h

Issue 1808983002: media: Add MediaDrmBridgeCdmContext. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: comments addressed Created 4 years, 9 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
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 // Only used for implementing SetCdm().
19 //
20 // There are CDMs that support neither Decryptor nor CDM ID, but use other ways
ddorwin 2016/03/21 21:40:25 We should probably move this to the new subclass a
xhwang 2016/03/22 17:08:32 Done.
21 // to connect the CDM with a media player. In this case, the CdmContext
ddorwin 2016/03/21 18:06:09 Is there a reason that the CDM ID couldn't be used
xhwang 2016/03/22 17:08:32 Acknowledged.
22 // implementation should add APIs to support such connection. The media player
23 // should cast the CdmContext to the correct type to access such APIs.
ddorwin 2016/03/21 18:06:09 It seems strange to provide such recommendations i
xhwang 2016/03/22 17:08:32 Done.
19 class MEDIA_EXPORT CdmContext { 24 class MEDIA_EXPORT CdmContext {
20 public: 25 public:
21 // Indicates an invalid CDM ID. See GetCdmId() for details. 26 // Indicates an invalid CDM ID. See GetCdmId() for details.
22 static const int kInvalidCdmId = 0; 27 static const int kInvalidCdmId = 0;
23 28
24 virtual ~CdmContext(); 29 virtual ~CdmContext();
25 30
26 // Gets the Decryptor object associated with the CDM. Returns nullptr if the 31 // 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() 32 // CDM does not support a Decryptor. Must not return nullptr if GetCdmId()
ddorwin 2016/03/21 18:06:09 This is not true in the new child.
ddorwin 2016/03/21 21:40:25 As discussed, we should instead describe when each
xhwang 2016/03/22 17:08:32 Done.
xhwang 2016/03/22 17:08:32 Done.
28 // returns kInvalidCdmId. The returned object is only guaranteed to be valid 33 // returns kInvalidCdmId. The returned object is only guaranteed to be valid
29 // during the CDM's lifetime. 34 // during the CDM's lifetime.
30 virtual Decryptor* GetDecryptor() = 0; 35 virtual Decryptor* GetDecryptor() = 0;
31 36
32 // Returns an ID that identifies a CDM, or kInvalidCdmId. The interpretation 37 // Returns an ID that identifies a CDM, or kInvalidCdmId. The interpretation
33 // is implementation-specific; current implementations use the ID to locate a 38 // is implementation-specific; current implementations use the ID to locate a
34 // remote CDM in a different process. The return value will not be 39 // remote CDM in a different process. The return value will not be
35 // kInvalidCdmId if GetDecryptor() returns nullptr. 40 // kInvalidCdmId if GetDecryptor() returns nullptr.
ddorwin 2016/03/21 18:06:09 ditto
xhwang 2016/03/22 17:08:32 Done.
36 virtual int GetCdmId() const = 0; 41 virtual int GetCdmId() const = 0;
37 42
38 protected: 43 protected:
39 CdmContext(); 44 CdmContext();
40 45
41 private: 46 private:
42 DISALLOW_COPY_AND_ASSIGN(CdmContext); 47 DISALLOW_COPY_AND_ASSIGN(CdmContext);
43 }; 48 };
44 49
45 // Callback to notify that the CdmContext has been completely attached to 50 // Callback to notify that the CdmContext has been completely attached to
46 // the media pipeline. Parameter indicates whether the operation succeeded. 51 // the media pipeline. Parameter indicates whether the operation succeeded.
47 typedef base::Callback<void(bool)> CdmAttachedCB; 52 typedef base::Callback<void(bool)> CdmAttachedCB;
48 53
49 // A dummy implementation of CdmAttachedCB. 54 // A dummy implementation of CdmAttachedCB.
50 MEDIA_EXPORT void IgnoreCdmAttached(bool success); 55 MEDIA_EXPORT void IgnoreCdmAttached(bool success);
51 56
52 } // namespace media 57 } // namespace media
53 58
54 #endif // MEDIA_BASE_CDM_CONTEXT_H_ 59 #endif // MEDIA_BASE_CDM_CONTEXT_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698