[vlc-devel] [PATCH 1/2] iomx: Implement OMX_GetComponentsOfRole, too

Martin Storsjö martin at martin.st
Thu Apr 12 11:09:41 CEST 2012


This isn't used by the vlc omxil module, but can be used by other
applications using the same iomx wrapper library.
---
 modules/codec/omxil/iomx.cpp |   21 +++++++++++++++++++++
 1 files changed, 21 insertions(+), 0 deletions(-)

diff --git a/modules/codec/omxil/iomx.cpp b/modules/codec/omxil/iomx.cpp
index ef7ca42..9f42417 100644
--- a/modules/codec/omxil/iomx.cpp
+++ b/modules/codec/omxil/iomx.cpp
@@ -393,5 +393,26 @@ OMX_ERRORTYPE PREFIX(OMX_GetRolesOfComponent)(OMX_STRING component_name, OMX_U32
     }
     return OMX_ErrorInvalidComponentName;
 }
+
+OMX_ERRORTYPE PREFIX(OMX_GetComponentsOfRole)(OMX_STRING role, OMX_U32 *num_comps, OMX_U8 **comp_names)
+{
+    OMX_U32 i = 0;
+    for( List<IOMX::ComponentInfo>::iterator it = ctx->components.begin(); it != ctx->components.end(); it++ ) {
+        for( List<String8>::iterator it2 = it->mRoles.begin(); it2 != it->mRoles.end(); it2++ ) {
+            if (!strcmp(it2->string(), role)) {
+                if (comp_names) {
+                    if (*num_comps < i)
+                        return OMX_ErrorInsufficientResources;
+                    strncpy((char*)comp_names[i], it->mName.string(), OMX_MAX_STRINGNAME_SIZE);
+                    comp_names[i][OMX_MAX_STRINGNAME_SIZE - 1] = '\0';
+                }
+                i++;
+                break;
+            }
+        }
+    }
+    *num_comps = i;
+    return OMX_ErrorNone;
+}
 }
 
-- 
1.7.9




More information about the vlc-devel mailing list