summaryrefslogtreecommitdiff
path: root/libstagefrighthw
diff options
context:
space:
mode:
authorAndreas Huber <andih@google.com>2009-12-04 12:34:03 -0800
committerAndreas Huber <andih@google.com>2009-12-04 12:34:03 -0800
commitf40810585b61295f84d7d6b4e63ef935222bf18e (patch)
tree472824fbb3139afad9a01c6d2e330605a3b117c5 /libstagefrighthw
parent17e995d39771569792c528f3dea559c83f0fc238 (diff)
downloadomap3-f40810585b61295f84d7d6b4e63ef935222bf18e.tar.gz
Support for properly freeing an OMX node instance, now that the API for it exists.
Diffstat (limited to 'libstagefrighthw')
-rw-r--r--libstagefrighthw/TIOMXPlugin.cpp13
-rw-r--r--libstagefrighthw/TIOMXPlugin.h6
2 files changed, 18 insertions, 1 deletions
diff --git a/libstagefrighthw/TIOMXPlugin.cpp b/libstagefrighthw/TIOMXPlugin.cpp
index bc0f4d7..11e4ff6 100644
--- a/libstagefrighthw/TIOMXPlugin.cpp
+++ b/libstagefrighthw/TIOMXPlugin.cpp
@@ -31,7 +31,8 @@ TIOMXPlugin::TIOMXPlugin()
mInit(NULL),
mDeinit(NULL),
mComponentNameEnum(NULL),
- mGetHandle(NULL) {
+ mGetHandle(NULL),
+ mFreeHandle(NULL) {
if (mLibHandle != NULL) {
mInit = (InitFunc)dlsym(mLibHandle, "TIOMX_Init");
mDeinit = (DeinitFunc)dlsym(mLibHandle, "TIOMX_DeInit");
@@ -40,6 +41,7 @@ TIOMXPlugin::TIOMXPlugin()
(ComponentNameEnumFunc)dlsym(mLibHandle, "TIOMX_ComponentNameEnum");
mGetHandle = (GetHandleFunc)dlsym(mLibHandle, "TIOMX_GetHandle");
+ mFreeHandle = (FreeHandleFunc)dlsym(mLibHandle, "TIOMX_FreeHandle");
(*mInit)();
}
@@ -69,6 +71,15 @@ OMX_ERRORTYPE TIOMXPlugin::makeComponentInstance(
appData, const_cast<OMX_CALLBACKTYPE *>(callbacks));
}
+OMX_ERRORTYPE TIOMXPlugin::destroyComponentInstance(
+ OMX_COMPONENTTYPE *component) {
+ if (mLibHandle == NULL) {
+ return OMX_ErrorUndefined;
+ }
+
+ return (*mFreeHandle)(reinterpret_cast<OMX_HANDLETYPE *>(component));
+}
+
OMX_ERRORTYPE TIOMXPlugin::enumerateComponents(
OMX_STRING name,
size_t size,
diff --git a/libstagefrighthw/TIOMXPlugin.h b/libstagefrighthw/TIOMXPlugin.h
index 2bd4a80..8255e58 100644
--- a/libstagefrighthw/TIOMXPlugin.h
+++ b/libstagefrighthw/TIOMXPlugin.h
@@ -32,6 +32,9 @@ struct TIOMXPlugin : public OMXPluginBase {
OMX_PTR appData,
OMX_COMPONENTTYPE **component);
+ virtual OMX_ERRORTYPE destroyComponentInstance(
+ OMX_COMPONENTTYPE *component);
+
virtual OMX_ERRORTYPE enumerateComponents(
OMX_STRING name,
size_t size,
@@ -48,10 +51,13 @@ private:
typedef OMX_ERRORTYPE (*GetHandleFunc)(
OMX_HANDLETYPE *, OMX_STRING, OMX_PTR, OMX_CALLBACKTYPE *);
+ typedef OMX_ERRORTYPE (*FreeHandleFunc)(OMX_HANDLETYPE *);
+
InitFunc mInit;
DeinitFunc mDeinit;
ComponentNameEnumFunc mComponentNameEnum;
GetHandleFunc mGetHandle;
+ FreeHandleFunc mFreeHandle;
TIOMXPlugin(const TIOMXPlugin &);
TIOMXPlugin &operator=(const TIOMXPlugin &);