Commit 4881bbb8 authored by yucliu's avatar yucliu Committed by Commit bot

[Chromecast] Change DecryptContext Decrypt API

1. Change |output| from vector<uint8_t> to uint8_t*.
2. Add param |data_offset|.

BUG=internal b/31219712
TEST=build cast_shell

Review-Url: https://codereview.chromium.org/2450563002
Cr-Commit-Position: refs/heads/master@{#427275}
parent ea08ac80
......@@ -31,12 +31,6 @@ CastKeySystem DecryptContextImpl::GetKeySystem() {
return key_system_;
}
bool DecryptContextImpl::Decrypt(CastDecoderBuffer* buffer,
std::vector<uint8_t>* output) {
output->resize(buffer->data_size());
return Decrypt(buffer, output->data(), 0);
}
bool DecryptContextImpl::Decrypt(CastDecoderBuffer* buffer,
uint8_t* output,
size_t data_offset) {
......
......@@ -31,20 +31,8 @@ class DecryptContextImpl : public DecryptContext {
// DecryptContext implementation:
CastKeySystem GetKeySystem() override;
bool Decrypt(CastDecoderBuffer* buffer,
std::vector<uint8_t>* output) final;
// TODO(smcgruer): Replace DecryptContext::Decrypt with this one in next
// public api releasing.
// Decrypts the given buffer. Returns true/false for success/failure.
//
// The decrypted data will be of size |buffer.data_size()| and there must be
// enough space in |output| to store that data.
//
// If non-zero, |data_offset| specifies an offset to be applied to |output|
// before the decrypted data is written.
virtual bool Decrypt(CastDecoderBuffer* buffer,
uint8_t* output,
size_t data_offset);
uint8_t* output,
size_t data_offset) override;
// Similar as the above one. Decryption success or not will be returned in
// |decrypt_cb|. |decrypt_cb| will be called on caller's thread.
......
......@@ -22,10 +22,16 @@ class DecryptContext {
// Get the key system to use for decryption.
virtual CastKeySystem GetKeySystem() = 0;
// Decrypts the given buffer. Returns true/false for success/failure,
// and places the decrypted data in output if successful.
// Decrypts the given buffer. Returns true/false for success/failure.
//
// The decrypted data will be of size |buffer.data_size()| and there must be
// enough space in |output| to store that data.
//
// If non-zero, |data_offset| specifies an offset to be applied to |output|
// before the decrypted data is written.
virtual bool Decrypt(CastDecoderBuffer* buffer,
std::vector<uint8_t>* output) = 0;
uint8_t* output,
size_t data_offset) = 0;
};
} // namespace media
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment