diff options
Diffstat (limited to 'media')
-rw-r--r-- | media/base/media.h | 8 | ||||
-rw-r--r-- | media/base/media_posix.cc | 21 | ||||
-rw-r--r-- | media/base/media_win.cc | 18 |
3 files changed, 46 insertions, 1 deletions
diff --git a/media/base/media.h b/media/base/media.h index 3d1a83a..fd3269e 100644 --- a/media/base/media.h +++ b/media/base/media.h @@ -25,6 +25,14 @@ bool InitializeMediaLibrary(const FilePath& module_dir); // Returns true if OpenMAX was successfully initialized and loaded. bool InitializeOpenMaxLibrary(const FilePath& module_dir); +// This is temporary to get the address of vpx_codec_vp8_cx_algo in FFmpeg. +// This method should only be called after media library is loaded. + +// TODO(hclam): Remove this after we have a getter function for the same +// purpose in libvpx. +// See bug: http://code.google.com/p/webm/issues/detail?id=169 +void* GetVp8CxAlgoAddress(); + } // namespace media #endif // MEDIA_BASE_MEDIA_H_ diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc index eebae5e..d5137eb 100644 --- a/media/base/media_posix.cc +++ b/media/base/media_posix.cc @@ -10,6 +10,7 @@ #include "base/file_path.h" #include "base/logging.h" +#include "base/native_library.h" #include "base/path_service.h" #include "media/ffmpeg/ffmpeg_common.h" #include "third_party/ffmpeg/ffmpeg_stubs.h" @@ -69,6 +70,9 @@ std::string GetDSOName(tp_ffmpeg::StubModules stub_key) { } // namespace +// Address of vpx_codec_vp8_cx_algo. +static void* vp8_cx_algo_address = NULL; + // Attempts to initialize the media library (loading DSOs, etc.). // Returns true if everything was successfully initialized, false otherwise. bool InitializeMediaLibrary(const FilePath& module_dir) { @@ -85,7 +89,18 @@ bool InitializeMediaLibrary(const FilePath& module_dir) { paths[module].push_back(path.value()); } - return tp_ffmpeg::InitializeStubs(paths); + bool ret = tp_ffmpeg::InitializeStubs(paths); + + // TODO(hclam): This is temporary to obtain address of + // vpx_codec_vp8_cx_algo. This should be removed once libvpx has a + // getter method for it. + base::NativeLibrary sumo_lib = + base::LoadNativeLibrary(module_dir.Append(sumo_name)); + if (sumo_lib) { + vp8_cx_algo_address = base::GetFunctionPointerFromNativeLibrary( + sumo_lib, "vpx_codec_vp8_cx_algo"); + } + return ret; } #if defined(OS_LINUX) @@ -114,4 +129,8 @@ bool InitializeOpenMaxLibrary(const FilePath& module_dir) { } #endif +void* GetVp8CxAlgoAddress() { + return vp8_cx_algo_address; +} + } // namespace media diff --git a/media/base/media_win.cc b/media/base/media_win.cc index 6f9e0f8..f31ab5b 100644 --- a/media/base/media_win.cc +++ b/media/base/media_win.cc @@ -8,6 +8,7 @@ #include "base/file_path.h" #include "base/logging.h" +#include "base/native_library.h" #include "base/path_service.h" #include "base/scoped_ptr.h" @@ -47,6 +48,9 @@ FilePath::CharType* GetDLLName(FFmpegDLLKeys dll_key) { } // namespace +// Address of vpx_codec_vp8_cx_algo. +static void* vp8_cx_algo_address = NULL; + // Attempts to initialize the media library (loading DLLs, DSOs, etc.). // Returns true if everything was successfully initialized, false otherwise. bool InitializeMediaLibrary(const FilePath& base_path) { @@ -78,6 +82,16 @@ bool InitializeMediaLibrary(const FilePath& base_path) { #endif } + // TODO(hclam): This is temporary to obtain address of + // vpx_codec_vp8_cx_algo. This should be removed once libvpx has a + // getter method for it. + base::NativeLibrary avcodec_lib = + base::LoadNativeLibrary(FilePath(GetDLLName(media::FILE_LIBAVCODEC))); + if (avcodec_lib) { + vp8_cx_algo_address = base::GetFunctionPointerFromNativeLibrary( + avcodec_lib, "vpx_codec_vp8_cx_algo"); + } + // Check that we loaded all libraries successfully. We only need to check the // last array element because the loop above will break without initializing // it on any prior error. @@ -97,4 +111,8 @@ bool InitializeOpenMaxLibrary(const FilePath& module_dir) { return false; } +void* GetVp8CxAlgoAddress() { + return vp8_cx_algo_address; +} + } // namespace media |