diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 20:50:29 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2009-02-25 20:50:29 +0000 |
commit | bf557e1bbabd298e06e57b2345f96a3fec657f34 (patch) | |
tree | 0cb2a13165718213256161bcb3dead8fd73f2fd7 /chrome/common/chrome_paths.cc | |
parent | 774a996a8235bd91dbbdaf6418ad405810f3be5d (diff) | |
download | chromium_src-bf557e1bbabd298e06e57b2345f96a3fec657f34.zip chromium_src-bf557e1bbabd298e06e57b2345f96a3fec657f34.tar.gz chromium_src-bf557e1bbabd298e06e57b2345f96a3fec657f34.tar.bz2 |
Dynamically load FFmpeg DLLs if present and --enable-video is on.
If any of the DLLs fail to load or are not present, video is disabled.
Review URL: http://codereview.chromium.org/24025
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@10376 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/common/chrome_paths.cc')
-rw-r--r-- | chrome/common/chrome_paths.cc | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/chrome/common/chrome_paths.cc b/chrome/common/chrome_paths.cc index 0c16079..40f22ba 100644 --- a/chrome/common/chrome_paths.cc +++ b/chrome/common/chrome_paths.cc @@ -31,6 +31,17 @@ bool GetGearsPluginPathFromCommandLine(FilePath* path) { #endif } +// Attempts to find the given FFmpeg library and stores the result in |path|. +// Returns true if the library was found and exists, false otherwise. +static bool GetFFmpegLibraryPath(FilePath* path, + const FilePath::StringType& library) { + // Assume FFmpeg DLLs are kept alongside chrome.dll. + if (!PathService::Get(base::DIR_MODULE, path)) + return false; + *path = path->Append(library); + return file_util::PathExists(*path); +} + bool PathProvider(int key, FilePath* result) { // Some keys are just aliases... switch (key) { @@ -149,6 +160,18 @@ bool PathProvider(int key, FilePath* result) { } } break; + case chrome::FILE_LIBAVCODEC: + if (!GetFFmpegLibraryPath(&cur, FILE_PATH_LITERAL("avcodec-52.dll"))) + return false; + break; + case chrome::FILE_LIBAVFORMAT: + if (!GetFFmpegLibraryPath(&cur, FILE_PATH_LITERAL("avformat-52.dll"))) + return false; + break; + case chrome::FILE_LIBAVUTIL: + if (!GetFFmpegLibraryPath(&cur, FILE_PATH_LITERAL("avutil-49.dll"))) + return false; + break; // The following are only valid in the development environment, and // will fail if executed from an installed executable (because the // generated path won't exist). |