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

Side by Side Diff: chromecast/media/base/decrypt_context_impl.h

Issue 2450563002: [Chromecast] Change DecryptContext Decrypt API (Closed)
Patch Set: Created 4 years, 1 month 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/base/decrypt_context_impl.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_BASE_DECRYPT_CONTEXT_IMPL_H_ 5 #ifndef CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_IMPL_H_
6 #define CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_IMPL_H_ 6 #define CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_IMPL_H_
7 7
8 #include <stddef.h> 8 #include <stddef.h>
9 #include <stdint.h> 9 #include <stdint.h>
10 10
(...skipping 13 matching lines...) Expand all
24 class DecryptContextImpl : public DecryptContext { 24 class DecryptContextImpl : public DecryptContext {
25 public: 25 public:
26 using DecryptCB = base::Callback<void(bool)>; 26 using DecryptCB = base::Callback<void(bool)>;
27 27
28 explicit DecryptContextImpl(CastKeySystem key_system); 28 explicit DecryptContextImpl(CastKeySystem key_system);
29 ~DecryptContextImpl() override; 29 ~DecryptContextImpl() override;
30 30
31 // DecryptContext implementation: 31 // DecryptContext implementation:
32 CastKeySystem GetKeySystem() override; 32 CastKeySystem GetKeySystem() override;
33 bool Decrypt(CastDecoderBuffer* buffer, 33 bool Decrypt(CastDecoderBuffer* buffer,
34 std::vector<uint8_t>* output) final; 34 uint8_t* output,
35 35 size_t data_offset) override;
36 // TODO(smcgruer): Replace DecryptContext::Decrypt with this one in next
37 // public api releasing.
38 // Decrypts the given buffer. Returns true/false for success/failure.
39 //
40 // The decrypted data will be of size |buffer.data_size()| and there must be
41 // enough space in |output| to store that data.
42 //
43 // If non-zero, |data_offset| specifies an offset to be applied to |output|
44 // before the decrypted data is written.
45 virtual bool Decrypt(CastDecoderBuffer* buffer,
46 uint8_t* output,
47 size_t data_offset);
48 36
49 // Similar as the above one. Decryption success or not will be returned in 37 // Similar as the above one. Decryption success or not will be returned in
50 // |decrypt_cb|. |decrypt_cb| will be called on caller's thread. 38 // |decrypt_cb|. |decrypt_cb| will be called on caller's thread.
51 virtual void DecryptAsync(CastDecoderBuffer* buffer, 39 virtual void DecryptAsync(CastDecoderBuffer* buffer,
52 uint8_t* output, 40 uint8_t* output,
53 size_t data_offset, 41 size_t data_offset,
54 const DecryptCB& decrypt_cb); 42 const DecryptCB& decrypt_cb);
55 43
56 // Returns whether the data can be decrypted into user memory. 44 // Returns whether the data can be decrypted into user memory.
57 // If the key system doesn't support secure output or the app explicitly 45 // If the key system doesn't support secure output or the app explicitly
58 // requires non secure output, it should return true; 46 // requires non secure output, it should return true;
59 // If the key system doesn't allow clear content to be decrypted into user 47 // If the key system doesn't allow clear content to be decrypted into user
60 // memory, it should return false. 48 // memory, it should return false.
61 virtual bool CanDecryptToBuffer() const; 49 virtual bool CanDecryptToBuffer() const;
62 50
63 private: 51 private:
64 CastKeySystem key_system_; 52 CastKeySystem key_system_;
65 53
66 // TODO(smcgruer): Restore macro usage next public API release. 54 // TODO(smcgruer): Restore macro usage next public API release.
67 // DISALLOW_COPY_AND_ASSIGN(DecryptContextImpl); 55 // DISALLOW_COPY_AND_ASSIGN(DecryptContextImpl);
68 DecryptContextImpl(const DecryptContextImpl&) = delete; 56 DecryptContextImpl(const DecryptContextImpl&) = delete;
69 void operator=(const DecryptContextImpl&) = delete; 57 void operator=(const DecryptContextImpl&) = delete;
70 }; 58 };
71 59
72 } // namespace media 60 } // namespace media
73 } // namespace chromecast 61 } // namespace chromecast
74 62
75 #endif // CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_IMPL_H_ 63 #endif // CHROMECAST_MEDIA_BASE_DECRYPT_CONTEXT_IMPL_H_
OLDNEW
« no previous file with comments | « no previous file | chromecast/media/base/decrypt_context_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698