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

Unified Diff: ppapi/c/private/pp_decrypt_config.h

Issue 10857027: Add content decryptor related structs and update PP{P|B}_ContentDecryptor_Private. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 side-by-side diff with in-line comments
Download patch
Index: ppapi/c/private/pp_decrypt_config.h
diff --git a/ppapi/c/private/pp_decrypt_config.h b/ppapi/c/private/pp_decrypt_config.h
new file mode 100644
index 0000000000000000000000000000000000000000..a148b28b9d8a68afb5e30848e54f1ea8991e4a0e
--- /dev/null
+++ b/ppapi/c/private/pp_decrypt_config.h
@@ -0,0 +1,120 @@
+/* Copyright (c) 2012 The Chromium Authors. All rights reserved.
+ * Use of this source code is governed by a BSD-style license that can be
+ * found in the LICENSE file.
+ */
+
+/* From private/pp_decrypt_config.idl modified Wed Aug 15 19:51:27 2012. */
+
+#ifndef PPAPI_C_PRIVATE_PP_DECRYPT_CONFIG_H_
+#define PPAPI_C_PRIVATE_PP_DECRYPT_CONFIG_H_
+
+#include "ppapi/c/pp_macros.h"
+#include "ppapi/c/pp_stdint.h"
+
+/**
+ * @file
+ * The data structure that can be used to associate the decrypted data with a
+ * decrypt request and/or an input buffer.
+ */
+
+
+/**
+ * @addtogroup Structs
+ * @{
+ */
+struct PP_DecryptTrackingInfo {
+ /**
+ * Client-specified identifier for the associated decrypt request. By using
+ * this value client can associate the decrypted data with a decryption
+ * request.
+ */
+ uint64_t request_id;
+ /**
+ * Timestamp in milliseconds of the associated buffer. By using this value
+ * client can associate the decrypted (and decoded) data with an input buffer.
+ */
+ int64_t timestamp;
+ /**
+ * Duration in milliseconds of the associated buffer.
+ */
+ int64_t duration;
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptTrackingInfo, 24);
+
+/**
+ * The data structure for decryption subsample entry.
+ *
+ * An input buffer can be split into several continuous subsamples.
+ * A <code>PP_DecryptSubsampleEntry</code> specifies the number of clear and
+ * cipher bytes in each subsample. For example, the following buffer has three
+ * subsamples:
+ *
+ * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
+ * | clear1 | cipher1 | clear2 | cipher2 | clear3 | cipher3 |
+ *
+ * For decryption, all of the cipher bytes in a buffer should be concatenated
+ * (in the subsample order) into a single logical stream. The clear bytes should
+ * not be considered as part of decryption.
+ *
+ * Stream to decrypt: | cipher1 | cipher2 | cipher3 |
+ * Decrypted stream: | decrypted1| decrypted2 | decrypted3 |
+ *
+ * After decryption, the decrypted bytes should be copied over the position
+ * of the corresponding cipher bytes in the original buffer to form the output
+ * buffer. Following the above example, the decrypted buffer should be:
+ *
+ * |<----- subsample1 ----->|<----- subsample2 ----->|<----- subsample3 ----->|
+ * | clear1 | decrypted1| clear2 | decrypted2 | clear3 | decrypted3 |
+ */
+struct PP_DecryptSubsampleEntry {
+ /**
+ * Size in bytes of clear data in a subsample entry.
+ */
+ uint32_t clear_bytes;
+ /**
+ * Size in bytes of encrypted data in a subsample entry.
+ */
+ uint32_t cipher_bytes;
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptSubsampleEntry, 8);
+
+/**
+ * The data structure that contains all information needed to decrypt a buffer.
+ */
+struct PP_DecryptConfig {
+ /**
+ * Information needed by the client to track the buffer to be decrypted.
+ */
+ struct PP_DecryptTrackingInfo tracking_info;
+ /**
+ * Size of data to be discarded before applying the decryption (in bytes).
+ */
+ uint32_t data_offset;
+ /**
+ * Key ID of the buffer to be decrypted.
+ */
+ uint8_t key_id[68];
+ uint32_t key_id_size;
+ /**
+ * Initialization vector of the buffer to be decrypted.
+ */
+ uint8_t iv[64];
+ uint32_t iv_size;
+ /**
+ * Checksum of the buffer to be decrypted.
+ */
+ uint8_t checksum[64];
+ uint32_t checksum_size;
+ /**
+ * Subsamples of the buffer to be decrypted.
+ */
+ struct PP_DecryptSubsampleEntry subsamples[16];
+ uint32_t num_subsamples;
+};
+PP_COMPILE_ASSERT_STRUCT_SIZE_IN_BYTES(PP_DecryptConfig, 368);
+/**
+ * @}
+ */
+
+#endif /* PPAPI_C_PRIVATE_PP_DECRYPT_CONFIG_H_ */
+

Powered by Google App Engine
This is Rietveld 408576698