summaryrefslogtreecommitdiff
path: root/libstagefrighthw
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2009-12-15 15:25:34 -0800
committerAndreas Huber <andih@google.com>2009-12-15 15:25:34 -0800
commit6239f8a9287b511c2a7e417979ca5299a15436bc (patch)
treec58b577623d8b13a2cc2ba9f5c8695ea59a7e536 /libstagefrighthw
parent20d52a65fa6514b85c6ce8e3964799bd97868f86 (diff)
downloadomap3-6239f8a9287b511c2a7e417979ca5299a15436bc.tar.gz
Implement new getRoles API for this platform.
Diffstat (limited to 'libstagefrighthw')
-rw-r--r--libstagefrighthw/TIOMXPlugin.cpp53
-rw-r--r--libstagefrighthw/TIOMXPlugin.h8
2 files changed, 60 insertions, 1 deletions
diff --git a/libstagefrighthw/TIOMXPlugin.cpp b/libstagefrighthw/TIOMXPlugin.cpp
index 11e4ff6..d820532 100644
--- a/libstagefrighthw/TIOMXPlugin.cpp
+++ b/libstagefrighthw/TIOMXPlugin.cpp
@@ -19,6 +19,7 @@
#include <dlfcn.h>
#include <media/stagefright/HardwareAPI.h>
+#include <media/stagefright/MediaDebug.h>
namespace android {
@@ -32,7 +33,8 @@ TIOMXPlugin::TIOMXPlugin()
mDeinit(NULL),
mComponentNameEnum(NULL),
mGetHandle(NULL),
- mFreeHandle(NULL) {
+ mFreeHandle(NULL),
+ mGetRolesOfComponentHandle(NULL) {
if (mLibHandle != NULL) {
mInit = (InitFunc)dlsym(mLibHandle, "TIOMX_Init");
mDeinit = (DeinitFunc)dlsym(mLibHandle, "TIOMX_DeInit");
@@ -43,6 +45,10 @@ TIOMXPlugin::TIOMXPlugin()
mGetHandle = (GetHandleFunc)dlsym(mLibHandle, "TIOMX_GetHandle");
mFreeHandle = (FreeHandleFunc)dlsym(mLibHandle, "TIOMX_FreeHandle");
+ mGetRolesOfComponentHandle =
+ (GetRolesOfComponentFunc)dlsym(
+ mLibHandle, "TIOMX_GetRolesOfComponent");
+
(*mInit)();
}
}
@@ -91,4 +97,49 @@ OMX_ERRORTYPE TIOMXPlugin::enumerateComponents(
return (*mComponentNameEnum)(name, size, index);
}
+OMX_ERRORTYPE TIOMXPlugin::getRolesOfComponent(
+ const char *name,
+ Vector<String8> *roles) {
+ roles->clear();
+
+ if (mLibHandle == NULL) {
+ return OMX_ErrorUndefined;
+ }
+
+ OMX_U32 numRoles;
+ OMX_ERRORTYPE err = (*mGetRolesOfComponentHandle)(
+ const_cast<OMX_STRING>(name), &numRoles, NULL);
+
+ if (err != OMX_ErrorNone) {
+ return err;
+ }
+
+ if (numRoles > 0) {
+ OMX_U8 **array = new OMX_U8 *[numRoles];
+ for (OMX_U32 i = 0; i < numRoles; ++i) {
+ array[i] = new OMX_U8[OMX_MAX_STRINGNAME_SIZE];
+ }
+
+ OMX_U32 numRoles2;
+ err = (*mGetRolesOfComponentHandle)(
+ const_cast<OMX_STRING>(name), &numRoles2, array);
+
+ CHECK_EQ(err, OMX_ErrorNone);
+ CHECK_EQ(numRoles, numRoles2);
+
+ for (OMX_U32 i = 0; i < numRoles; ++i) {
+ String8 s((const char *)array[i]);
+ roles->push(s);
+
+ delete[] array[i];
+ array[i] = NULL;
+ }
+
+ delete[] array;
+ array = NULL;
+ }
+
+ return OMX_ErrorNone;
+}
+
} // namespace android
diff --git a/libstagefrighthw/TIOMXPlugin.h b/libstagefrighthw/TIOMXPlugin.h
index 8255e58..668c5ef 100644
--- a/libstagefrighthw/TIOMXPlugin.h
+++ b/libstagefrighthw/TIOMXPlugin.h
@@ -40,6 +40,10 @@ struct TIOMXPlugin : public OMXPluginBase {
size_t size,
OMX_U32 index);
+ virtual OMX_ERRORTYPE getRolesOfComponent(
+ const char *name,
+ Vector<String8> *roles);
+
private:
void *mLibHandle;
@@ -53,11 +57,15 @@ private:
typedef OMX_ERRORTYPE (*FreeHandleFunc)(OMX_HANDLETYPE *);
+ typedef OMX_ERRORTYPE (*GetRolesOfComponentFunc)(
+ OMX_STRING, OMX_U32 *, OMX_U8 **);
+
InitFunc mInit;
DeinitFunc mDeinit;
ComponentNameEnumFunc mComponentNameEnum;
GetHandleFunc mGetHandle;
FreeHandleFunc mFreeHandle;
+ GetRolesOfComponentFunc mGetRolesOfComponentHandle;
TIOMXPlugin(const TIOMXPlugin &);
TIOMXPlugin &operator=(const TIOMXPlugin &);