summaryrefslogtreecommitdiffstats
path: root/media/base/media_posix.cc
diff options
context:
space:
mode:
authorhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 20:50:56 +0000
committerhclam@chromium.org <hclam@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-02 20:50:56 +0000
commit2ac1e7ca438583c681cbb686122f3ec69fa1d5ff (patch)
tree500afab56a65e9f61e311ee42c5e1e969cf5915a /media/base/media_posix.cc
parentde945c861f68df1f16d58b0570332976fed57f7d (diff)
downloadchromium_src-2ac1e7ca438583c681cbb686122f3ec69fa1d5ff.zip
chromium_src-2ac1e7ca438583c681cbb686122f3ec69fa1d5ff.tar.gz
chromium_src-2ac1e7ca438583c681cbb686122f3ec69fa1d5ff.tar.bz2
Generate stubs for OpenMAX IL
Generate stubs for OpenMAX IL so we don't need a real OpenMAX library for building. The actual library is loaded during runtime. TEST=Build is green TEST=Running omx_test works on hardware with OpenMAX support Review URL: http://codereview.chromium.org/661135 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@40418 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'media/base/media_posix.cc')
-rw-r--r--media/base/media_posix.cc33
1 files changed, 32 insertions, 1 deletions
diff --git a/media/base/media_posix.cc b/media/base/media_posix.cc
index 9b1035c..210bea3 100644
--- a/media/base/media_posix.cc
+++ b/media/base/media_posix.cc
@@ -1,4 +1,4 @@
-// Copyright (c) 2009 The Chromium Authors. All rights reserved.
+// Copyright (c) 2010 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -12,6 +12,10 @@
#include "base/logging.h"
#include "base/path_service.h"
#include "third_party/ffmpeg/ffmpeg_stubs.h"
+#if defined(OS_LINUX)
+// OpenMAX IL stub is generated only on Linux.
+#include "third_party/openmax/il_stubs.h"
+#endif
namespace tp_ffmpeg = third_party_ffmpeg;
@@ -29,6 +33,7 @@ const FilePath::CharType sumo_name[] = FILE_PATH_LITERAL("libffmpegsumo.so");
#else
#error "Do not know how to construct DSO name for this OS."
#endif
+const FilePath::CharType openmax_name[] = FILE_PATH_LITERAL("libOmxCore.so");
// Retrieves the DSOName for the given key.
std::string GetDSOName(tp_ffmpeg::StubModules stub_key) {
@@ -68,4 +73,30 @@ bool InitializeMediaLibrary(const FilePath& module_dir) {
return tp_ffmpeg::InitializeStubs(paths);
}
+#if defined(OS_LINUX)
+namespace tp_openmax = third_party_openmax;
+bool InitializeOpenMaxLibrary(const FilePath& module_dir) {
+ // TODO(ajwong): We need error resolution.
+ tp_openmax::StubPathMap paths;
+ for (int i = 0; i < static_cast<int>(tp_openmax::kNumStubModules); ++i) {
+ tp_openmax::StubModules module = static_cast<tp_openmax::StubModules>(i);
+
+ // Add the OpenMAX library first so it takes precedence.
+ paths[module].push_back(module_dir.Append(openmax_name).value());
+ }
+
+ bool result = tp_openmax::InitializeStubs(paths);
+ if (!result) {
+ LOG(FATAL) << "Cannot load " << openmax_name << "."
+ << " Make sure it exists for OpenMAX.";
+ }
+ return result;
+}
+#else
+bool InitializeOpenMaxLibrary(const FilePath& module_dir) {
+ NOTIMPLEMENTED() << "OpenMAX is only used in Linux.";
+ return false;
+}
+#endif
+
} // namespace media