[vlc-commits] omxil: Add a prefix to the iomx function symbols
Martin Storsjö
git at videolan.org
Wed Jan 25 00:26:05 CET 2012
vlc | branch: master | Martin Storsjö <martin at martin.st> | Tue Jan 24 09:27:36 2012 +0200| [3c34f80809b89ebb581a76763b8c9e7f58568942] | committer: Rafaël Carré
omxil: Add a prefix to the iomx function symbols
On some devices (apparently froyo and earlier), some OMX core
(with sw-only codecs) already is loaded into the process, and
dlsym(RTLD_DEFAULT) can just as well return functions from that
one instead of the ones from the iomx wrapper that we've loaded.
This makes sure we really get the functions we want.
Signed-off-by: Rafaël Carré <funman at videolan.org>
> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=3c34f80809b89ebb581a76763b8c9e7f58568942
---
modules/codec/omxil/iomx.cpp | 16 ++++++++++------
modules/codec/omxil/omxil.c | 2 +-
2 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/modules/codec/omxil/iomx.cpp b/modules/codec/omxil/iomx.cpp
index ccc4abb..1316c0b 100644
--- a/modules/codec/omxil/iomx.cpp
+++ b/modules/codec/omxil/iomx.cpp
@@ -29,6 +29,8 @@
#include <binder/MemoryDealer.h>
#include <OMX_Component.h>
+#define PREFIX(x) I ## x
+
using namespace android;
class IOMXContext {
@@ -270,7 +272,8 @@ static OMX_ERRORTYPE iomx_set_config(OMX_HANDLETYPE component, OMX_INDEXTYPE ind
return get_error(ctx->iomx->setConfig(node->node, index, param, sizeof(OMX_BOOL)));
}
-OMX_ERRORTYPE OMX_GetHandle(OMX_HANDLETYPE *handle_ptr, OMX_STRING component_name, OMX_PTR app_data, OMX_CALLBACKTYPE *callbacks)
+extern "C" {
+OMX_ERRORTYPE PREFIX(OMX_GetHandle)(OMX_HANDLETYPE *handle_ptr, OMX_STRING component_name, OMX_PTR app_data, OMX_CALLBACKTYPE *callbacks)
{
OMXNode* node = new OMXNode();
node->app_data = app_data;
@@ -308,7 +311,7 @@ OMX_ERRORTYPE OMX_GetHandle(OMX_HANDLETYPE *handle_ptr, OMX_STRING component_nam
return OMX_ErrorNone;
}
-OMX_ERRORTYPE OMX_FreeHandle(OMX_HANDLETYPE handle)
+OMX_ERRORTYPE PREFIX(OMX_FreeHandle)(OMX_HANDLETYPE handle)
{
OMXNode* node = (OMXNode*) ((OMX_COMPONENTTYPE*)handle)->pComponentPrivate;
ctx->iomx->freeNode( node->node );
@@ -318,7 +321,7 @@ OMX_ERRORTYPE OMX_FreeHandle(OMX_HANDLETYPE handle)
return OMX_ErrorNone;
}
-OMX_ERRORTYPE OMX_Init(void)
+OMX_ERRORTYPE PREFIX(OMX_Init)(void)
{
OMXClient client;
if (client.connect() != OK)
@@ -331,7 +334,7 @@ OMX_ERRORTYPE OMX_Init(void)
return OMX_ErrorNone;
}
-OMX_ERRORTYPE OMX_Deinit(void)
+OMX_ERRORTYPE PREFIX(OMX_Deinit)(void)
{
ctx->iomx = NULL;
delete ctx;
@@ -339,7 +342,7 @@ OMX_ERRORTYPE OMX_Deinit(void)
return OMX_ErrorNone;
}
-OMX_ERRORTYPE OMX_ComponentNameEnum(OMX_STRING component_name, OMX_U32 name_length, OMX_U32 index)
+OMX_ERRORTYPE PREFIX(OMX_ComponentNameEnum)(OMX_STRING component_name, OMX_U32 name_length, OMX_U32 index)
{
if (index >= ctx->components.size())
return OMX_ErrorNoMore;
@@ -351,7 +354,7 @@ OMX_ERRORTYPE OMX_ComponentNameEnum(OMX_STRING component_name, OMX_U32 name_leng
return OMX_ErrorNone;
}
-OMX_ERRORTYPE OMX_GetRolesOfComponent(OMX_STRING component_name, OMX_U32 *num_roles, OMX_U8 **roles)
+OMX_ERRORTYPE PREFIX(OMX_GetRolesOfComponent)(OMX_STRING component_name, OMX_U32 *num_roles, OMX_U8 **roles)
{
for( List<IOMX::ComponentInfo>::iterator it = ctx->components.begin(); it != ctx->components.end(); it++ ) {
if (!strcmp(component_name, it->mName.string())) {
@@ -372,4 +375,5 @@ OMX_ERRORTYPE OMX_GetRolesOfComponent(OMX_STRING component_name, OMX_U32 *num_ro
}
return OMX_ErrorInvalidComponentName;
}
+}
diff --git a/modules/codec/omxil/omxil.c b/modules/codec/omxil/omxil.c
index ef8982b..3c13a73 100644
--- a/modules/codec/omxil/omxil.c
+++ b/modules/codec/omxil/omxil.c
@@ -33,7 +33,7 @@
/* On dll_open, just check that the OMX_Init symbol already is loaded */
# define dll_open(name) dlsym(RTLD_DEFAULT, "OMX_Init")
# define dll_close(handle) do { } while (0)
-# define dlsym(handle, name) dlsym(RTLD_DEFAULT, name)
+# define dlsym(handle, name) dlsym(RTLD_DEFAULT, "I" name)
#else
# define dll_open(name) dlopen( name, RTLD_NOW )
# define dll_close(handle) dlclose(handle)
More information about the vlc-commits
mailing list