OLD | NEW |
(Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef CDM_CONTENT_DECRYPTION_MODULE_EXT_H_ |
| 6 #define CDM_CONTENT_DECRYPTION_MODULE_EXT_H_ |
| 7 |
| 8 #if defined(WIN32) |
| 9 #include <windows.h> |
| 10 #endif |
| 11 |
| 12 #include "content_decryption_module_export.h" |
| 13 |
| 14 #if defined(_MSC_VER) |
| 15 typedef unsigned int uint32_t; |
| 16 #else |
| 17 #include <stdint.h> |
| 18 #endif |
| 19 |
| 20 namespace cdm { |
| 21 |
| 22 #if defined(WIN32) |
| 23 typedef wchar_t FilePathCharType; |
| 24 typedef HANDLE PlatformFile; |
| 25 const PlatformFile kInvalidPlatformFile = INVALID_HANDLE_VALUE; |
| 26 #elif defined(OS_POSIX) |
| 27 typedef char FilePathCharType; |
| 28 typedef int PlatformFile; |
| 29 const PlatformFile kInvalidPlatformFile = -1; |
| 30 #else // !defined(WIN32) && !defined(OS_POSIX) |
| 31 #error Unsupported platform. |
| 32 #endif // defined(WIN32) |
| 33 |
| 34 struct HostFile { |
| 35 HostFile(const FilePathCharType* file_path, |
| 36 PlatformFile file, |
| 37 PlatformFile sig_file) |
| 38 : file_path(file_path), file(file), sig_file(sig_file) {} |
| 39 |
| 40 // File that is part of the host of the CDM. |
| 41 const FilePathCharType* file_path = nullptr; |
| 42 PlatformFile file = kInvalidPlatformFile; |
| 43 |
| 44 // Signature file for |file|. |
| 45 PlatformFile sig_file = kInvalidPlatformFile; |
| 46 }; |
| 47 |
| 48 } // namespace cdm |
| 49 |
| 50 extern "C" { |
| 51 |
| 52 // Verifies CDM host files, which are opened in read-only mode and passed in |
| 53 // |host_files|. The CDM MUST return as soon as possible and process the files |
| 54 // asynchronously. All files MUST be closed by the CDM after this one-time |
| 55 // processing is finished. |
| 56 CDM_API void VerifyHostFiles(const cdm::HostFile* host_files, |
| 57 uint32_t num_files); |
| 58 } |
| 59 |
| 60 #endif // CDM_CONTENT_DECRYPTION_MODULE_EXT_H_ |
OLD | NEW |