diff options
-rw-r--r-- | build/all.gyp | 5 | ||||
-rw-r--r-- | media/media.gyp | 15 | ||||
-rw-r--r-- | media/omx/omx_test.cc | 3 | ||||
-rw-r--r-- | media/omx/omx_test.gyp | 30 | ||||
-rw-r--r-- | media/omx/omx_video_decoder.cc | 8 | ||||
-rw-r--r-- | third_party/openmax/omx_stub.cc | 36 | ||||
-rw-r--r-- | third_party/openmax/openmax.gyp | 52 |
7 files changed, 100 insertions, 49 deletions
diff --git a/build/all.gyp b/build/all.gyp index 3a94e7c..9223569 100644 --- a/build/all.gyp +++ b/build/all.gyp @@ -57,11 +57,6 @@ '../gpu/gpu.gyp:*', ], }], - ['enable_openmax==1', { - 'dependencies': [ - '../media/omx/omx_test.gyp:*', - ], - }], ['OS=="mac" or OS=="linux" or OS=="freebsd"', { 'dependencies': [ '../third_party/yasm/yasm.gyp:*#host', diff --git a/media/media.gyp b/media/media.gyp index 4b5c13f..14c41b9 100644 --- a/media/media.gyp +++ b/media/media.gyp @@ -238,6 +238,21 @@ 'tools/qt_faststart.c' ], }, + { + 'target_name': 'omx_test', + 'type': 'executable', + 'dependencies': [ + '../base/base.gyp:base', + '../third_party/openmax/openmax.gyp:il', + ], + 'sources': [ + 'omx/input_buffer.cc', + 'omx/input_buffer.h', + 'omx/omx_test.cc', + 'omx/omx_video_decoder.cc', + 'omx/omx_video_decoder.h', + ], + }, ], 'conditions': [ ['OS=="win"', { diff --git a/media/omx/omx_test.cc b/media/omx/omx_test.cc index 306a2fd..bb4ffd2 100644 --- a/media/omx/omx_test.cc +++ b/media/omx/omx_test.cc @@ -12,6 +12,7 @@ #include "base/at_exit.h" #include "base/command_line.h" +#include "base/file_util.h" #include "base/message_loop.h" #include "base/scoped_ptr.h" #include "media/omx/input_buffer.h" @@ -89,7 +90,7 @@ class TestApp { void Run() { // Open the input file. - file_ = fopen(filename_, "rb"); + file_ = file_util::OpenFile(filename_, "rb"); if (!file_) { printf("Error - can't open file %s\n", filename_); return; diff --git a/media/omx/omx_test.gyp b/media/omx/omx_test.gyp deleted file mode 100644 index 0e2fcaa..0000000 --- a/media/omx/omx_test.gyp +++ /dev/null @@ -1,30 +0,0 @@ -# Copyright (c) 2009 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. - -{ - 'variables': { - 'chromium_code': 1, - }, - 'conditions': [ - ['OS=="linux"', { - 'targets' : [ - { - 'target_name': 'omx_test', - 'type': 'executable', - 'dependencies': [ - '../../base/base.gyp:base', - '../../third_party/openmax/openmax.gyp:il', - ], - 'sources': [ - 'input_buffer.cc', - 'input_buffer.h', - 'omx_test.cc', - 'omx_video_decoder.cc', - 'omx_video_decoder.h', - ], - }, - ], - }], - ], -} diff --git a/media/omx/omx_video_decoder.cc b/media/omx/omx_video_decoder.cc index b5857ed..cdf0d5d 100644 --- a/media/omx/omx_video_decoder.cc +++ b/media/omx/omx_video_decoder.cc @@ -271,7 +271,6 @@ void OmxVideoDecoder::Transition_EmptyToLoaded() { DCHECK_EQ(message_loop_, MessageLoop::current()); DCHECK_EQ(kEmpty, GetState()); - const char* component; OMX_CALLBACKTYPE callback = { &EventHandler, &EmptyBufferCallback, &FillBufferCallback }; @@ -288,9 +287,10 @@ void OmxVideoDecoder::Transition_EmptyToLoaded() { // 2. Get the handle to the component. After OMX_GetHandle(), // the component is in loaded state. // TODO(hclam): We should have a list of componant names instead. - component = component_; - omxresult = OMX_GetHandle((OMX_HANDLETYPE*)(&decoder_handle_), - (OMX_STRING)component, this, &callback); + OMX_STRING component = const_cast<OMX_STRING>(component_); + OMX_HANDLETYPE handle = reinterpret_cast<OMX_HANDLETYPE>(decoder_handle_); + omxresult = OMX_GetHandle(&handle, component, this, &callback); + decoder_handle_ = reinterpret_cast<OMX_COMPONENTTYPE*>(handle); if (omxresult != OMX_ErrorNone) { LOG(ERROR) << "Failed to Load the component: " << component; StateTransitionTask(kError); diff --git a/third_party/openmax/omx_stub.cc b/third_party/openmax/omx_stub.cc new file mode 100644 index 0000000..a2a7526 --- /dev/null +++ b/third_party/openmax/omx_stub.cc @@ -0,0 +1,36 @@ +// Copyright (c) 2009 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. + +// Satisfies linker dependencies for targets requiring an OpenMAX Core library. +// Not intended in any way to be functional!! + +#include <OMX_Core.h> + +#define NOTIMPLEMENTED_POLICY 3 // Fail at runtime via DCHECK. +#include "base/logging.h" + +extern "C" { + +OMX_API OMX_ERRORTYPE OMX_Init() { + NOTIMPLEMENTED(); + return OMX_ErrorNotImplemented; +} + +OMX_API OMX_ERRORTYPE OMX_Deinit() { + NOTIMPLEMENTED(); + return OMX_ErrorNotImplemented; +} + +OMX_API OMX_ERRORTYPE OMX_GetHandle(OMX_HANDLETYPE*, OMX_STRING, OMX_PTR, + OMX_CALLBACKTYPE*) { + NOTIMPLEMENTED(); + return OMX_ErrorNotImplemented; +} + +OMX_API OMX_ERRORTYPE OMX_FreeHandle(OMX_HANDLETYPE) { + NOTIMPLEMENTED(); + return OMX_ErrorNotImplemented; +}; + +} // extern "C" diff --git a/third_party/openmax/openmax.gyp b/third_party/openmax/openmax.gyp index aeca369..53929ba 100644 --- a/third_party/openmax/openmax.gyp +++ b/third_party/openmax/openmax.gyp @@ -3,11 +3,46 @@ # found in the LICENSE file. { + 'variables': { + 'use_system_openmax%': 0, + }, + 'target_defaults': { + 'conditions': [ + ['use_system_openmax==0', { + 'type': '<(library)', + 'dependencies': [ + '../../base/base.gyp:base', + ], + 'sources': [ + 'omx_stub.cc', + ], + 'include_dirs': [ + 'il', + ], + 'defines': [ + '__OMX_EXPORTS', + ], + 'direct_dependent_settings': { + 'defines': [ + '__OMX_EXPORTS', + ], + }, + },{ + 'type': 'none', + 'direct_dependent_settings': { + 'link_settings': { + 'libraries': [ + '-lOmxCore', + ], + }, + }, + }], + ], + }, 'targets': [ { # OpenMAX IL level of API. 'target_name': 'il', - 'type': 'none', 'sources': [ 'il/OMX_Audio.h', 'il/OMX_Component.h', @@ -24,14 +59,13 @@ 'include_dirs': [ 'il', ], - 'link_settings': { - 'libraries': [ - '-lOmxCore', - # We need dl for dlopen() and friends. - '-ldl', - ], - }, }, }, - ], + ], } + +# Local Variables: +# tab-width:2 +# indent-tabs-mode:nil +# End: +# vim: set expandtab tabstop=2 shiftwidth=2: |