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

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

Issue 17289006: Separate CDM initialization from GenerateKeyRequest & remove key_system parameters. (Closed) Base URL: master
Patch Set: rebase only Created 7 years, 6 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
« no previous file with comments | « media/base/android/media_source_player_unittest.cc ('k') | media/crypto/aes_decryptor.h » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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_MEDIA_KEYS_H_ 5 #ifndef MEDIA_BASE_MEDIA_KEYS_H_
6 #define MEDIA_BASE_MEDIA_KEYS_H_ 6 #define MEDIA_BASE_MEDIA_KEYS_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 19 matching lines...) Expand all
30 // kServiceError, 30 // kServiceError,
31 // kOutputError, 31 // kOutputError,
32 // kHardwareChangeError, 32 // kHardwareChangeError,
33 // kDomainError, 33 // kDomainError,
34 kMaxKeyError // Must be last and greater than any legit value. 34 kMaxKeyError // Must be last and greater than any legit value.
35 }; 35 };
36 36
37 MediaKeys(); 37 MediaKeys();
38 virtual ~MediaKeys(); 38 virtual ~MediaKeys();
39 39
40 // Generates a key request for the |key_system| with |type| and 40 // Generates a key request with the |type| and |init_data| provided.
41 // |init_data| provided.
42 // Returns true if generating key request succeeded, false otherwise. 41 // Returns true if generating key request succeeded, false otherwise.
43 // Note: AddKey() and CancelKeyRequest() should only be called after 42 // Note: AddKey() and CancelKeyRequest() should only be called after
44 // GenerateKeyRequest() returns true. 43 // GenerateKeyRequest() returns true.
45 virtual bool GenerateKeyRequest(const std::string& key_system, 44 virtual bool GenerateKeyRequest(const std::string& type,
46 const std::string& type,
47 const uint8* init_data, 45 const uint8* init_data,
48 int init_data_length) = 0; 46 int init_data_length) = 0;
49 47
50 // Adds a |key| to the |key_system|. The |key| is not limited to a decryption 48 // Adds a |key| to the session. The |key| is not limited to a decryption
51 // key. It can be any data that the key system accepts, such as a license. 49 // key. It can be any data that the key system accepts, such as a license.
52 // If multiple calls of this function set different keys for the same 50 // If multiple calls of this function set different keys for the same
53 // key ID, the older key will be replaced by the newer key. 51 // key ID, the older key will be replaced by the newer key.
54 virtual void AddKey(const std::string& key_system, 52 virtual void AddKey(const uint8* key, int key_length,
55 const uint8* key, int key_length,
56 const uint8* init_data, int init_data_length, 53 const uint8* init_data, int init_data_length,
57 const std::string& session_id) = 0; 54 const std::string& session_id) = 0;
58 55
59 // Cancels the key request specified by |session_id|. 56 // Cancels the key request specified by |session_id|.
60 virtual void CancelKeyRequest(const std::string& key_system, 57 virtual void CancelKeyRequest(const std::string& session_id) = 0;
61 const std::string& session_id) = 0;
62 58
63 private: 59 private:
64 DISALLOW_COPY_AND_ASSIGN(MediaKeys); 60 DISALLOW_COPY_AND_ASSIGN(MediaKeys);
65 }; 61 };
66 62
67 // Key event callbacks. See the spec for details: 63 // Key event callbacks. See the spec for details:
68 // http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted -media.html#event-summary 64 // http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted -media.html#event-summary
69 typedef base::Callback<void(const std::string& key_system, 65 typedef base::Callback<void(const std::string& session_id)> KeyAddedCB;
70 const std::string& session_id)> KeyAddedCB;
71 66
72 typedef base::Callback<void(const std::string& key_system, 67 typedef base::Callback<void(const std::string& session_id,
73 const std::string& session_id,
74 media::MediaKeys::KeyError error_code, 68 media::MediaKeys::KeyError error_code,
75 int system_code)> KeyErrorCB; 69 int system_code)> KeyErrorCB;
76 70
77 typedef base::Callback<void(const std::string& key_system, 71 typedef base::Callback<void(const std::string& session_id,
78 const std::string& session_id,
79 const std::string& message, 72 const std::string& message,
80 const std::string& default_url)> KeyMessageCB; 73 const std::string& default_url)> KeyMessageCB;
81 74
82 typedef base::Callback<void(const std::string& key_system, 75 typedef base::Callback<void(const std::string& session_id,
83 const std::string& session_id,
84 const std::string& type, 76 const std::string& type,
85 scoped_ptr<uint8[]> init_data, 77 scoped_ptr<uint8[]> init_data,
86 int init_data_size)> NeedKeyCB; 78 int init_data_size)> NeedKeyCB;
87 79
88 } // namespace media 80 } // namespace media
89 81
90 #endif // MEDIA_BASE_MEDIA_KEYS_H_ 82 #endif // MEDIA_BASE_MEDIA_KEYS_H_
OLDNEW
« no previous file with comments | « media/base/android/media_source_player_unittest.cc ('k') | media/crypto/aes_decryptor.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698