1 // Copyright (c) 2012 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 #include "media/base/media.h" 6 7 #include <windows.h> 8 #if defined(_WIN32_WINNT_WIN8) 9 // The Windows 8 SDK defines FACILITY_VISUALCPP in winerror.h. 10 #undef FACILITY_VISUALCPP 11 #endif 12 #include <delayimp.h> 13 14 #include "base/files/file_path.h" 15 16 #pragma comment(lib, "delayimp.lib") 17 18 namespace media { 19 namespace internal { 20 21 bool InitializeMediaLibraryInternal(const base::FilePath& module_dir) { 22 // LoadLibraryEx(..., LOAD_WITH_ALTERED_SEARCH_PATH) cannot handle 23 // relative path. 24 if (!module_dir.IsAbsolute()) 25 return false; 26 27 // Use alternate DLL search path so we don't load dependencies from the 28 // system path. Refer to http://crbug.com/35857 29 static const char kFFmpegDLL[] = "ffmpegsumo.dll"; 30 HMODULE lib = ::LoadLibraryEx( 31 module_dir.AppendASCII(kFFmpegDLL).value().c_str(), NULL, 32 LOAD_WITH_ALTERED_SEARCH_PATH); 33 34 // Check that we loaded the library successfully. 35 return lib != NULL; 36 } 37 38 } // namespace internal 39 } // namespace media 40