[Gstreamer-openmax] [PATCH 1/5] Move component and library name fields to 'util'
Felipe Contreras
felipe.contreras at nokia.com
Wed Mar 3 14:51:11 PST 2010
No need to duplicate these, and also will be helpful for upcoming
commits.
Signed-off-by: Felipe Contreras <felipe.contreras at nokia.com>
---
omx/gstomx_base_filter.c | 21 +++++++++------------
omx/gstomx_base_filter.h | 2 --
omx/gstomx_base_sink.c | 21 +++++++++------------
omx/gstomx_base_sink.h | 3 ---
omx/gstomx_base_src.c | 28 +++++++++-------------------
omx/gstomx_base_src.h | 2 --
omx/gstomx_util.c | 11 ++++++-----
omx/gstomx_util.h | 5 ++++-
8 files changed, 37 insertions(+), 56 deletions(-)
diff --git a/omx/gstomx_base_filter.c b/omx/gstomx_base_filter.c
index b0353cb..fd3f071 100644
--- a/omx/gstomx_base_filter.c
+++ b/omx/gstomx_base_filter.c
@@ -115,7 +115,7 @@ change_state (GstElement *element,
switch (transition)
{
case GST_STATE_CHANGE_NULL_TO_READY:
- g_omx_core_init (core, self->omx_library, self->omx_component);
+ g_omx_core_init (core);
if (core->omx_state != OMX_StateLoaded)
{
ret = GST_STATE_CHANGE_FAILURE;
@@ -184,9 +184,6 @@ finalize (GObject *obj)
g_omx_core_free (self->gomx);
- g_free (self->omx_component);
- g_free (self->omx_library);
-
g_mutex_free (self->ready_lock);
G_OBJECT_CLASS (parent_class)->finalize (obj);
@@ -205,12 +202,12 @@ set_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_free (self->omx_component);
- self->omx_component = g_value_dup_string (value);
+ g_free (self->gomx->component_name);
+ self->gomx->component_name = g_value_dup_string (value);
break;
case ARG_LIBRARY_NAME:
- g_free (self->omx_library);
- self->omx_library = g_value_dup_string (value);
+ g_free (self->gomx->library_name);
+ self->gomx->library_name = g_value_dup_string (value);
break;
case ARG_USE_TIMESTAMPS:
self->use_timestamps = g_value_get_boolean (value);
@@ -234,10 +231,10 @@ get_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_value_set_string (value, self->omx_component);
+ g_value_set_string (value, self->gomx->component_name);
break;
case ARG_LIBRARY_NAME:
- g_value_set_string (value, self->omx_library);
+ g_value_set_string (value, self->gomx->library_name);
break;
case ARG_USE_TIMESTAMPS:
g_value_set_boolean (value, self->use_timestamps);
@@ -926,10 +923,10 @@ type_instance_init (GTypeInstance *instance,
const char *tmp;
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("library-name"));
- self->omx_library = g_strdup (tmp);
+ self->gomx->library_name = g_strdup (tmp);
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("component-name"));
- self->omx_component = g_strdup (tmp);
+ self->gomx->component_name = g_strdup (tmp);
}
GST_LOG_OBJECT (self, "end");
diff --git a/omx/gstomx_base_filter.h b/omx/gstomx_base_filter.h
index 4baf181..99b5d72 100644
--- a/omx/gstomx_base_filter.h
+++ b/omx/gstomx_base_filter.h
@@ -48,8 +48,6 @@ struct GstOmxBaseFilter
GOmxPort *in_port;
GOmxPort *out_port;
- char *omx_component;
- char *omx_library;
gboolean use_timestamps; /** @todo remove; timestamps should always be used */
gboolean ready;
GMutex *ready_lock;
diff --git a/omx/gstomx_base_sink.c b/omx/gstomx_base_sink.c
index c1a2076..5afb11d 100644
--- a/omx/gstomx_base_sink.c
+++ b/omx/gstomx_base_sink.c
@@ -141,9 +141,6 @@ finalize (GObject *obj)
g_omx_core_free (self->gomx);
- g_free (self->omx_component);
- g_free (self->omx_library);
-
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
@@ -299,12 +296,12 @@ set_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_free (self->omx_component);
- self->omx_component = g_value_dup_string (value);
+ g_free (self->gomx->component_name);
+ self->gomx->component_name = g_value_dup_string (value);
break;
case ARG_LIBRARY_NAME:
- g_free (self->omx_library);
- self->omx_library = g_value_dup_string (value);
+ g_free (self->gomx->library_name);
+ self->gomx->library_name = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -325,10 +322,10 @@ get_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_value_set_string (value, self->omx_component);
+ g_value_set_string (value, self->gomx->component_name);
break;
case ARG_LIBRARY_NAME:
- g_value_set_string (value, self->omx_library);
+ g_value_set_string (value, self->gomx->library_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -420,7 +417,7 @@ activate_push (GstPad *pad,
static inline gboolean
omx_init (GstOmxBaseSink *self)
{
- g_omx_core_init (self->gomx, self->omx_library, self->omx_component);
+ g_omx_core_init (self->gomx);
if (self->gomx->omx_error)
return FALSE;
@@ -471,10 +468,10 @@ type_instance_init (GTypeInstance *instance,
const char *tmp;
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("library-name"));
- self->omx_library = g_strdup (tmp);
+ self->gomx->library_name = g_strdup (tmp);
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("component-name"));
- self->omx_component = g_strdup (tmp);
+ self->gomx->component_name = g_strdup (tmp);
}
{
diff --git a/omx/gstomx_base_sink.h b/omx/gstomx_base_sink.h
index 681e939..589c441 100644
--- a/omx/gstomx_base_sink.h
+++ b/omx/gstomx_base_sink.h
@@ -46,9 +46,6 @@ struct GstOmxBaseSink
GOmxCore *gomx;
GOmxPort *in_port;
- char *omx_component;
- char *omx_library;
-
gboolean ready;
GstPadActivateModeFunction base_activatepush;
gboolean initialized;
diff --git a/omx/gstomx_base_src.c b/omx/gstomx_base_src.c
index 9b02b22..4e67a71 100644
--- a/omx/gstomx_base_src.c
+++ b/omx/gstomx_base_src.c
@@ -67,7 +67,7 @@ start (GstBaseSrc *gst_base)
GST_LOG_OBJECT (self, "begin");
- g_omx_core_init (self->gomx, self->omx_library, self->omx_component);
+ g_omx_core_init (self->gomx);
if (self->gomx->omx_error)
return GST_STATE_CHANGE_FAILURE;
@@ -106,9 +106,6 @@ finalize (GObject *obj)
g_omx_core_free (self->gomx);
- g_free (self->omx_component);
- g_free (self->omx_library);
-
G_OBJECT_CLASS (parent_class)->finalize (obj);
}
@@ -363,18 +360,12 @@ set_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- if (self->omx_component)
- {
- g_free (self->omx_component);
- }
- self->omx_component = g_value_dup_string (value);
+ g_free (self->gomx->component_name);
+ self->gomx->component_name = g_value_dup_string (value);
break;
case ARG_LIBRARY_NAME:
- if (self->omx_library)
- {
- g_free (self->omx_library);
- }
- self->omx_library = g_value_dup_string (value);
+ g_free (self->gomx->library_name);
+ self->gomx->library_name = g_value_dup_string (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -395,10 +386,10 @@ get_property (GObject *obj,
switch (prop_id)
{
case ARG_COMPONENT_NAME:
- g_value_set_string (value, self->omx_component);
+ g_value_set_string (value, self->gomx->component_name);
break;
case ARG_LIBRARY_NAME:
- g_value_set_string (value, self->omx_library);
+ g_value_set_string (value, self->gomx->library_name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (obj, prop_id, pspec);
@@ -463,13 +454,12 @@ type_instance_init (GTypeInstance *instance,
const char *tmp;
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("library-name"));
- self->omx_library = g_strdup (tmp);
+ self->gomx->library_name = g_strdup (tmp);
tmp = g_type_get_qdata (G_OBJECT_CLASS_TYPE (g_class),
g_quark_from_static_string ("component-name"));
- self->omx_component = g_strdup (tmp);
+ self->gomx->component_name = g_strdup (tmp);
}
-
GST_LOG_OBJECT (self, "end");
}
diff --git a/omx/gstomx_base_src.h b/omx/gstomx_base_src.h
index 85e4c13..adab894 100644
--- a/omx/gstomx_base_src.h
+++ b/omx/gstomx_base_src.h
@@ -44,8 +44,6 @@ struct GstOmxBaseSrc
GOmxCore *gomx;
GOmxPort *out_port;
- char *omx_component;
- char *omx_library;
GstOmxBaseSrcCb setup_ports;
};
diff --git a/omx/gstomx_util.c b/omx/gstomx_util.c
index 39d900b..c61f849 100644
--- a/omx/gstomx_util.c
+++ b/omx/gstomx_util.c
@@ -301,17 +301,15 @@ g_omx_core_free (GOmxCore *core)
}
void
-g_omx_core_init (GOmxCore *core,
- const gchar *library_name,
- const gchar *component_name)
+g_omx_core_init (GOmxCore *core)
{
- core->imp = request_imp (library_name);
+ core->imp = request_imp (core->library_name);
if (!core->imp)
return;
core->omx_error = core->imp->sym_table.get_handle (&core->omx_handle,
- (char *) component_name,
+ (char *) core->component_name,
core,
&callbacks);
if (!core->omx_error)
@@ -331,6 +329,9 @@ g_omx_core_deinit (GOmxCore *core)
core->omx_error = core->imp->sym_table.free_handle (core->omx_handle);
}
+ g_free (core->library_name);
+ g_free (core->component_name);
+
release_imp (core->imp);
core->imp = NULL;
}
diff --git a/omx/gstomx_util.h b/omx/gstomx_util.h
index f0cf045..a4dc47b 100644
--- a/omx/gstomx_util.h
+++ b/omx/gstomx_util.h
@@ -91,6 +91,9 @@ struct GOmxCore
GOmxImp *imp;
gboolean done;
+
+ gchar *library_name;
+ gchar *component_name;
};
struct GOmxPort
@@ -116,7 +119,7 @@ void g_omx_deinit (void);
GOmxCore *g_omx_core_new (void);
void g_omx_core_free (GOmxCore *core);
-void g_omx_core_init (GOmxCore *core, const gchar *library_name, const gchar *component_name);
+void g_omx_core_init (GOmxCore *core);
void g_omx_core_deinit (GOmxCore *core);
void g_omx_core_prepare (GOmxCore *core);
void g_omx_core_start (GOmxCore *core);
--
1.7.0.1
More information about the Gstreamer-openmax
mailing list