cdm-fake.cpp (2431B)
1 /*! 2 * \copy 3 * Copyright (c) 2009-2014, Cisco Systems 4 * Copyright (c) 2014, Mozilla 5 * All rights reserved. 6 * 7 * Redistribution and use in source and binary forms, with or without 8 * modification, are permitted provided that the following conditions 9 * are met: 10 * 11 * * Redistributions of source code must retain the above copyright 12 * notice, this list of conditions and the following disclaimer. 13 * 14 * * Redistributions in binary form must reproduce the above copyright 15 * notice, this list of conditions and the following disclaimer in 16 * the documentation and/or other materials provided with the 17 * distribution. 18 * 19 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS 20 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT 21 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS 22 * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE 23 * COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, 24 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, 25 * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; 26 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 27 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 28 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN 29 * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 30 * POSSIBILITY OF SUCH DAMAGE. 31 * 32 * 33 ************************************************************************************* 34 */ 35 36 #include "cdm-test-decryptor.h" 37 #include "content_decryption_module.h" 38 #include "content_decryption_module_ext.h" 39 40 extern "C" { 41 42 CDM_API 43 void INITIALIZE_CDM_MODULE() {} 44 45 CDM_API 46 void* CreateCdmInstance(int cdm_interface_version, const char* key_system, 47 uint32_t key_system_size, 48 GetCdmHostFunc get_cdm_host_func, void* user_data) { 49 if (cdm_interface_version != cdm::ContentDecryptionModule_11::kVersion) { 50 // Only support CDM version 11 currently. 51 return nullptr; 52 } 53 cdm::Host_11* host = static_cast<cdm::Host_11*>( 54 get_cdm_host_func(cdm_interface_version, user_data)); 55 return new FakeDecryptor(host); 56 } 57 58 CDM_API 59 bool VerifyCdmHost_0(const cdm::HostFile* aHostFiles, uint32_t aNumFiles) { 60 return true; 61 } 62 63 } // extern "C"