[vlc-commits] iomx: Implement OMX_GetComponentsOfRole, too

Martin Storsjö git at videolan.org
Fri Apr 13 16:57:50 CEST 2012


vlc | branch: master | Martin Storsjö <martin at martin.st> | Thu Apr 12 12:09:41 2012 +0300| [d822f6755a8dcfbb2bcf3acb1f7a875082469575] | committer: Jean-Baptiste Kempf

iomx: Implement OMX_GetComponentsOfRole, too

This isn't used by the vlc omxil module, but can be used by other
applications using the same iomx wrapper library.

Signed-off-by: Jean-Baptiste Kempf <jb at videolan.org>

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=d822f6755a8dcfbb2bcf3acb1f7a875082469575
---

 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;
+}
 }
 



More information about the vlc-commits mailing list