forked from sanyaade-mobiledev/chromium.src
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Separate MediaKeys interface from Decryptor interface.
BUG=none TEST=none Review URL: https://chromiumcodereview.appspot.com/15772012 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@203026 0039d316-1c4b-4281-b951-d872f2087c98
- Loading branch information
xhwang@chromium.org
committed
May 30, 2013
1 parent
2dcec1f
commit 15b05a7
Showing
22 changed files
with
189 additions
and
132 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#include "media/base/media_keys.h" | ||
|
||
namespace media { | ||
|
||
MediaKeys::MediaKeys() {} | ||
|
||
MediaKeys::~MediaKeys() {} | ||
|
||
} // namespace media |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,89 @@ | ||
// Copyright 2013 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
#ifndef MEDIA_BASE_MEDIA_KEYS_H_ | ||
#define MEDIA_BASE_MEDIA_KEYS_H_ | ||
|
||
#include <string> | ||
|
||
#include "base/basictypes.h" | ||
#include "base/callback.h" | ||
#include "base/memory/scoped_ptr.h" | ||
#include "media/base/media_export.h" | ||
|
||
namespace media { | ||
|
||
// Performs media key operations. | ||
// | ||
// All key operations are called on the renderer thread. Therefore, these calls | ||
// should be fast and nonblocking; key events should be fired asynchronously. | ||
class MEDIA_EXPORT MediaKeys { | ||
public: | ||
// Reported to UMA, so never reuse a value! | ||
// Must be kept in sync with WebKit::WebMediaPlayerClient::MediaKeyErrorCode | ||
// (enforced in webmediaplayer_impl.cc). | ||
enum KeyError { | ||
kUnknownError = 1, | ||
kClientError, | ||
kServiceError, | ||
kOutputError, | ||
kHardwareChangeError, | ||
kDomainError, | ||
kMaxKeyError // Must be last and greater than any legit value. | ||
}; | ||
|
||
MediaKeys(); | ||
virtual ~MediaKeys(); | ||
|
||
// Generates a key request for the |key_system| with |type| and | ||
// |init_data| provided. | ||
// Returns true if generating key request succeeded, false otherwise. | ||
// Note: AddKey() and CancelKeyRequest() should only be called after | ||
// GenerateKeyRequest() returns true. | ||
virtual bool GenerateKeyRequest(const std::string& key_system, | ||
const std::string& type, | ||
const uint8* init_data, | ||
int init_data_length) = 0; | ||
|
||
// Adds a |key| to the |key_system|. The |key| is not limited to a decryption | ||
// key. It can be any data that the key system accepts, such as a license. | ||
// If multiple calls of this function set different keys for the same | ||
// key ID, the older key will be replaced by the newer key. | ||
virtual void AddKey(const std::string& key_system, | ||
const uint8* key, int key_length, | ||
const uint8* init_data, int init_data_length, | ||
const std::string& session_id) = 0; | ||
|
||
// Cancels the key request specified by |session_id|. | ||
virtual void CancelKeyRequest(const std::string& key_system, | ||
const std::string& session_id) = 0; | ||
|
||
private: | ||
DISALLOW_COPY_AND_ASSIGN(MediaKeys); | ||
}; | ||
|
||
// Key event callbacks. See the spec for details: | ||
// http://dvcs.w3.org/hg/html-media/raw-file/eme-v0.1b/encrypted-media/encrypted-media.html#event-summary | ||
typedef base::Callback<void(const std::string& key_system, | ||
const std::string& session_id)> KeyAddedCB; | ||
|
||
typedef base::Callback<void(const std::string& key_system, | ||
const std::string& session_id, | ||
media::MediaKeys::KeyError error_code, | ||
int system_code)> KeyErrorCB; | ||
|
||
typedef base::Callback<void(const std::string& key_system, | ||
const std::string& session_id, | ||
const std::string& message, | ||
const std::string& default_url)> KeyMessageCB; | ||
|
||
typedef base::Callback<void(const std::string& key_system, | ||
const std::string& session_id, | ||
const std::string& type, | ||
scoped_ptr<uint8[]> init_data, | ||
int init_data_size)> NeedKeyCB; | ||
|
||
} // namespace media | ||
|
||
#endif // MEDIA_BASE_MEDIA_KEYS_H_ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.