OLD | NEW |
---|---|
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 CDM_CONTENT_DECRYPTION_MODULE_H_ | 5 #ifndef CDM_CONTENT_DECRYPTION_MODULE_H_ |
6 #define CDM_CONTENT_DECRYPTION_MODULE_H_ | 6 #define CDM_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; |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
52 | 52 |
53 // Returns a pointer to the requested CDM upon success. | 53 // Returns a pointer to the requested CDM upon success. |
54 // Returns NULL if an error occurs or the requested |cdm_interface_version| or | 54 // Returns NULL if an error occurs or the requested |cdm_interface_version| or |
55 // |key_system| is not supported or another error occurs. | 55 // |key_system| is not supported or another error occurs. |
56 // The caller should cast the returned pointer to the type matching | 56 // The caller should cast the returned pointer to the type matching |
57 // |cdm_interface_version|. | 57 // |cdm_interface_version|. |
58 // Caller retains ownership of arguments and must call Destroy() on the returned | 58 // Caller retains ownership of arguments and must call Destroy() on the returned |
59 // object. | 59 // object. |
60 CDM_EXPORT void* CreateCdmInstance( | 60 CDM_EXPORT void* CreateCdmInstance( |
61 int cdm_interface_version, | 61 int cdm_interface_version, |
62 const char* key_system, int key_system_size, | 62 const char* key_system, uint32_t key_system_size, |
63 GetCdmHostFunc get_cdm_host_func, void* user_data); | 63 GetCdmHostFunc get_cdm_host_func, void* user_data); |
64 | 64 |
65 CDM_EXPORT const char* GetCdmVersion(); | 65 CDM_EXPORT const char* GetCdmVersion(); |
66 } | 66 } |
67 | 67 |
68 namespace cdm { | 68 namespace cdm { |
69 | 69 |
70 class AudioFrames_1; | 70 class AudioFrames_1; |
71 class AudioFrames_2; | 71 class AudioFrames_2; |
72 typedef AudioFrames_2 AudioFrames; | 72 typedef AudioFrames_2 AudioFrames; |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
110 // | 110 // |
111 // After decryption, the decrypted bytes should be copied over the position | 111 // After decryption, the decrypted bytes should be copied over the position |
112 // of the corresponding cipher bytes in the original buffer to form the output | 112 // of the corresponding cipher bytes in the original buffer to form the output |
113 // buffer. Following the above example, the decrypted buffer should be: | 113 // buffer. Following the above example, the decrypted buffer should be: |
114 // | 114 // |
115 // |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| | 115 // |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| |
116 // | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 | | 116 // | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 | |
117 // | 117 // |
118 // TODO(xhwang): Add checks to make sure these structs have fixed layout. | 118 // TODO(xhwang): Add checks to make sure these structs have fixed layout. |
119 struct SubsampleEntry { | 119 struct SubsampleEntry { |
120 SubsampleEntry(int32_t clear_bytes, int32_t cipher_bytes) | 120 SubsampleEntry(uint32_t clear_bytes, uint32_t cipher_bytes) |
121 : clear_bytes(clear_bytes), cipher_bytes(cipher_bytes) {} | 121 : clear_bytes(clear_bytes), cipher_bytes(cipher_bytes) {} |
122 | 122 |
123 int32_t clear_bytes; | 123 uint32_t clear_bytes; |
124 int32_t cipher_bytes; | 124 uint32_t cipher_bytes; |
125 }; | 125 }; |
126 | 126 |
127 // Represents an input buffer to be decrypted (and possibly decoded). It does | 127 // Represents an input buffer to be decrypted (and possibly decoded). It does |
128 // own any pointers in this struct. | 128 // own any pointers in this struct. |
129 struct InputBuffer { | 129 struct InputBuffer { |
130 InputBuffer() | 130 InputBuffer() |
131 : data(NULL), | 131 : data(NULL), |
132 data_size(0), | 132 data_size(0), |
133 data_offset(0), | 133 data_offset(0), |
134 key_id(NULL), | 134 key_id(NULL), |
135 key_id_size(0), | 135 key_id_size(0), |
136 iv(NULL), | 136 iv(NULL), |
137 iv_size(0), | 137 iv_size(0), |
138 subsamples(NULL), | 138 subsamples(NULL), |
139 num_subsamples(0), | 139 num_subsamples(0), |
140 timestamp(0) {} | 140 timestamp(0) {} |
141 | 141 |
142 const uint8_t* data; // Pointer to the beginning of the input data. | 142 const uint8_t* data; // Pointer to the beginning of the input data. |
143 int32_t data_size; // Size (in bytes) of |data|. | 143 uint32_t data_size; // Size (in bytes) of |data|. |
144 | 144 |
145 int32_t data_offset; // Number of bytes to be discarded before decryption. | 145 uint32_t data_offset; // Number of bytes to be discarded before decryption. |
146 | 146 |
147 const uint8_t* key_id; // Key ID to identify the decryption key. | 147 const uint8_t* key_id; // Key ID to identify the decryption key. |
148 int32_t key_id_size; // Size (in bytes) of |key_id|. | 148 uint32_t key_id_size; // Size (in bytes) of |key_id|. |
149 | 149 |
150 const uint8_t* iv; // Initialization vector. | 150 const uint8_t* iv; // Initialization vector. |
151 int32_t iv_size; // Size (in bytes) of |iv|. | 151 uint32_t iv_size; // Size (in bytes) of |iv|. |
152 | 152 |
153 const struct SubsampleEntry* subsamples; | 153 const struct SubsampleEntry* subsamples; |
154 int32_t num_subsamples; // Number of subsamples in |subsamples|. | 154 uint32_t num_subsamples; // Number of subsamples in |subsamples|. |
155 | 155 |
156 int64_t timestamp; // Presentation timestamp in microseconds. | 156 int64_t timestamp; // Presentation timestamp in microseconds. |
157 }; | 157 }; |
158 | 158 |
159 struct AudioDecoderConfig { | 159 struct AudioDecoderConfig { |
160 enum AudioCodec { | 160 enum AudioCodec { |
161 kUnknownAudioCodec = 0, | 161 kUnknownAudioCodec = 0, |
162 kCodecVorbis, | 162 kCodecVorbis, |
163 kCodecAac | 163 kCodecAac |
164 }; | 164 }; |
165 | 165 |
166 AudioDecoderConfig() | 166 AudioDecoderConfig() |
167 : codec(kUnknownAudioCodec), | 167 : codec(kUnknownAudioCodec), |
168 channel_count(0), | 168 channel_count(0), |
169 bits_per_channel(0), | 169 bits_per_channel(0), |
170 samples_per_second(0), | 170 samples_per_second(0), |
171 extra_data(NULL), | 171 extra_data(NULL), |
172 extra_data_size(0) {} | 172 extra_data_size(0) {} |
173 | 173 |
174 AudioCodec codec; | 174 AudioCodec codec; |
175 int32_t channel_count; | 175 int32_t channel_count; |
176 int32_t bits_per_channel; | 176 int32_t bits_per_channel; |
177 int32_t samples_per_second; | 177 int32_t samples_per_second; |
xhwang
2013/10/21 23:30:11
hmm, are these also "counts"?
DaleCurtis
2013/10/21 23:40:55
The line is "Use unsigned integer types (preferabl
xhwang
2013/10/21 23:51:12
agreed :)
| |
178 | 178 |
179 // Optional byte data required to initialize audio decoders, such as the | 179 // Optional byte data required to initialize audio decoders, such as the |
180 // vorbis setup header. | 180 // vorbis setup header. |
181 uint8_t* extra_data; | 181 uint8_t* extra_data; |
182 int32_t extra_data_size; | 182 uint32_t extra_data_size; |
183 }; | 183 }; |
184 | 184 |
185 // Supported sample formats for AudioFrames. | 185 // Supported sample formats for AudioFrames. |
186 enum AudioFormat { | 186 enum AudioFormat { |
187 kUnknownAudioFormat = 0, // Unknown format value. Used for error reporting. | 187 kUnknownAudioFormat = 0, // Unknown format value. Used for error reporting. |
188 kAudioFormatU8, // Interleaved unsigned 8-bit w/ bias of 128. | 188 kAudioFormatU8, // Interleaved unsigned 8-bit w/ bias of 128. |
189 kAudioFormatS16, // Interleaved signed 16-bit. | 189 kAudioFormatS16, // Interleaved signed 16-bit. |
190 kAudioFormatS32, // Interleaved signed 32-bit. | 190 kAudioFormatS32, // Interleaved signed 32-bit. |
191 kAudioFormatF32, // Interleaved float 32-bit. | 191 kAudioFormatF32, // Interleaved float 32-bit. |
192 kAudioFormatPlanarS16, // Signed 16-bit planar. | 192 kAudioFormatPlanarS16, // Signed 16-bit planar. |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
238 VideoCodecProfile profile; | 238 VideoCodecProfile profile; |
239 VideoFormat format; | 239 VideoFormat format; |
240 | 240 |
241 // Width and height of video frame immediately post-decode. Not all pixels | 241 // Width and height of video frame immediately post-decode. Not all pixels |
242 // in this region are valid. | 242 // in this region are valid. |
243 Size coded_size; | 243 Size coded_size; |
244 | 244 |
245 // Optional byte data required to initialize video decoders, such as H.264 | 245 // Optional byte data required to initialize video decoders, such as H.264 |
246 // AAVC data. | 246 // AAVC data. |
247 uint8_t* extra_data; | 247 uint8_t* extra_data; |
248 int32_t extra_data_size; | 248 uint32_t extra_data_size; |
249 }; | 249 }; |
250 | 250 |
251 enum StreamType { | 251 enum StreamType { |
252 kStreamTypeAudio = 0, | 252 kStreamTypeAudio = 0, |
253 kStreamTypeVideo = 1 | 253 kStreamTypeVideo = 1 |
254 }; | 254 }; |
255 | 255 |
256 // Structure provided to ContentDecryptionModule::OnPlatformChallengeResponse() | 256 // Structure provided to ContentDecryptionModule::OnPlatformChallengeResponse() |
257 // after a platform challenge was initiated via Host::SendPlatformChallenge(). | 257 // after a platform challenge was initiated via Host::SendPlatformChallenge(). |
258 // All values will be NULL / zero in the event of a challenge failure. | 258 // All values will be NULL / zero in the event of a challenge failure. |
259 struct PlatformChallengeResponse { | 259 struct PlatformChallengeResponse { |
260 // |challenge| provided during Host::SendPlatformChallenge() combined with | 260 // |challenge| provided during Host::SendPlatformChallenge() combined with |
261 // nonce data and signed with the platform's private key. | 261 // nonce data and signed with the platform's private key. |
262 const uint8_t* signed_data; | 262 const uint8_t* signed_data; |
263 int32_t signed_data_length; | 263 uint32_t signed_data_length; |
264 | 264 |
265 // RSASSA-PKCS1-v1_5-SHA256 signature of the |signed_data| block. | 265 // RSASSA-PKCS1-v1_5-SHA256 signature of the |signed_data| block. |
266 const uint8_t* signed_data_signature; | 266 const uint8_t* signed_data_signature; |
267 int32_t signed_data_signature_length; | 267 uint32_t signed_data_signature_length; |
268 | 268 |
269 // X.509 device specific certificate for the |service_id| requested. | 269 // X.509 device specific certificate for the |service_id| requested. |
270 const uint8_t* platform_key_certificate; | 270 const uint8_t* platform_key_certificate; |
271 int32_t platform_key_certificate_length; | 271 uint32_t platform_key_certificate_length; |
xhwang
2013/10/21 23:30:11
nit: we use "size" for data size in this file. Thi
DaleCurtis
2013/10/21 23:40:55
Well, kind of, this is consistent with the names u
xhwang
2013/10/21 23:51:12
sgtm, I just found that we also use "length" in Se
| |
272 }; | 272 }; |
273 | 273 |
274 // Supported output protection methods for use with EnableOutputProtection() and | 274 // Supported output protection methods for use with EnableOutputProtection() and |
275 // returned by OnQueryOutputProtectionStatus(). | 275 // returned by OnQueryOutputProtectionStatus(). |
276 enum OutputProtectionMethods { | 276 enum OutputProtectionMethods { |
277 kProtectionNone = 0, | 277 kProtectionNone = 0, |
278 kProtectionHDCP = 1 << 0 | 278 kProtectionHDCP = 1 << 0 |
279 }; | 279 }; |
280 | 280 |
281 // Connected output link types returned by OnQueryOutputProtectionStatus(). | 281 // Connected output link types returned by OnQueryOutputProtectionStatus(). |
(...skipping 19 matching lines...) Expand all Loading... | |
301 // when a Buffer is created that will never be returned to the caller. | 301 // when a Buffer is created that will never be returned to the caller. |
302 class ContentDecryptionModule_1 { | 302 class ContentDecryptionModule_1 { |
303 public: | 303 public: |
304 // Generates a |key_request| given |type| and |init_data|. | 304 // Generates a |key_request| given |type| and |init_data|. |
305 // | 305 // |
306 // Returns kSuccess if the key request was successfully generated, in which | 306 // Returns kSuccess if the key request was successfully generated, in which |
307 // case the CDM must send the key message by calling Host::SendKeyMessage(). | 307 // case the CDM must send the key message by calling Host::SendKeyMessage(). |
308 // Returns kSessionError if any error happened, in which case the CDM must | 308 // Returns kSessionError if any error happened, in which case the CDM must |
309 // send a key error by calling Host::SendKeyError(). | 309 // send a key error by calling Host::SendKeyError(). |
310 virtual Status GenerateKeyRequest( | 310 virtual Status GenerateKeyRequest( |
311 const char* type, int type_size, | 311 const char* type, uint32_t type_size, |
312 const uint8_t* init_data, int init_data_size) = 0; | 312 const uint8_t* init_data, uint32_t init_data_size) = 0; |
313 | 313 |
314 // Adds the |key| to the CDM to be associated with |key_id|. | 314 // Adds the |key| to the CDM to be associated with |key_id|. |
315 // | 315 // |
316 // Returns kSuccess if the key was successfully added, kSessionError | 316 // Returns kSuccess if the key was successfully added, kSessionError |
317 // otherwise. | 317 // otherwise. |
318 virtual Status AddKey(const char* session_id, int session_id_size, | 318 virtual Status AddKey(const char* session_id, uint32_t session_id_size, |
319 const uint8_t* key, int key_size, | 319 const uint8_t* key, uint32_t key_size, |
320 const uint8_t* key_id, int key_id_size) = 0; | 320 const uint8_t* key_id, uint32_t key_id_size) = 0; |
321 | 321 |
322 // Cancels any pending key request made to the CDM for |session_id|. | 322 // Cancels any pending key request made to the CDM for |session_id|. |
323 // | 323 // |
324 // Returns kSuccess if all pending key requests for |session_id| were | 324 // Returns kSuccess if all pending key requests for |session_id| were |
325 // successfully canceled or there was no key request to be canceled, | 325 // successfully canceled or there was no key request to be canceled, |
326 // kSessionError otherwise. | 326 // kSessionError otherwise. |
327 virtual Status CancelKeyRequest( | 327 virtual Status CancelKeyRequest( |
328 const char* session_id, int session_id_size) = 0; | 328 const char* session_id, uint32_t session_id_size) = 0; |
329 | 329 |
330 // Performs scheduled operation with |context| when the timer fires. | 330 // Performs scheduled operation with |context| when the timer fires. |
331 virtual void TimerExpired(void* context) = 0; | 331 virtual void TimerExpired(void* context) = 0; |
332 | 332 |
333 // Decrypts the |encrypted_buffer|. | 333 // Decrypts the |encrypted_buffer|. |
334 // | 334 // |
335 // Returns kSuccess if decryption succeeded, in which case the callee | 335 // Returns kSuccess if decryption succeeded, in which case the callee |
336 // should have filled the |decrypted_buffer| and passed the ownership of | 336 // should have filled the |decrypted_buffer| and passed the ownership of |
337 // |data| in |decrypted_buffer| to the caller. | 337 // |data| in |decrypted_buffer| to the caller. |
338 // Returns kNoKey if the CDM did not have the necessary decryption key | 338 // Returns kNoKey if the CDM did not have the necessary decryption key |
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
427 // when a Buffer is created that will never be returned to the caller. | 427 // when a Buffer is created that will never be returned to the caller. |
428 class ContentDecryptionModule_2 { | 428 class ContentDecryptionModule_2 { |
429 public: | 429 public: |
430 // Generates a |key_request| given |type| and |init_data|. | 430 // Generates a |key_request| given |type| and |init_data|. |
431 // | 431 // |
432 // Returns kSuccess if the key request was successfully generated, in which | 432 // Returns kSuccess if the key request was successfully generated, in which |
433 // case the CDM must send the key message by calling Host::SendKeyMessage(). | 433 // case the CDM must send the key message by calling Host::SendKeyMessage(). |
434 // Returns kSessionError if any error happened, in which case the CDM must | 434 // Returns kSessionError if any error happened, in which case the CDM must |
435 // send a key error by calling Host::SendKeyError(). | 435 // send a key error by calling Host::SendKeyError(). |
436 virtual Status GenerateKeyRequest( | 436 virtual Status GenerateKeyRequest( |
437 const char* type, int type_size, | 437 const char* type, uint32_t type_size, |
438 const uint8_t* init_data, int init_data_size) = 0; | 438 const uint8_t* init_data, uint32_t init_data_size) = 0; |
439 | 439 |
440 // Adds the |key| to the CDM to be associated with |key_id|. | 440 // Adds the |key| to the CDM to be associated with |key_id|. |
441 // | 441 // |
442 // Returns kSuccess if the key was successfully added, kSessionError | 442 // Returns kSuccess if the key was successfully added, kSessionError |
443 // otherwise. | 443 // otherwise. |
444 virtual Status AddKey(const char* session_id, int session_id_size, | 444 virtual Status AddKey(const char* session_id, uint32_t session_id_size, |
445 const uint8_t* key, int key_size, | 445 const uint8_t* key, uint32_t key_size, |
446 const uint8_t* key_id, int key_id_size) = 0; | 446 const uint8_t* key_id, uint32_t key_id_size) = 0; |
447 | 447 |
448 // Cancels any pending key request made to the CDM for |session_id|. | 448 // Cancels any pending key request made to the CDM for |session_id|. |
449 // | 449 // |
450 // Returns kSuccess if all pending key requests for |session_id| were | 450 // Returns kSuccess if all pending key requests for |session_id| were |
451 // successfully canceled or there was no key request to be canceled, | 451 // successfully canceled or there was no key request to be canceled, |
452 // kSessionError otherwise. | 452 // kSessionError otherwise. |
453 virtual Status CancelKeyRequest( | 453 virtual Status CancelKeyRequest( |
454 const char* session_id, int session_id_size) = 0; | 454 const char* session_id, uint32_t session_id_size) = 0; |
455 | 455 |
456 // Performs scheduled operation with |context| when the timer fires. | 456 // Performs scheduled operation with |context| when the timer fires. |
457 virtual void TimerExpired(void* context) = 0; | 457 virtual void TimerExpired(void* context) = 0; |
458 | 458 |
459 // Decrypts the |encrypted_buffer|. | 459 // Decrypts the |encrypted_buffer|. |
460 // | 460 // |
461 // Returns kSuccess if decryption succeeded, in which case the callee | 461 // Returns kSuccess if decryption succeeded, in which case the callee |
462 // should have filled the |decrypted_buffer| and passed the ownership of | 462 // should have filled the |decrypted_buffer| and passed the ownership of |
463 // |data| in |decrypted_buffer| to the caller. | 463 // |data| in |decrypted_buffer| to the caller. |
464 // Returns kNoKey if the CDM did not have the necessary decryption key | 464 // Returns kNoKey if the CDM did not have the necessary decryption key |
(...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
567 | 567 |
568 typedef ContentDecryptionModule_2 ContentDecryptionModule; | 568 typedef ContentDecryptionModule_2 ContentDecryptionModule; |
569 const int kCdmInterfaceVersion = kCdmInterfaceVersion_2; | 569 const int kCdmInterfaceVersion = kCdmInterfaceVersion_2; |
570 | 570 |
571 // Represents a buffer created by Allocator implementations. | 571 // Represents a buffer created by Allocator implementations. |
572 class Buffer { | 572 class Buffer { |
573 public: | 573 public: |
574 // Destroys the buffer in the same context as it was created. | 574 // Destroys the buffer in the same context as it was created. |
575 virtual void Destroy() = 0; | 575 virtual void Destroy() = 0; |
576 | 576 |
577 virtual int32_t Capacity() const = 0; | 577 virtual uint32_t Capacity() const = 0; |
578 virtual uint8_t* Data() = 0; | 578 virtual uint8_t* Data() = 0; |
579 virtual void SetSize(int32_t size) = 0; | 579 virtual void SetSize(uint32_t size) = 0; |
580 virtual int32_t Size() const = 0; | 580 virtual uint32_t Size() const = 0; |
581 | 581 |
582 protected: | 582 protected: |
583 Buffer() {} | 583 Buffer() {} |
584 virtual ~Buffer() {} | 584 virtual ~Buffer() {} |
585 | 585 |
586 private: | 586 private: |
587 Buffer(const Buffer&); | 587 Buffer(const Buffer&); |
588 void operator=(const Buffer&); | 588 void operator=(const Buffer&); |
589 }; | 589 }; |
590 | 590 |
591 // Host interface that the CDM can call into to access browser side services. | 591 // Host interface that the CDM can call into to access browser side services. |
592 // Host interfaces are versioned for backward compatibility. CDM should use | 592 // Host interfaces are versioned for backward compatibility. CDM should use |
593 // HostFactory object to request a Host interface of a particular version. | 593 // HostFactory object to request a Host interface of a particular version. |
594 class Host_1 { | 594 class Host_1 { |
595 public: | 595 public: |
596 // Returns a Buffer* containing non-zero members upon success, or NULL on | 596 // Returns a Buffer* containing non-zero members upon success, or NULL on |
597 // failure. The caller owns the Buffer* after this call. The buffer is not | 597 // failure. The caller owns the Buffer* after this call. The buffer is not |
598 // guaranteed to be zero initialized. The capacity of the allocated Buffer | 598 // guaranteed to be zero initialized. The capacity of the allocated Buffer |
599 // is guaranteed to be not less than |capacity|. | 599 // is guaranteed to be not less than |capacity|. |
600 virtual Buffer* Allocate(int32_t capacity) = 0; | 600 virtual Buffer* Allocate(uint32_t capacity) = 0; |
601 | 601 |
602 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| | 602 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| |
603 // from now with |context|. | 603 // from now with |context|. |
604 virtual void SetTimer(int64_t delay_ms, void* context) = 0; | 604 virtual void SetTimer(int64_t delay_ms, void* context) = 0; |
605 | 605 |
606 // Returns the current epoch wall time in seconds. | 606 // Returns the current epoch wall time in seconds. |
607 virtual double GetCurrentWallTimeInSeconds() = 0; | 607 virtual double GetCurrentWallTimeInSeconds() = 0; |
608 | 608 |
609 // Sends a keymessage event to the application. | 609 // Sends a keymessage event to the application. |
610 // Length parameters should not include null termination. | 610 // Length parameters should not include null termination. |
611 virtual void SendKeyMessage( | 611 virtual void SendKeyMessage( |
612 const char* session_id, int32_t session_id_length, | 612 const char* session_id, uint32_t session_id_length, |
613 const char* message, int32_t message_length, | 613 const char* message, uint32_t message_length, |
614 const char* default_url, int32_t default_url_length) = 0; | 614 const char* default_url, uint32_t default_url_length) = 0; |
615 | 615 |
616 // Sends a keyerror event to the application. | 616 // Sends a keyerror event to the application. |
617 // |session_id_length| should not include null termination. | 617 // |session_id_length| should not include null termination. |
618 virtual void SendKeyError(const char* session_id, | 618 virtual void SendKeyError(const char* session_id, |
619 int32_t session_id_length, | 619 uint32_t session_id_length, |
620 MediaKeyError error_code, | 620 MediaKeyError error_code, |
621 uint32_t system_code) = 0; | 621 uint32_t system_code) = 0; |
622 | 622 |
623 // Get private data from the host. This function is limited to internal use. | 623 // Get private data from the host. This function is limited to internal use. |
624 typedef const void* (*GetPrivateInterface)(const char* interface_name); | 624 typedef const void* (*GetPrivateInterface)(const char* interface_name); |
625 virtual void GetPrivateData(int32_t* instance, | 625 virtual void GetPrivateData(int32_t* instance, |
626 GetPrivateInterface* get_interface) = 0; | 626 GetPrivateInterface* get_interface) = 0; |
627 | 627 |
628 protected: | 628 protected: |
629 Host_1() {} | 629 Host_1() {} |
630 virtual ~Host_1() {} | 630 virtual ~Host_1() {} |
631 }; | 631 }; |
632 | 632 |
633 class Host_2 { | 633 class Host_2 { |
634 public: | 634 public: |
635 // Returns a Buffer* containing non-zero members upon success, or NULL on | 635 // Returns a Buffer* containing non-zero members upon success, or NULL on |
636 // failure. The caller owns the Buffer* after this call. The buffer is not | 636 // failure. The caller owns the Buffer* after this call. The buffer is not |
637 // guaranteed to be zero initialized. The capacity of the allocated Buffer | 637 // guaranteed to be zero initialized. The capacity of the allocated Buffer |
638 // is guaranteed to be not less than |capacity|. | 638 // is guaranteed to be not less than |capacity|. |
639 virtual Buffer* Allocate(int32_t capacity) = 0; | 639 virtual Buffer* Allocate(uint32_t capacity) = 0; |
640 | 640 |
641 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| | 641 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| |
642 // from now with |context|. | 642 // from now with |context|. |
643 virtual void SetTimer(int64_t delay_ms, void* context) = 0; | 643 virtual void SetTimer(int64_t delay_ms, void* context) = 0; |
644 | 644 |
645 // Returns the current epoch wall time in seconds. | 645 // Returns the current epoch wall time in seconds. |
646 virtual double GetCurrentWallTimeInSeconds() = 0; | 646 virtual double GetCurrentWallTimeInSeconds() = 0; |
647 | 647 |
648 // Sends a keymessage event to the application. | 648 // Sends a keymessage event to the application. |
649 // Length parameters should not include null termination. | 649 // Length parameters should not include null termination. |
650 virtual void SendKeyMessage( | 650 virtual void SendKeyMessage( |
651 const char* session_id, int32_t session_id_length, | 651 const char* session_id, uint32_t session_id_length, |
652 const char* message, int32_t message_length, | 652 const char* message, uint32_t message_length, |
653 const char* default_url, int32_t default_url_length) = 0; | 653 const char* default_url, uint32_t default_url_length) = 0; |
654 | 654 |
655 // Sends a keyerror event to the application. | 655 // Sends a keyerror event to the application. |
656 // |session_id_length| should not include null termination. | 656 // |session_id_length| should not include null termination. |
657 virtual void SendKeyError(const char* session_id, | 657 virtual void SendKeyError(const char* session_id, |
658 int32_t session_id_length, | 658 uint32_t session_id_length, |
659 MediaKeyError error_code, | 659 MediaKeyError error_code, |
660 uint32_t system_code) = 0; | 660 uint32_t system_code) = 0; |
661 | 661 |
662 // Check if the underlying host platform can be challenged; i.e., verified as | 662 // Check if the underlying host platform can be challenged; i.e., verified as |
663 // a trusted platform. Returns false if the platform has no support or will | 663 // a trusted platform. Returns false if the platform has no support or will |
664 // always fail challenge requests (known untrusted). | 664 // always fail challenge requests (known untrusted). |
665 virtual bool CanChallengePlatform() = 0; | 665 virtual bool CanChallengePlatform() = 0; |
666 | 666 |
667 // Sends a platform challenge for the given |service_id|. |challenge| is at | 667 // Sends a platform challenge for the given |service_id|. |challenge| is at |
668 // most 256 bits of data to be signed. Once the challenge has been completed, | 668 // most 256 bits of data to be signed. Once the challenge has been completed, |
669 // the host will call ContentDecryptionModule::OnPlatformChallengeResponse() | 669 // the host will call ContentDecryptionModule::OnPlatformChallengeResponse() |
670 // with the signed challenge response and platform certificate. Length | 670 // with the signed challenge response and platform certificate. Length |
671 // parameters should not include null termination. | 671 // parameters should not include null termination. |
672 virtual void SendPlatformChallenge( | 672 virtual void SendPlatformChallenge( |
673 const char* service_id, int32_t service_id_length, | 673 const char* service_id, uint32_t service_id_length, |
674 const char* challenge, int32_t challenge_length) = 0; | 674 const char* challenge, uint32_t challenge_length) = 0; |
675 | 675 |
676 // Attempts to enable output protection (e.g. HDCP) on the display link. The | 676 // Attempts to enable output protection (e.g. HDCP) on the display link. The |
677 // |desired_protection_mask| is a bit mask of OutputProtectionMethods. No | 677 // |desired_protection_mask| is a bit mask of OutputProtectionMethods. No |
678 // status callback is issued, the CDM must call QueryOutputProtectionStatus() | 678 // status callback is issued, the CDM must call QueryOutputProtectionStatus() |
679 // periodically to ensure the desired protections are applied. | 679 // periodically to ensure the desired protections are applied. |
680 virtual void EnableOutputProtection(uint32_t desired_protection_mask) = 0; | 680 virtual void EnableOutputProtection(uint32_t desired_protection_mask) = 0; |
681 | 681 |
682 // Requests the current output protection status. Once the host has the status | 682 // Requests the current output protection status. Once the host has the status |
683 // it will call ContentDecryptionModule::OnQueryOutputProtectionStatus(). | 683 // it will call ContentDecryptionModule::OnQueryOutputProtectionStatus(). |
684 virtual void QueryOutputProtectionStatus() = 0; | 684 virtual void QueryOutputProtectionStatus() = 0; |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
721 | 721 |
722 virtual void SetFormat(VideoFormat format) = 0; | 722 virtual void SetFormat(VideoFormat format) = 0; |
723 virtual VideoFormat Format() const = 0; | 723 virtual VideoFormat Format() const = 0; |
724 | 724 |
725 virtual void SetSize(cdm::Size size) = 0; | 725 virtual void SetSize(cdm::Size size) = 0; |
726 virtual cdm::Size Size() const = 0; | 726 virtual cdm::Size Size() const = 0; |
727 | 727 |
728 virtual void SetFrameBuffer(Buffer* frame_buffer) = 0; | 728 virtual void SetFrameBuffer(Buffer* frame_buffer) = 0; |
729 virtual Buffer* FrameBuffer() = 0; | 729 virtual Buffer* FrameBuffer() = 0; |
730 | 730 |
731 virtual void SetPlaneOffset(VideoPlane plane, int32_t offset) = 0; | 731 virtual void SetPlaneOffset(VideoPlane plane, uint32_t offset) = 0; |
732 virtual int32_t PlaneOffset(VideoPlane plane) = 0; | 732 virtual uint32_t PlaneOffset(VideoPlane plane) = 0; |
733 | 733 |
734 virtual void SetStride(VideoPlane plane, int32_t stride) = 0; | 734 virtual void SetStride(VideoPlane plane, uint32_t stride) = 0; |
735 virtual int32_t Stride(VideoPlane plane) = 0; | 735 virtual uint32_t Stride(VideoPlane plane) = 0; |
736 | 736 |
737 virtual void SetTimestamp(int64_t timestamp) = 0; | 737 virtual void SetTimestamp(int64_t timestamp) = 0; |
738 virtual int64_t Timestamp() const = 0; | 738 virtual int64_t Timestamp() const = 0; |
739 | 739 |
740 protected: | 740 protected: |
741 VideoFrame() {} | 741 VideoFrame() {} |
742 virtual ~VideoFrame() {} | 742 virtual ~VideoFrame() {} |
743 }; | 743 }; |
744 | 744 |
745 // | 745 // |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
780 virtual AudioFormat Format() const = 0; | 780 virtual AudioFormat Format() const = 0; |
781 | 781 |
782 protected: | 782 protected: |
783 AudioFrames_2() {} | 783 AudioFrames_2() {} |
784 virtual ~AudioFrames_2() {} | 784 virtual ~AudioFrames_2() {} |
785 }; | 785 }; |
786 | 786 |
787 } // namespace cdm | 787 } // namespace cdm |
788 | 788 |
789 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ | 789 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ |
OLD | NEW |