| OLD | NEW |
| 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 #include "chromecast/media/base/decrypt_context_impl.h" | 5 #include "chromecast/media/base/decrypt_context_impl.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 14 matching lines...) Expand all Loading... |
| 25 DecryptContextImpl::DecryptContextImpl(CastKeySystem key_system) | 25 DecryptContextImpl::DecryptContextImpl(CastKeySystem key_system) |
| 26 : key_system_(key_system) {} | 26 : key_system_(key_system) {} |
| 27 | 27 |
| 28 DecryptContextImpl::~DecryptContextImpl() {} | 28 DecryptContextImpl::~DecryptContextImpl() {} |
| 29 | 29 |
| 30 CastKeySystem DecryptContextImpl::GetKeySystem() { | 30 CastKeySystem DecryptContextImpl::GetKeySystem() { |
| 31 return key_system_; | 31 return key_system_; |
| 32 } | 32 } |
| 33 | 33 |
| 34 bool DecryptContextImpl::Decrypt(CastDecoderBuffer* buffer, | 34 bool DecryptContextImpl::Decrypt(CastDecoderBuffer* buffer, |
| 35 std::vector<uint8_t>* output) { | |
| 36 output->resize(buffer->data_size()); | |
| 37 return Decrypt(buffer, output->data(), 0); | |
| 38 } | |
| 39 | |
| 40 bool DecryptContextImpl::Decrypt(CastDecoderBuffer* buffer, | |
| 41 uint8_t* output, | 35 uint8_t* output, |
| 42 size_t data_offset) { | 36 size_t data_offset) { |
| 43 bool called = false; | 37 bool called = false; |
| 44 bool success = false; | 38 bool success = false; |
| 45 DecryptAsync(buffer, output, data_offset, | 39 DecryptAsync(buffer, output, data_offset, |
| 46 base::Bind(&BufferDecryptCB, &called, &success)); | 40 base::Bind(&BufferDecryptCB, &called, &success)); |
| 47 CHECK(called) << "Sync Decrypt isn't supported"; | 41 CHECK(called) << "Sync Decrypt isn't supported"; |
| 48 | 42 |
| 49 return success; | 43 return success; |
| 50 } | 44 } |
| 51 | 45 |
| 52 void DecryptContextImpl::DecryptAsync(CastDecoderBuffer* buffer, | 46 void DecryptContextImpl::DecryptAsync(CastDecoderBuffer* buffer, |
| 53 uint8_t* output, | 47 uint8_t* output, |
| 54 size_t data_offset, | 48 size_t data_offset, |
| 55 const DecryptCB& decrypt_cb) { | 49 const DecryptCB& decrypt_cb) { |
| 56 decrypt_cb.Run(false); | 50 decrypt_cb.Run(false); |
| 57 } | 51 } |
| 58 | 52 |
| 59 bool DecryptContextImpl::CanDecryptToBuffer() const { | 53 bool DecryptContextImpl::CanDecryptToBuffer() const { |
| 60 return false; | 54 return false; |
| 61 } | 55 } |
| 62 | 56 |
| 63 } // namespace media | 57 } // namespace media |
| 64 } // namespace chromecast | 58 } // namespace chromecast |
| OLD | NEW |