| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "media/base/media.h" | 5 #include "media/base/media.h" |
| 6 | 6 |
| 7 #include <windows.h> | 7 #include <windows.h> |
| 8 | 8 |
| 9 #include "base/file_path.h" | 9 #include "base/file_path.h" |
| 10 #include "base/logging.h" | 10 #include "base/logging.h" |
| 11 #include "base/native_library.h" | 11 #include "base/native_library.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/scoped_ptr.h" | 13 #include "base/scoped_ptr.h" |
| 14 | 14 |
| 15 // Enable timing code by turning on TESTING macro. | 15 // Enable timing code by turning on TESTING macro. |
| 16 //#define TESTING 1 | 16 //#define TESTING 1 |
| 17 | 17 |
| 18 #ifdef TESTING | 18 #ifdef TESTING |
| 19 #include "base/string_util.h" | 19 #include "base/string_util.h" |
| 20 #include "base/time.h" | 20 #include "base/time.h" |
| 21 #endif | 21 #endif |
| 22 | 22 |
| 23 namespace media { | 23 namespace media { |
| 24 | 24 |
| 25 namespace { | |
| 26 | |
| 27 enum FFmpegDLLKeys { | 25 enum FFmpegDLLKeys { |
| 28 FILE_LIBAVCODEC, // full path to libavcodec media decoding library. | 26 FILE_LIBAVCODEC, // full path to libavcodec media decoding library. |
| 29 FILE_LIBAVFORMAT, // full path to libavformat media parsing library. | 27 FILE_LIBAVFORMAT, // full path to libavformat media parsing library. |
| 30 FILE_LIBAVUTIL, // full path to libavutil media utility library. | 28 FILE_LIBAVUTIL, // full path to libavutil media utility library. |
| 31 }; | 29 }; |
| 32 | 30 |
| 33 // Retrieves the DLLName for the given key. | 31 // Retrieves the DLLName for the given key. |
| 34 FilePath::CharType* GetDLLName(FFmpegDLLKeys dll_key) { | 32 static FilePath::CharType* GetDLLName(FFmpegDLLKeys dll_key) { |
| 35 // TODO(ajwong): Do we want to lock to a specific ffmpeg version? | 33 // TODO(ajwong): Do we want to lock to a specific ffmpeg version? |
| 36 switch (dll_key) { | 34 switch (dll_key) { |
| 37 case FILE_LIBAVCODEC: | 35 case FILE_LIBAVCODEC: |
| 38 return FILE_PATH_LITERAL("avcodec-52.dll"); | 36 return FILE_PATH_LITERAL("avcodec-52.dll"); |
| 39 case FILE_LIBAVFORMAT: | 37 case FILE_LIBAVFORMAT: |
| 40 return FILE_PATH_LITERAL("avformat-52.dll"); | 38 return FILE_PATH_LITERAL("avformat-52.dll"); |
| 41 case FILE_LIBAVUTIL: | 39 case FILE_LIBAVUTIL: |
| 42 return FILE_PATH_LITERAL("avutil-50.dll"); | 40 return FILE_PATH_LITERAL("avutil-50.dll"); |
| 43 default: | 41 default: |
| 44 LOG(DFATAL) << "Invalid DLL key requested: " << dll_key; | 42 LOG(DFATAL) << "Invalid DLL key requested: " << dll_key; |
| 45 return FILE_PATH_LITERAL(""); | 43 return FILE_PATH_LITERAL(""); |
| 46 } | 44 } |
| 47 } | 45 } |
| 48 | 46 |
| 49 } // namespace | |
| 50 | |
| 51 // Attempts to initialize the media library (loading DLLs, DSOs, etc.). | 47 // Attempts to initialize the media library (loading DLLs, DSOs, etc.). |
| 52 // Returns true if everything was successfully initialized, false otherwise. | 48 // Returns true if everything was successfully initialized, false otherwise. |
| 53 bool InitializeMediaLibrary(const FilePath& base_path) { | 49 bool InitializeMediaLibrary(const FilePath& base_path) { |
| 54 FFmpegDLLKeys path_keys[] = { | 50 FFmpegDLLKeys path_keys[] = { |
| 55 media::FILE_LIBAVCODEC, | 51 media::FILE_LIBAVCODEC, |
| 56 media::FILE_LIBAVFORMAT, | 52 media::FILE_LIBAVFORMAT, |
| 57 media::FILE_LIBAVUTIL | 53 media::FILE_LIBAVUTIL |
| 58 }; | 54 }; |
| 59 HMODULE libs[arraysize(path_keys)] = {NULL}; | 55 HMODULE libs[arraysize(path_keys)] = {NULL}; |
| 60 | 56 |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 } | 88 } |
| 93 return false; | 89 return false; |
| 94 } | 90 } |
| 95 | 91 |
| 96 bool InitializeOpenMaxLibrary(const FilePath& module_dir) { | 92 bool InitializeOpenMaxLibrary(const FilePath& module_dir) { |
| 97 NOTIMPLEMENTED() << "OpenMAX is not used in Windows."; | 93 NOTIMPLEMENTED() << "OpenMAX is not used in Windows."; |
| 98 return false; | 94 return false; |
| 99 } | 95 } |
| 100 | 96 |
| 101 } // namespace media | 97 } // namespace media |
| OLD | NEW |