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

Side by Side Diff: content_decryption_module.h

Issue 26592004: Switch CDM.h to use uint32_t for size types per style guide. (Closed) Base URL: https://chromium.googlesource.com/chromium/cdm.git@master
Patch Set: Rebase. Created 7 years, 2 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
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 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
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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
114 // 114 //
115 // After decryption, the decrypted bytes should be copied over the position 115 // After decryption, the decrypted bytes should be copied over the position
116 // of the corresponding cipher bytes in the original buffer to form the output 116 // of the corresponding cipher bytes in the original buffer to form the output
117 // buffer. Following the above example, the decrypted buffer should be: 117 // buffer. Following the above example, the decrypted buffer should be:
118 // 118 //
119 // |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->| 119 // |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
120 // | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 | 120 // | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 |
121 // 121 //
122 // TODO(xhwang): Add checks to make sure these structs have fixed layout. 122 // TODO(xhwang): Add checks to make sure these structs have fixed layout.
123 struct SubsampleEntry { 123 struct SubsampleEntry {
124 SubsampleEntry(int32_t clear_bytes, int32_t cipher_bytes) 124 SubsampleEntry(uint32_t clear_bytes, uint32_t cipher_bytes)
125 : clear_bytes(clear_bytes), cipher_bytes(cipher_bytes) {} 125 : clear_bytes(clear_bytes), cipher_bytes(cipher_bytes) {}
126 126
127 int32_t clear_bytes; 127 uint32_t clear_bytes;
128 int32_t cipher_bytes; 128 uint32_t cipher_bytes;
129 }; 129 };
130 130
131 // Represents an input buffer to be decrypted (and possibly decoded). It does 131 // Represents an input buffer to be decrypted (and possibly decoded). It does
132 // own any pointers in this struct. 132 // own any pointers in this struct.
133 struct InputBuffer { 133 struct InputBuffer {
134 InputBuffer() 134 InputBuffer()
135 : data(NULL), 135 : data(NULL),
136 data_size(0), 136 data_size(0),
137 data_offset(0), 137 data_offset(0),
138 key_id(NULL), 138 key_id(NULL),
139 key_id_size(0), 139 key_id_size(0),
140 iv(NULL), 140 iv(NULL),
141 iv_size(0), 141 iv_size(0),
142 subsamples(NULL), 142 subsamples(NULL),
143 num_subsamples(0), 143 num_subsamples(0),
144 timestamp(0) {} 144 timestamp(0) {}
145 145
146 const uint8_t* data; // Pointer to the beginning of the input data. 146 const uint8_t* data; // Pointer to the beginning of the input data.
147 int32_t data_size; // Size (in bytes) of |data|. 147 uint32_t data_size; // Size (in bytes) of |data|.
148 148
149 int32_t data_offset; // Number of bytes to be discarded before decryption. 149 uint32_t data_offset; // Number of bytes to be discarded before decryption.
150 150
151 const uint8_t* key_id; // Key ID to identify the decryption key. 151 const uint8_t* key_id; // Key ID to identify the decryption key.
152 int32_t key_id_size; // Size (in bytes) of |key_id|. 152 uint32_t key_id_size; // Size (in bytes) of |key_id|.
153 153
154 const uint8_t* iv; // Initialization vector. 154 const uint8_t* iv; // Initialization vector.
155 int32_t iv_size; // Size (in bytes) of |iv|. 155 uint32_t iv_size; // Size (in bytes) of |iv|.
156 156
157 const struct SubsampleEntry* subsamples; 157 const struct SubsampleEntry* subsamples;
158 int32_t num_subsamples; // Number of subsamples in |subsamples|. 158 uint32_t num_subsamples; // Number of subsamples in |subsamples|.
159 159
160 int64_t timestamp; // Presentation timestamp in microseconds. 160 int64_t timestamp; // Presentation timestamp in microseconds.
161 }; 161 };
162 162
163 struct AudioDecoderConfig { 163 struct AudioDecoderConfig {
164 enum AudioCodec { 164 enum AudioCodec {
165 kUnknownAudioCodec = 0, 165 kUnknownAudioCodec = 0,
166 kCodecVorbis, 166 kCodecVorbis,
167 kCodecAac 167 kCodecAac
168 }; 168 };
169 169
170 AudioDecoderConfig() 170 AudioDecoderConfig()
171 : codec(kUnknownAudioCodec), 171 : codec(kUnknownAudioCodec),
172 channel_count(0), 172 channel_count(0),
173 bits_per_channel(0), 173 bits_per_channel(0),
174 samples_per_second(0), 174 samples_per_second(0),
175 extra_data(NULL), 175 extra_data(NULL),
176 extra_data_size(0) {} 176 extra_data_size(0) {}
177 177
178 AudioCodec codec; 178 AudioCodec codec;
179 int32_t channel_count; 179 int32_t channel_count;
180 int32_t bits_per_channel; 180 int32_t bits_per_channel;
181 int32_t samples_per_second; 181 int32_t samples_per_second;
182 182
183 // Optional byte data required to initialize audio decoders, such as the 183 // Optional byte data required to initialize audio decoders, such as the
184 // vorbis setup header. 184 // vorbis setup header.
185 uint8_t* extra_data; 185 uint8_t* extra_data;
186 int32_t extra_data_size; 186 uint32_t extra_data_size;
187 }; 187 };
188 188
189 // Supported sample formats for AudioFrames. 189 // Supported sample formats for AudioFrames.
190 enum AudioFormat { 190 enum AudioFormat {
191 kUnknownAudioFormat = 0, // Unknown format value. Used for error reporting. 191 kUnknownAudioFormat = 0, // Unknown format value. Used for error reporting.
192 kAudioFormatU8, // Interleaved unsigned 8-bit w/ bias of 128. 192 kAudioFormatU8, // Interleaved unsigned 8-bit w/ bias of 128.
193 kAudioFormatS16, // Interleaved signed 16-bit. 193 kAudioFormatS16, // Interleaved signed 16-bit.
194 kAudioFormatS32, // Interleaved signed 32-bit. 194 kAudioFormatS32, // Interleaved signed 32-bit.
195 kAudioFormatF32, // Interleaved float 32-bit. 195 kAudioFormatF32, // Interleaved float 32-bit.
196 kAudioFormatPlanarS16, // Signed 16-bit planar. 196 kAudioFormatPlanarS16, // Signed 16-bit planar.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
242 VideoCodecProfile profile; 242 VideoCodecProfile profile;
243 VideoFormat format; 243 VideoFormat format;
244 244
245 // Width and height of video frame immediately post-decode. Not all pixels 245 // Width and height of video frame immediately post-decode. Not all pixels
246 // in this region are valid. 246 // in this region are valid.
247 Size coded_size; 247 Size coded_size;
248 248
249 // Optional byte data required to initialize video decoders, such as H.264 249 // Optional byte data required to initialize video decoders, such as H.264
250 // AAVC data. 250 // AAVC data.
251 uint8_t* extra_data; 251 uint8_t* extra_data;
252 int32_t extra_data_size; 252 uint32_t extra_data_size;
253 }; 253 };
254 254
255 enum StreamType { 255 enum StreamType {
256 kStreamTypeAudio = 0, 256 kStreamTypeAudio = 0,
257 kStreamTypeVideo = 1 257 kStreamTypeVideo = 1
258 }; 258 };
259 259
260 // Structure provided to ContentDecryptionModule::OnPlatformChallengeResponse() 260 // Structure provided to ContentDecryptionModule::OnPlatformChallengeResponse()
261 // after a platform challenge was initiated via Host::SendPlatformChallenge(). 261 // after a platform challenge was initiated via Host::SendPlatformChallenge().
262 // All values will be NULL / zero in the event of a challenge failure. 262 // All values will be NULL / zero in the event of a challenge failure.
263 struct PlatformChallengeResponse { 263 struct PlatformChallengeResponse {
264 // |challenge| provided during Host::SendPlatformChallenge() combined with 264 // |challenge| provided during Host::SendPlatformChallenge() combined with
265 // nonce data and signed with the platform's private key. 265 // nonce data and signed with the platform's private key.
266 const uint8_t* signed_data; 266 const uint8_t* signed_data;
267 int32_t signed_data_length; 267 uint32_t signed_data_length;
268 268
269 // RSASSA-PKCS1-v1_5-SHA256 signature of the |signed_data| block. 269 // RSASSA-PKCS1-v1_5-SHA256 signature of the |signed_data| block.
270 const uint8_t* signed_data_signature; 270 const uint8_t* signed_data_signature;
271 int32_t signed_data_signature_length; 271 uint32_t signed_data_signature_length;
272 272
273 // X.509 device specific certificate for the |service_id| requested. 273 // X.509 device specific certificate for the |service_id| requested.
274 const uint8_t* platform_key_certificate; 274 const uint8_t* platform_key_certificate;
275 int32_t platform_key_certificate_length; 275 uint32_t platform_key_certificate_length;
276 }; 276 };
277 277
278 // Supported output protection methods for use with EnableOutputProtection() and 278 // Supported output protection methods for use with EnableOutputProtection() and
279 // returned by OnQueryOutputProtectionStatus(). 279 // returned by OnQueryOutputProtectionStatus().
280 enum OutputProtectionMethods { 280 enum OutputProtectionMethods {
281 kProtectionNone = 0, 281 kProtectionNone = 0,
282 kProtectionHDCP = 1 << 0 282 kProtectionHDCP = 1 << 0
283 }; 283 };
284 284
285 // Connected output link types returned by OnQueryOutputProtectionStatus(). 285 // Connected output link types returned by OnQueryOutputProtectionStatus().
(...skipping 26 matching lines...) Expand all
312 static const int kVersion = kCdmInterfaceVersion_1; 312 static const int kVersion = kCdmInterfaceVersion_1;
313 typedef Host_1 Host; 313 typedef Host_1 Host;
314 314
315 // Generates a |key_request| given |type| and |init_data|. 315 // Generates a |key_request| given |type| and |init_data|.
316 // 316 //
317 // Returns kSuccess if the key request was successfully generated, in which 317 // Returns kSuccess if the key request was successfully generated, in which
318 // case the CDM must send the key message by calling Host::SendKeyMessage(). 318 // case the CDM must send the key message by calling Host::SendKeyMessage().
319 // Returns kSessionError if any error happened, in which case the CDM must 319 // Returns kSessionError if any error happened, in which case the CDM must
320 // send a key error by calling Host::SendKeyError(). 320 // send a key error by calling Host::SendKeyError().
321 virtual Status GenerateKeyRequest( 321 virtual Status GenerateKeyRequest(
322 const char* type, int type_size, 322 const char* type, uint32_t type_size,
323 const uint8_t* init_data, int init_data_size) = 0; 323 const uint8_t* init_data, uint32_t init_data_size) = 0;
324 324
325 // Adds the |key| to the CDM to be associated with |key_id|. 325 // Adds the |key| to the CDM to be associated with |key_id|.
326 // 326 //
327 // Returns kSuccess if the key was successfully added, kSessionError 327 // Returns kSuccess if the key was successfully added, kSessionError
328 // otherwise. 328 // otherwise.
329 virtual Status AddKey(const char* session_id, int session_id_size, 329 virtual Status AddKey(const char* session_id, uint32_t session_id_size,
330 const uint8_t* key, int key_size, 330 const uint8_t* key, uint32_t key_size,
331 const uint8_t* key_id, int key_id_size) = 0; 331 const uint8_t* key_id, uint32_t key_id_size) = 0;
332 332
333 // Cancels any pending key request made to the CDM for |session_id|. 333 // Cancels any pending key request made to the CDM for |session_id|.
334 // 334 //
335 // Returns kSuccess if all pending key requests for |session_id| were 335 // Returns kSuccess if all pending key requests for |session_id| were
336 // successfully canceled or there was no key request to be canceled, 336 // successfully canceled or there was no key request to be canceled,
337 // kSessionError otherwise. 337 // kSessionError otherwise.
338 virtual Status CancelKeyRequest( 338 virtual Status CancelKeyRequest(
339 const char* session_id, int session_id_size) = 0; 339 const char* session_id, uint32_t session_id_size) = 0;
340 340
341 // Performs scheduled operation with |context| when the timer fires. 341 // Performs scheduled operation with |context| when the timer fires.
342 virtual void TimerExpired(void* context) = 0; 342 virtual void TimerExpired(void* context) = 0;
343 343
344 // Decrypts the |encrypted_buffer|. 344 // Decrypts the |encrypted_buffer|.
345 // 345 //
346 // Returns kSuccess if decryption succeeded, in which case the callee 346 // Returns kSuccess if decryption succeeded, in which case the callee
347 // should have filled the |decrypted_buffer| and passed the ownership of 347 // should have filled the |decrypted_buffer| and passed the ownership of
348 // |data| in |decrypted_buffer| to the caller. 348 // |data| in |decrypted_buffer| to the caller.
349 // Returns kNoKey if the CDM did not have the necessary decryption key 349 // Returns kNoKey if the CDM did not have the necessary decryption key
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
444 static const int kVersion = kCdmInterfaceVersion_2; 444 static const int kVersion = kCdmInterfaceVersion_2;
445 typedef Host_2 Host; 445 typedef Host_2 Host;
446 446
447 // Generates a |key_request| given |type| and |init_data|. 447 // Generates a |key_request| given |type| and |init_data|.
448 // 448 //
449 // Returns kSuccess if the key request was successfully generated, in which 449 // Returns kSuccess if the key request was successfully generated, in which
450 // case the CDM must send the key message by calling Host::SendKeyMessage(). 450 // case the CDM must send the key message by calling Host::SendKeyMessage().
451 // Returns kSessionError if any error happened, in which case the CDM must 451 // Returns kSessionError if any error happened, in which case the CDM must
452 // send a key error by calling Host::SendKeyError(). 452 // send a key error by calling Host::SendKeyError().
453 virtual Status GenerateKeyRequest( 453 virtual Status GenerateKeyRequest(
454 const char* type, int type_size, 454 const char* type, uint32_t type_size,
455 const uint8_t* init_data, int init_data_size) = 0; 455 const uint8_t* init_data, uint32_t init_data_size) = 0;
456 456
457 // Adds the |key| to the CDM to be associated with |key_id|. 457 // Adds the |key| to the CDM to be associated with |key_id|.
458 // 458 //
459 // Returns kSuccess if the key was successfully added, kSessionError 459 // Returns kSuccess if the key was successfully added, kSessionError
460 // otherwise. 460 // otherwise.
461 virtual Status AddKey(const char* session_id, int session_id_size, 461 virtual Status AddKey(const char* session_id, uint32_t session_id_size,
462 const uint8_t* key, int key_size, 462 const uint8_t* key, uint32_t key_size,
463 const uint8_t* key_id, int key_id_size) = 0; 463 const uint8_t* key_id, uint32_t key_id_size) = 0;
464 464
465 // Cancels any pending key request made to the CDM for |session_id|. 465 // Cancels any pending key request made to the CDM for |session_id|.
466 // 466 //
467 // Returns kSuccess if all pending key requests for |session_id| were 467 // Returns kSuccess if all pending key requests for |session_id| were
468 // successfully canceled or there was no key request to be canceled, 468 // successfully canceled or there was no key request to be canceled,
469 // kSessionError otherwise. 469 // kSessionError otherwise.
470 virtual Status CancelKeyRequest( 470 virtual Status CancelKeyRequest(
471 const char* session_id, int session_id_size) = 0; 471 const char* session_id, uint32_t session_id_size) = 0;
472 472
473 // Performs scheduled operation with |context| when the timer fires. 473 // Performs scheduled operation with |context| when the timer fires.
474 virtual void TimerExpired(void* context) = 0; 474 virtual void TimerExpired(void* context) = 0;
475 475
476 // Decrypts the |encrypted_buffer|. 476 // Decrypts the |encrypted_buffer|.
477 // 477 //
478 // Returns kSuccess if decryption succeeded, in which case the callee 478 // Returns kSuccess if decryption succeeded, in which case the callee
479 // should have filled the |decrypted_buffer| and passed the ownership of 479 // should have filled the |decrypted_buffer| and passed the ownership of
480 // |data| in |decrypted_buffer| to the caller. 480 // |data| in |decrypted_buffer| to the caller.
481 // Returns kNoKey if the CDM did not have the necessary decryption key 481 // Returns kNoKey if the CDM did not have the necessary decryption key
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
587 587
588 typedef ContentDecryptionModule_2 ContentDecryptionModule; 588 typedef ContentDecryptionModule_2 ContentDecryptionModule;
589 const int kCdmInterfaceVersion = ContentDecryptionModule::kVersion; 589 const int kCdmInterfaceVersion = ContentDecryptionModule::kVersion;
590 590
591 // Represents a buffer created by Allocator implementations. 591 // Represents a buffer created by Allocator implementations.
592 class Buffer { 592 class Buffer {
593 public: 593 public:
594 // Destroys the buffer in the same context as it was created. 594 // Destroys the buffer in the same context as it was created.
595 virtual void Destroy() = 0; 595 virtual void Destroy() = 0;
596 596
597 virtual int32_t Capacity() const = 0; 597 virtual uint32_t Capacity() const = 0;
598 virtual uint8_t* Data() = 0; 598 virtual uint8_t* Data() = 0;
599 virtual void SetSize(int32_t size) = 0; 599 virtual void SetSize(uint32_t size) = 0;
600 virtual int32_t Size() const = 0; 600 virtual uint32_t Size() const = 0;
601 601
602 protected: 602 protected:
603 Buffer() {} 603 Buffer() {}
604 virtual ~Buffer() {} 604 virtual ~Buffer() {}
605 605
606 private: 606 private:
607 Buffer(const Buffer&); 607 Buffer(const Buffer&);
608 void operator=(const Buffer&); 608 void operator=(const Buffer&);
609 }; 609 };
610 610
611 // Deprecated. 611 // Deprecated.
612 // Remove after CDMs start to use ContentDecryptionModule*::Host::kVersion. 612 // Remove after CDMs start to use ContentDecryptionModule*::Host::kVersion.
613 const int kHostInterfaceVersion_1 = 1; 613 const int kHostInterfaceVersion_1 = 1;
614 const int kHostInterfaceVersion_2 = 2; 614 const int kHostInterfaceVersion_2 = 2;
615 615
616 // Host interface that the CDM can call into to access browser side services. 616 // Host interface that the CDM can call into to access browser side services.
617 // Host interfaces are versioned for backward compatibility. CDM should use 617 // Host interfaces are versioned for backward compatibility. CDM should use
618 // HostFactory object to request a Host interface of a particular version. 618 // HostFactory object to request a Host interface of a particular version.
619 class Host_1 { 619 class Host_1 {
620 public: 620 public:
621 static const int kVersion = kHostInterfaceVersion_1; 621 static const int kVersion = kHostInterfaceVersion_1;
622 622
623 // Returns a Buffer* containing non-zero members upon success, or NULL on 623 // Returns a Buffer* containing non-zero members upon success, or NULL on
624 // failure. The caller owns the Buffer* after this call. The buffer is not 624 // failure. The caller owns the Buffer* after this call. The buffer is not
625 // guaranteed to be zero initialized. The capacity of the allocated Buffer 625 // guaranteed to be zero initialized. The capacity of the allocated Buffer
626 // is guaranteed to be not less than |capacity|. 626 // is guaranteed to be not less than |capacity|.
627 virtual Buffer* Allocate(int32_t capacity) = 0; 627 virtual Buffer* Allocate(uint32_t capacity) = 0;
628 628
629 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| 629 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms|
630 // from now with |context|. 630 // from now with |context|.
631 virtual void SetTimer(int64_t delay_ms, void* context) = 0; 631 virtual void SetTimer(int64_t delay_ms, void* context) = 0;
632 632
633 // Returns the current epoch wall time in seconds. 633 // Returns the current epoch wall time in seconds.
634 virtual double GetCurrentWallTimeInSeconds() = 0; 634 virtual double GetCurrentWallTimeInSeconds() = 0;
635 635
636 // Sends a keymessage event to the application. 636 // Sends a keymessage event to the application.
637 // Length parameters should not include null termination. 637 // Length parameters should not include null termination.
638 virtual void SendKeyMessage( 638 virtual void SendKeyMessage(
639 const char* session_id, int32_t session_id_length, 639 const char* session_id, uint32_t session_id_length,
640 const char* message, int32_t message_length, 640 const char* message, uint32_t message_length,
641 const char* default_url, int32_t default_url_length) = 0; 641 const char* default_url, uint32_t default_url_length) = 0;
642 642
643 // Sends a keyerror event to the application. 643 // Sends a keyerror event to the application.
644 // |session_id_length| should not include null termination. 644 // |session_id_length| should not include null termination.
645 virtual void SendKeyError(const char* session_id, 645 virtual void SendKeyError(const char* session_id,
646 int32_t session_id_length, 646 uint32_t session_id_length,
647 MediaKeyError error_code, 647 MediaKeyError error_code,
648 uint32_t system_code) = 0; 648 uint32_t system_code) = 0;
649 649
650 // Get private data from the host. This function is limited to internal use. 650 // Get private data from the host. This function is limited to internal use.
651 typedef const void* (*GetPrivateInterface)(const char* interface_name); 651 typedef const void* (*GetPrivateInterface)(const char* interface_name);
652 virtual void GetPrivateData(int32_t* instance, 652 virtual void GetPrivateData(int32_t* instance,
653 GetPrivateInterface* get_interface) = 0; 653 GetPrivateInterface* get_interface) = 0;
654 654
655 protected: 655 protected:
656 Host_1() {} 656 Host_1() {}
657 virtual ~Host_1() {} 657 virtual ~Host_1() {}
658 }; 658 };
659 659
660 class Host_2 { 660 class Host_2 {
661 public: 661 public:
662 static const int kVersion = kHostInterfaceVersion_2; 662 static const int kVersion = kHostInterfaceVersion_2;
663 663
664 // Returns a Buffer* containing non-zero members upon success, or NULL on 664 // Returns a Buffer* containing non-zero members upon success, or NULL on
665 // failure. The caller owns the Buffer* after this call. The buffer is not 665 // failure. The caller owns the Buffer* after this call. The buffer is not
666 // guaranteed to be zero initialized. The capacity of the allocated Buffer 666 // guaranteed to be zero initialized. The capacity of the allocated Buffer
667 // is guaranteed to be not less than |capacity|. 667 // is guaranteed to be not less than |capacity|.
668 virtual Buffer* Allocate(int32_t capacity) = 0; 668 virtual Buffer* Allocate(uint32_t capacity) = 0;
669 669
670 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms| 670 // Requests the host to call ContentDecryptionModule::TimerFired() |delay_ms|
671 // from now with |context|. 671 // from now with |context|.
672 virtual void SetTimer(int64_t delay_ms, void* context) = 0; 672 virtual void SetTimer(int64_t delay_ms, void* context) = 0;
673 673
674 // Returns the current epoch wall time in seconds. 674 // Returns the current epoch wall time in seconds.
675 virtual double GetCurrentWallTimeInSeconds() = 0; 675 virtual double GetCurrentWallTimeInSeconds() = 0;
676 676
677 // Sends a keymessage event to the application. 677 // Sends a keymessage event to the application.
678 // Length parameters should not include null termination. 678 // Length parameters should not include null termination.
679 virtual void SendKeyMessage( 679 virtual void SendKeyMessage(
680 const char* session_id, int32_t session_id_length, 680 const char* session_id, uint32_t session_id_length,
681 const char* message, int32_t message_length, 681 const char* message, uint32_t message_length,
682 const char* default_url, int32_t default_url_length) = 0; 682 const char* default_url, uint32_t default_url_length) = 0;
683 683
684 // Sends a keyerror event to the application. 684 // Sends a keyerror event to the application.
685 // |session_id_length| should not include null termination. 685 // |session_id_length| should not include null termination.
686 virtual void SendKeyError(const char* session_id, 686 virtual void SendKeyError(const char* session_id,
687 int32_t session_id_length, 687 uint32_t session_id_length,
688 MediaKeyError error_code, 688 MediaKeyError error_code,
689 uint32_t system_code) = 0; 689 uint32_t system_code) = 0;
690 690
691 // Get private data from the host. This function is limited to internal use. 691 // Get private data from the host. This function is limited to internal use.
692 virtual void GetPrivateData(int32_t* instance, 692 virtual void GetPrivateData(int32_t* instance,
693 Host_1::GetPrivateInterface* get_interface) = 0; 693 Host_1::GetPrivateInterface* get_interface) = 0;
694 694
695 // Sends a platform challenge for the given |service_id|. |challenge| is at 695 // Sends a platform challenge for the given |service_id|. |challenge| is at
696 // most 256 bits of data to be signed. Once the challenge has been completed, 696 // most 256 bits of data to be signed. Once the challenge has been completed,
697 // the host will call ContentDecryptionModule::OnPlatformChallengeResponse() 697 // the host will call ContentDecryptionModule::OnPlatformChallengeResponse()
698 // with the signed challenge response and platform certificate. Length 698 // with the signed challenge response and platform certificate. Length
699 // parameters should not include null termination. 699 // parameters should not include null termination.
700 virtual void SendPlatformChallenge( 700 virtual void SendPlatformChallenge(
701 const char* service_id, int32_t service_id_length, 701 const char* service_id, uint32_t service_id_length,
702 const char* challenge, int32_t challenge_length) = 0; 702 const char* challenge, uint32_t challenge_length) = 0;
703 703
704 // Attempts to enable output protection (e.g. HDCP) on the display link. The 704 // Attempts to enable output protection (e.g. HDCP) on the display link. The
705 // |desired_protection_mask| is a bit mask of OutputProtectionMethods. No 705 // |desired_protection_mask| is a bit mask of OutputProtectionMethods. No
706 // status callback is issued, the CDM must call QueryOutputProtectionStatus() 706 // status callback is issued, the CDM must call QueryOutputProtectionStatus()
707 // periodically to ensure the desired protections are applied. 707 // periodically to ensure the desired protections are applied.
708 virtual void EnableOutputProtection(uint32_t desired_protection_mask) = 0; 708 virtual void EnableOutputProtection(uint32_t desired_protection_mask) = 0;
709 709
710 // Requests the current output protection status. Once the host has the status 710 // Requests the current output protection status. Once the host has the status
711 // it will call ContentDecryptionModule::OnQueryOutputProtectionStatus(). 711 // it will call ContentDecryptionModule::OnQueryOutputProtectionStatus().
712 virtual void QueryOutputProtectionStatus() = 0; 712 virtual void QueryOutputProtectionStatus() = 0;
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
753 753
754 virtual void SetFormat(VideoFormat format) = 0; 754 virtual void SetFormat(VideoFormat format) = 0;
755 virtual VideoFormat Format() const = 0; 755 virtual VideoFormat Format() const = 0;
756 756
757 virtual void SetSize(cdm::Size size) = 0; 757 virtual void SetSize(cdm::Size size) = 0;
758 virtual cdm::Size Size() const = 0; 758 virtual cdm::Size Size() const = 0;
759 759
760 virtual void SetFrameBuffer(Buffer* frame_buffer) = 0; 760 virtual void SetFrameBuffer(Buffer* frame_buffer) = 0;
761 virtual Buffer* FrameBuffer() = 0; 761 virtual Buffer* FrameBuffer() = 0;
762 762
763 virtual void SetPlaneOffset(VideoPlane plane, int32_t offset) = 0; 763 virtual void SetPlaneOffset(VideoPlane plane, uint32_t offset) = 0;
764 virtual int32_t PlaneOffset(VideoPlane plane) = 0; 764 virtual uint32_t PlaneOffset(VideoPlane plane) = 0;
765 765
766 virtual void SetStride(VideoPlane plane, int32_t stride) = 0; 766 virtual void SetStride(VideoPlane plane, uint32_t stride) = 0;
767 virtual int32_t Stride(VideoPlane plane) = 0; 767 virtual uint32_t Stride(VideoPlane plane) = 0;
768 768
769 virtual void SetTimestamp(int64_t timestamp) = 0; 769 virtual void SetTimestamp(int64_t timestamp) = 0;
770 virtual int64_t Timestamp() const = 0; 770 virtual int64_t Timestamp() const = 0;
771 771
772 protected: 772 protected:
773 VideoFrame() {} 773 VideoFrame() {}
774 virtual ~VideoFrame() {} 774 virtual ~VideoFrame() {}
775 }; 775 };
776 776
777 // 777 //
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
812 virtual AudioFormat Format() const = 0; 812 virtual AudioFormat Format() const = 0;
813 813
814 protected: 814 protected:
815 AudioFrames_2() {} 815 AudioFrames_2() {}
816 virtual ~AudioFrames_2() {} 816 virtual ~AudioFrames_2() {}
817 }; 817 };
818 818
819 } // namespace cdm 819 } // namespace cdm
820 820
821 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_ 821 #endif // CDM_CONTENT_DECRYPTION_MODULE_H_
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698