content_decryption_module_ext.h (1846B)
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 #else 27 typedef char FilePathCharType; 28 typedef int PlatformFile; 29 const PlatformFile kInvalidPlatformFile = -1; 30 #endif // defined(_WIN32) 31 32 struct HostFile { 33 HostFile(const FilePathCharType* file_path, 34 PlatformFile file, 35 PlatformFile sig_file) 36 : file_path(file_path), file(file), sig_file(sig_file) {} 37 38 // File that is part of the host of the CDM. 39 const FilePathCharType* file_path = nullptr; 40 PlatformFile file = kInvalidPlatformFile; 41 42 // Signature file for |file|. 43 PlatformFile sig_file = kInvalidPlatformFile; 44 }; 45 46 } // namespace cdm 47 48 extern "C" { 49 50 // Functions in this file are dynamically retrieved by their versioned function 51 // names. Increment the version number for any backward incompatible API 52 // changes. 53 54 // Verifies CDM host. All files in |host_files| are opened in read-only mode. 55 // 56 // Returns false and closes all files if there is an immediate failure. 57 // Otherwise returns true as soon as possible and processes the files 58 // asynchronously. All files MUST be closed by the CDM after this one-time 59 // processing is finished. 60 CDM_API bool VerifyCdmHost_0(const cdm::HostFile* host_files, 61 uint32_t num_files); 62 } 63 64 #endif // CDM_CONTENT_DECRYPTION_MODULE_EXT_H_