OLD | NEW |
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 MEDIA_FORMATS_WEBM_WEBM_CRYPTO_HELPERS_H_ | 5 #ifndef MEDIA_FORMATS_WEBM_WEBM_CRYPTO_HELPERS_H_ |
6 #define MEDIA_FORMATS_WEBM_WEBM_CRYPTO_HELPERS_H_ | 6 #define MEDIA_FORMATS_WEBM_WEBM_CRYPTO_HELPERS_H_ |
7 | 7 |
8 #include "base/basictypes.h" | 8 #include "base/basictypes.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "media/base/decoder_buffer.h" | 10 #include "media/base/decoder_buffer.h" |
11 | 11 |
12 namespace media { | 12 namespace media { |
13 | 13 |
14 // TODO(xhwang): Figure out the init data type appropriately once it's spec'ed. | 14 const char kWebMEncryptInitDataType[] = "webm"; |
15 // See https://www.w3.org/Bugs/Public/show_bug.cgi?id=19096 for more | |
16 // information. | |
17 const char kWebMEncryptInitDataType[] = "video/webm"; | |
18 | 15 |
19 // Fills an initialized DecryptConfig, which can be sent to the Decryptor if | 16 // Fills an initialized DecryptConfig, which can be sent to the Decryptor if |
20 // the stream has potentially encrypted frames. Also sets |data_offset| which | 17 // the stream has potentially encrypted frames. Also sets |data_offset| which |
21 // indicates where the encrypted data starts. Leaving the IV empty will tell | 18 // indicates where the encrypted data starts. Leaving the IV empty will tell |
22 // the decryptor that the frame is unencrypted. Returns true if |data| is valid, | 19 // the decryptor that the frame is unencrypted. Returns true if |data| is valid, |
23 // false otherwise, in which case |decrypt_config| and |data_offset| will not be | 20 // false otherwise, in which case |decrypt_config| and |data_offset| will not be |
24 // changed. Current encrypted WebM request for comments specification is here | 21 // changed. Current encrypted WebM request for comments specification is here |
25 // http://wiki.webmproject.org/encryption/webm-encryption-rfc | 22 // http://wiki.webmproject.org/encryption/webm-encryption-rfc |
26 bool WebMCreateDecryptConfig(const uint8* data, int data_size, | 23 bool WebMCreateDecryptConfig(const uint8* data, int data_size, |
27 const uint8* key_id, int key_id_size, | 24 const uint8* key_id, int key_id_size, |
28 scoped_ptr<DecryptConfig>* decrypt_config, | 25 scoped_ptr<DecryptConfig>* decrypt_config, |
29 int* data_offset); | 26 int* data_offset); |
30 | 27 |
31 } // namespace media | 28 } // namespace media |
32 | 29 |
33 #endif // MEDIA_FORMATS_WEBM_WEBM_CRYPT_HELPERS_H_ | 30 #endif // MEDIA_FORMATS_WEBM_WEBM_CRYPT_HELPERS_H_ |
OLD | NEW |