summaryrefslogtreecommitdiffstats
path: root/media
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
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')
-rw-r--r--media/base/media.h8
-rw-r--r--media/base/media_posix.cc33
-rw-r--r--media/base/media_win.cc5
-rw-r--r--media/tools/omx_test/omx_test.cc6
-rw-r--r--media/tools/player_x11/player_x11.cc8
5 files changed, 57 insertions, 3 deletions
diff --git a/media/base/media.h b/media/base/media.h
index 171d4e8..3d1a83a 100644
--- a/media/base/media.h
+++ b/media/base/media.h
@@ -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.
@@ -20,7 +20,11 @@ namespace media {
// Returns true if everything was successfully initialized, false otherwise.
bool InitializeMediaLibrary(const FilePath& module_dir);
+// Attempts to initialize OpenMAX library.
+//
+// Returns true if OpenMAX was successfully initialized and loaded.
+bool InitializeOpenMaxLibrary(const FilePath& module_dir);
+
} // namespace media
#endif // MEDIA_BASE_MEDIA_H_
-
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
diff --git a/media/base/media_win.cc b/media/base/media_win.cc
index 975a301..e4d67f5 100644
--- a/media/base/media_win.cc
+++ b/media/base/media_win.cc
@@ -96,4 +96,9 @@ bool InitializeMediaLibrary(const FilePath& base_path) {
return false;
}
+bool InitializeOpenMaxLibrary(const FilePath& module_dir) {
+ NOTIMPLEMENTED() << "OpenMAX is not used in Windows.";
+ return false;
+}
+
} // namespace media
diff --git a/media/tools/omx_test/omx_test.cc b/media/tools/omx_test/omx_test.cc
index 428bacc..e90f150 100644
--- a/media/tools/omx_test/omx_test.cc
+++ b/media/tools/omx_test/omx_test.cc
@@ -320,6 +320,12 @@ int main(int argc, char** argv) {
loop_count = 1;
DCHECK_GE(loop_count, 1);
+ // Initialize OpenMAX.
+ if (!media::InitializeOpenMaxLibrary(FilePath())) {
+ LOG(ERROR) << "Unable to initialize OpenMAX library.";
+ return false;
+ }
+
// If FFmpeg should be used for demuxing load the library here and do
// the initialization.
if (use_ffmpeg && !InitFFmpeg()) {
diff --git a/media/tools/player_x11/player_x11.cc b/media/tools/player_x11/player_x11.cc
index 41207fd..24ba556 100644
--- a/media/tools/player_x11/player_x11.cc
+++ b/media/tools/player_x11/player_x11.cc
@@ -64,6 +64,14 @@ bool InitX11() {
bool InitPipeline(MessageLoop* message_loop,
const char* filename, bool enable_audio,
scoped_refptr<media::PipelineImpl>* pipeline) {
+ // Initialize OpenMAX.
+ if (CommandLine::ForCurrentProcess()->HasSwitch(
+ switches::kEnableOpenMax) &&
+ !media::InitializeOpenMaxLibrary(FilePath())) {
+ std::cout << "Unable to initialize OpenMAX library."<< std::endl;
+ return false;
+ }
+
// Load media libraries.
if (!media::InitializeMediaLibrary(FilePath())) {
std::cout << "Unable to initialize the media library." << std::endl;