[Gstreamer-openmax] [PATCH 09/10] add component-role support
Rob Clark
rob at ti.com
Sun Mar 7 15:14:56 PST 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 e35ef3d..e199cce 100644
--- a/omx/gstomx.c
+++ b/omx/gstomx.c
@@ -233,7 +233,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;
@@ -242,6 +242,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)
@@ -316,6 +317,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;
}
@@ -328,6 +332,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",
@@ -343,6 +352,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 7557fd4..da66c81 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_LAST_COMMON_PROP
};
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index 565bdda..513ab6d 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -310,8 +310,10 @@ g_omx_core_init (GOmxCore *core)
if (core->omx_handle)
return;
- 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);
@@ -327,7 +329,23 @@ g_omx_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);
+
+ g_omx_core_set_param (core, OMX_IndexParamStandardComponentRole, ¶m);
+ }
+ }
}
void
@@ -354,6 +372,7 @@ g_omx_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 c647998..64360b9 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