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

Side by Side Diff: chromecast/media/cdm/cast_cdm.h

Issue 2568463003: media: Rename MediaKeys to ContentDecryptionModule (Closed)
Patch Set: comments addressed Created 4 years 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
« no previous file with comments | « no previous file | chromecast/media/cdm/cast_cdm.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 CHROMECAST_MEDIA_CDM_cast_cdm_H_ 5 #ifndef CHROMECAST_MEDIA_CDM_cast_cdm_H_
6 #define CHROMECAST_MEDIA_CDM_cast_cdm_H_ 6 #define CHROMECAST_MEDIA_CDM_cast_cdm_H_
7 7
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <map> 10 #include <map>
11 #include <string> 11 #include <string>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/callback.h" 14 #include "base/callback.h"
15 #include "base/macros.h" 15 #include "base/macros.h"
16 #include "base/memory/ref_counted.h" 16 #include "base/memory/ref_counted.h"
17 #include "base/sequenced_task_runner_helpers.h" 17 #include "base/sequenced_task_runner_helpers.h"
18 #include "base/threading/thread_checker.h" 18 #include "base/threading/thread_checker.h"
19 #include "chromecast/media/base/media_resource_tracker.h" 19 #include "chromecast/media/base/media_resource_tracker.h"
20 #include "chromecast/media/cdm/cast_cdm_context.h" 20 #include "chromecast/media/cdm/cast_cdm_context.h"
21 #include "chromecast/public/media/cast_key_status.h" 21 #include "chromecast/public/media/cast_key_status.h"
22 #include "media/base/cdm_context.h" 22 #include "media/base/cdm_context.h"
23 #include "media/base/media_keys.h" 23 #include "media/base/content_decryption_module.h"
24 #include "media/base/player_tracker.h" 24 #include "media/base/player_tracker.h"
25 #include "media/cdm/json_web_key.h" 25 #include "media/cdm/json_web_key.h"
26 26
27 namespace media { 27 namespace media {
28 class PlayerTrackerImpl; 28 class PlayerTrackerImpl;
29 } 29 }
30 30
31 namespace chromecast { 31 namespace chromecast {
32 namespace media { 32 namespace media {
33 class DecryptContextImpl; 33 class DecryptContextImpl;
34 34
35 // CastCdm is an extension of MediaKeys that provides common 35 // CastCdm is an extension of ContentDecryptionModule that provides common
36 // functionality across CDM implementations. 36 // functionality across CDM implementations.
37 // All these additional functions are synchronous so: 37 // All these additional functions are synchronous so:
38 // - either both the CDM and the media pipeline must be running on the same 38 // - either both the CDM and the media pipeline must be running on the same
39 // thread, 39 // thread,
40 // - or CastCdm implementations must use some locks. 40 // - or CastCdm implementations must use some locks.
41 // 41 //
42 class CastCdm : public ::media::MediaKeys { 42 class CastCdm : public ::media::ContentDecryptionModule {
43 public: 43 public:
44 explicit CastCdm(MediaResourceTracker* media_resource_tracker); 44 explicit CastCdm(MediaResourceTracker* media_resource_tracker);
45 45
46 void Initialize( 46 void Initialize(
47 const ::media::SessionMessageCB& session_message_cb, 47 const ::media::SessionMessageCB& session_message_cb,
48 const ::media::SessionClosedCB& session_closed_cb, 48 const ::media::SessionClosedCB& session_closed_cb,
49 const ::media::SessionKeysChangeCB& session_keys_change_cb, 49 const ::media::SessionKeysChangeCB& session_keys_change_cb,
50 const ::media::SessionExpirationUpdateCB& session_expiration_update_cb); 50 const ::media::SessionExpirationUpdateCB& session_expiration_update_cb);
51 51
52 int RegisterPlayer(const base::Closure& new_key_cb, 52 int RegisterPlayer(const base::Closure& new_key_cb,
53 const base::Closure& cdm_unset_cb); 53 const base::Closure& cdm_unset_cb);
54 void UnregisterPlayer(int registration_id); 54 void UnregisterPlayer(int registration_id);
55 55
56 // Returns the decryption context needed to decrypt frames encrypted with 56 // Returns the decryption context needed to decrypt frames encrypted with
57 // |key_id|. Returns null if |key_id| is not available. 57 // |key_id|. Returns null if |key_id| is not available.
58 virtual std::unique_ptr<DecryptContextImpl> GetDecryptContext( 58 virtual std::unique_ptr<DecryptContextImpl> GetDecryptContext(
59 const std::string& key_id) const = 0; 59 const std::string& key_id) const = 0;
60 60
61 // Notifies that key status has changed (e.g. if expiry is detected by 61 // Notifies that key status has changed (e.g. if expiry is detected by
62 // hardware decoder). 62 // hardware decoder).
63 virtual void SetKeyStatus(const std::string& key_id, 63 virtual void SetKeyStatus(const std::string& key_id,
64 CastKeyStatus key_status, 64 CastKeyStatus key_status,
65 uint32_t system_code) = 0; 65 uint32_t system_code) = 0;
66 66
67 // ::media::MediaKeys implementation. 67 // ::media::ContentDecryptionModule implementation.
68 ::media::CdmContext* GetCdmContext() override; 68 ::media::CdmContext* GetCdmContext() override;
69 69
70 protected: 70 protected:
71 ~CastCdm() override; 71 ~CastCdm() override;
72 72
73 void OnSessionMessage(const std::string& session_id, 73 void OnSessionMessage(
74 const std::vector<uint8_t>& message, 74 const std::string& session_id,
75 ::media::MediaKeys::MessageType message_type); 75 const std::vector<uint8_t>& message,
76 ::media::ContentDecryptionModule::MessageType message_type);
76 void OnSessionClosed(const std::string& session_id); 77 void OnSessionClosed(const std::string& session_id);
77 void OnSessionKeysChange(const std::string& session_id, 78 void OnSessionKeysChange(const std::string& session_id,
78 bool newly_usable_keys, 79 bool newly_usable_keys,
79 ::media::CdmKeysInfo keys_info); 80 ::media::CdmKeysInfo keys_info);
80 81
81 void KeyIdAndKeyPairsToInfo(const ::media::KeyIdAndKeyPairs& keys, 82 void KeyIdAndKeyPairsToInfo(const ::media::KeyIdAndKeyPairs& keys,
82 ::media::CdmKeysInfo* key_info); 83 ::media::CdmKeysInfo* key_info);
83 84
84 private: 85 private:
85 // Allow subclasses to override to provide key sysytem specific 86 // Allow subclasses to override to provide key sysytem specific
(...skipping 11 matching lines...) Expand all
97 98
98 base::ThreadChecker thread_checker_; 99 base::ThreadChecker thread_checker_;
99 100
100 DISALLOW_COPY_AND_ASSIGN(CastCdm); 101 DISALLOW_COPY_AND_ASSIGN(CastCdm);
101 }; 102 };
102 103
103 } // namespace media 104 } // namespace media
104 } // namespace chromecast 105 } // namespace chromecast
105 106
106 #endif // CHROMECAST_MEDIA_CDM_cast_cdm_H_ 107 #endif // CHROMECAST_MEDIA_CDM_cast_cdm_H_
OLDNEW
« no previous file with comments | « no previous file | chromecast/media/cdm/cast_cdm.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698