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

Side by Side Diff: webkit/media/crypto/ppapi/content_decryption_module.h

Issue 10914028: Add CDM allocator interface. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: It works, and this removes a copy in Decrypt/DeliverBlock. Created 8 years, 3 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ 5 #ifndef WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_
6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ 6 #define WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_
7 7
8 #if defined(_MSC_VER) 8 #if defined(_MSC_VER)
9 typedef unsigned char uint8_t; 9 typedef unsigned char uint8_t;
10 typedef unsigned int uint32_t; 10 typedef unsigned int uint32_t;
11 typedef __int64 int64_t; 11 typedef __int64 int64_t;
12 #else 12 #else
13 #include <stdint.h> 13 #include <stdint.h>
14 #endif 14 #endif
15 15
16 #include "webkit/media/crypto/ppapi/cdm_export.h" 16 #include "webkit/media/crypto/ppapi/cdm_export.h"
17 17
18 namespace cdm { 18 namespace cdm {
19 class ContentDecryptionModule; 19 class ContentDecryptionModule;
20 } 20 }
21 21
22 namespace webkit_media {
23 class CdmAllocatorInterface;
24 }
25
22 extern "C" { 26 extern "C" {
23 CDM_EXPORT cdm::ContentDecryptionModule* CreateCdmInstance(); 27 CDM_EXPORT cdm::ContentDecryptionModule* CreateCdmInstance();
24 CDM_EXPORT void DestroyCdmInstance(cdm::ContentDecryptionModule* instance); 28 CDM_EXPORT void DestroyCdmInstance(cdm::ContentDecryptionModule* instance);
25 CDM_EXPORT const char* GetCdmVersion(); 29 CDM_EXPORT const char* GetCdmVersion();
26 } 30 }
27 31
28 namespace cdm { 32 namespace cdm {
29 33
30 enum Status { 34 enum Status {
31 kSuccess = 0, 35 kSuccess = 0,
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 const struct SubsampleEntry* subsamples; 118 const struct SubsampleEntry* subsamples;
115 uint32_t num_subsamples; // Number of subsamples in |subsamples|. 119 uint32_t num_subsamples; // Number of subsamples in |subsamples|.
116 120
117 int64_t timestamp; // Presentation timestamp in microseconds. 121 int64_t timestamp; // Presentation timestamp in microseconds.
118 }; 122 };
119 123
120 struct OutputBuffer { 124 struct OutputBuffer {
121 OutputBuffer() 125 OutputBuffer()
122 : data(NULL), 126 : data(NULL),
123 data_size(0), 127 data_size(0),
124 timestamp(0) {} 128 timestamp(0),
129 buffer_id(0) {}
125 130
126 const uint8_t* data; // Pointer to the beginning of the output data. 131 uint8_t* data; // Pointer to the beginning of the output data.
xhwang 2012/09/01 13:49:09 Does the "const" gave you any warning/error?
Tom Finegan 2012/09/01 21:32:49 Yes, at the memcpy call site.
127 uint32_t data_size; // Size (in bytes) of |data|. 132 uint32_t data_size; // Size (in bytes) of |data|.
128 133
129 int64_t timestamp; // Presentation timestamp in microseconds. 134 int64_t timestamp; // Presentation timestamp in microseconds.
135 int32_t buffer_id; // Buffer identifier. Issued by CdmAllocator, and used by
136 // the CDM wrapper.
130 }; 137 };
131 138
132 class ContentDecryptionModule { 139 class ContentDecryptionModule {
133 public: 140 public:
141 // Initialize the CDM by providing the allocator interface required for
xhwang 2012/09/01 13:49:09 Initialize+s+. Remove double space here and on the
Tom Finegan 2012/09/01 21:32:49 Done.
142 // access to shared memory that can be passed to the browser. Returns
143 // true upon successful initialization, and false when |allocator| is NULL.
xhwang 2012/09/01 13:49:09 Returns NULL when initialization fails, which incl
Tom Finegan 2012/09/01 21:32:49 Not following-- method returns bool.
144 virtual bool Initialize(webkit_media::CdmAllocatorInterface* allocator) = 0;
145
134 // Generates a |key_request| given the |init_data|. 146 // Generates a |key_request| given the |init_data|.
135 // Returns kSuccess if the key request was successfully generated, 147 // Returns kSuccess if the key request was successfully generated,
136 // in which case the callee should have allocated memory for the output 148 // in which case the callee should have allocated memory for the output
137 // parameters (e.g |session_id| in |key_request|) and passed the ownership 149 // parameters (e.g |session_id| in |key_request|) and passed the ownership
138 // to the caller. 150 // to the caller.
139 // Returns kErrorUnknown otherwise, in which case the output parameters should 151 // Returns kErrorUnknown otherwise, in which case the output parameters should
140 // not be used by the caller. 152 // not be used by the caller.
141 // 153 //
142 // TODO(xhwang): It's not safe to pass the ownership of the dynamically 154 // TODO(xhwang): It's not safe to pass the ownership of the dynamically
143 // allocated memory over library boundaries. Fix it after related PPAPI change 155 // allocated memory over library boundaries. Fix it after related PPAPI change
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 // and sample CDM are landed. 189 // and sample CDM are landed.
178 virtual Status Decrypt(const InputBuffer& encrypted_buffer, 190 virtual Status Decrypt(const InputBuffer& encrypted_buffer,
179 OutputBuffer* decrypted_buffer) = 0; 191 OutputBuffer* decrypted_buffer) = 0;
180 192
181 virtual ~ContentDecryptionModule() {} 193 virtual ~ContentDecryptionModule() {}
182 }; 194 };
183 195
184 } // namespace cdm 196 } // namespace cdm
185 197
186 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_ 198 #endif // WEBKIT_MEDIA_CRYPTO_PPAPI_CONTENT_DECRYPTION_MODULE_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698