[Gstreamer-openmax] [PATCH 5/8] Add component-role support

Rob Clark rob at ti.com
Wed Mar 17 16:58:58 PDT 2010


---
 omx/gstomx.c      |   14 +++++++++++++-
 omx/gstomx.h      |    1 +
 omx/gstomx_util.c |   23 +++++++++++++++++++++--
 omx/gstomx_util.h |    1 +
 4 files changed, 36 insertions(+), 3 deletions(-)

diff --git a/omx/gstomx.c b/omx/gstomx.c
index 86db3c3..70a789f 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -247,7 +247,7 @@ plugin_init (GstPlugin *plugin)
         const gchar *element_name = gst_structure_nth_field_name (element_table, i);
         GstStructure *element = get_element_entry (element_name);
         const gchar *type_name, *parent_type_name;
-        const gchar *component_name, *library_name;
+        const gchar *component_name, *component_role, *library_name;
         GType type;
         gint rank;
 
@@ -256,6 +256,7 @@ plugin_init (GstPlugin *plugin)
         parent_type_name = gst_structure_get_string (element, "parent-type");
         type_name = gst_structure_get_string (element, "type");
         component_name = gst_structure_get_string (element, "component-name");
+        component_role = gst_structure_get_string (element, "component-role");
         library_name = gst_structure_get_string (element, "library-name");
 
         if (!type_name || !component_name || !library_name)
@@ -330,6 +331,9 @@ gstomx_get_component_info (void *core,
     str = gst_structure_get_string (element, "component-name");
     rcore->component_name = g_strdup (str);
 
+    str = gst_structure_get_string (element, "component-role");
+    rcore->component_role = g_strdup (str);
+
     return TRUE;
 }
 
@@ -342,6 +346,11 @@ gstomx_install_property_helper (GObjectClass *gobject_class)
                                                           "Name of the OpenMAX IL component to use",
                                                           NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
 
+    g_object_class_install_property (gobject_class, ARG_COMPONENT_ROLE,
+                                     g_param_spec_string ("component-role", "Component role",
+                                                          "Role of the OpenMAX IL component",
+                                                          NULL, G_PARAM_READABLE | G_PARAM_STATIC_STRINGS));
+
     g_object_class_install_property (gobject_class, ARG_LIBRARY_NAME,
                                      g_param_spec_string ("library-name", "Library name",
                                                           "Name of the OpenMAX IL implementation library to use",
@@ -357,6 +366,9 @@ gstomx_get_property_helper (void *core, guint prop_id, GValue *value)
         case ARG_COMPONENT_NAME:
             g_value_set_string (value, gomx->component_name);
             return TRUE;
+        case ARG_COMPONENT_ROLE:
+            g_value_set_string (value, gomx->component_role);
+            return TRUE;
         case ARG_LIBRARY_NAME:
             g_value_set_string (value, gomx->library_name);
             return TRUE;
diff --git a/omx/gstomx.h b/omx/gstomx.h
index 20414cb..1ef73f2 100644
--- a/omx/gstomx.h
+++ b/omx/gstomx.h
@@ -34,6 +34,7 @@ enum
 {
     GSTOMX_ARG_0,
     ARG_COMPONENT_NAME,
+    ARG_COMPONENT_ROLE,
     ARG_LIBRARY_NAME,
     GSTOMX_NUM_COMMON_PROP
 };
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index bbf699b..103c919 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -320,8 +320,10 @@ g_omx_core_free (GOmxCore *core)
 static void
 core_init (GOmxCore *core)
 {
-    GST_DEBUG_OBJECT (core->object, "loading: %s (%s)",
-            core->component_name, core->library_name);
+    GST_DEBUG_OBJECT (core->object, "loading: %s %s (%s)",
+            core->component_name,
+            core->component_role ? core->component_role : "",
+            core->library_name);
 
     core->imp = request_imp (core->library_name);
 
@@ -337,7 +339,23 @@ core_init (GOmxCore *core)
             core->omx_handle, core->omx_error);
 
     if (!core->omx_error)
+    {
         core->omx_state = OMX_StateLoaded;
+
+        if (core->component_role)
+        {
+            OMX_PARAM_COMPONENTROLETYPE param;
+
+            GST_DEBUG_OBJECT (core->object, "setting component role: %s",
+                    core->component_role);
+
+            G_OMX_INIT_PARAM (param);
+
+            strcpy((char*)param.cRole, core->component_role);
+
+            OMX_SetParameter (core->omx_handle, OMX_IndexParamStandardComponentRole, &param);
+        }
+    }
 }
 
 static void
@@ -364,6 +382,7 @@ core_deinit (GOmxCore *core)
 
     g_free (core->library_name);
     g_free (core->component_name);
+    g_free (core->component_role);
 
     release_imp (core->imp);
     core->imp = NULL;
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index 8608a66..19047da 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -94,6 +94,7 @@ struct GOmxCore
 
     gchar *library_name;
     gchar *component_name;
+    gchar *component_role;
 };
 
 struct GOmxPort
-- 
1.6.3.2





More information about the Gstreamer-openmax mailing list