From: Sebastian Dröge Date: Tue, 12 Feb 2013 10:49:21 +0000 (+0100) Subject: omx: Some minor refactoring and cleanup X-Git-Tag: 1.19.3~501^2~691 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=219a93bbaf944f484768f1ca1db949274aad3bbd;p=platform%2Fupstream%2Fgstreamer.git omx: Some minor refactoring and cleanup --- diff --git a/omx/gstomx.c b/omx/gstomx.c index d9e9f20..712cf33 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -554,13 +554,14 @@ static OMX_CALLBACKTYPE callbacks = /* NOTE: Uses comp->lock and comp->messages_lock */ GstOMXComponent * -gst_omx_component_new (GstObject * parent, const GstOMXClassData * cdata) +gst_omx_component_new (GstObject * parent, const gchar * core_name, + const gchar * component_name, const gchar * component_role, guint64 hacks) { OMX_ERRORTYPE err; GstOMXCore *core; GstOMXComponent *comp; - core = gst_omx_core_acquire (cdata->core_name); + core = gst_omx_core_acquire (core_name); if (!core) return NULL; @@ -568,21 +569,21 @@ gst_omx_component_new (GstObject * parent, const GstOMXClassData * cdata) comp->core = core; err = - core->get_handle (&comp->handle, (OMX_STRING) cdata->component_name, comp, + core->get_handle (&comp->handle, (OMX_STRING) component_name, comp, &callbacks); if (err != OMX_ErrorNone) { GST_ERROR_OBJECT (parent, "Failed to get component handle '%s' from core '%s': 0x%08x", - cdata->component_name, cdata->core_name, err); + component_name, core_name, err); gst_omx_core_release (core); g_slice_free (GstOMXComponent, comp); return NULL; } GST_DEBUG_OBJECT (parent, "Successfully got component handle %p (%s) from core '%s'", comp->handle, - cdata->component_name, cdata->core_name); + component_name, core_name); comp->parent = gst_object_ref (parent); - comp->hacks = cdata->hacks; + comp->hacks = hacks; comp->ports = g_ptr_array_new (); comp->n_in_ports = 0; @@ -597,19 +598,18 @@ gst_omx_component_new (GstObject * parent, const GstOMXClassData * cdata) comp->last_error = OMX_ErrorNone; /* Set component role if any */ - if (cdata->component_role && !(cdata->hacks & GST_OMX_HACK_NO_COMPONENT_ROLE)) { + if (component_role && !(hacks & GST_OMX_HACK_NO_COMPONENT_ROLE)) { OMX_PARAM_COMPONENTROLETYPE param; GST_OMX_INIT_STRUCT (¶m); - g_strlcpy ((gchar *) param.cRole, cdata->component_role, - sizeof (param.cRole)); + g_strlcpy ((gchar *) param.cRole, component_role, sizeof (param.cRole)); err = gst_omx_component_set_parameter (comp, OMX_IndexParamStandardComponentRole, ¶m); GST_DEBUG_OBJECT (parent, "Setting component role to '%s': %s (0x%08x)", - cdata->component_role, gst_omx_error_to_string (err), err); + component_role, gst_omx_error_to_string (err), err); /* If setting the role failed this component is unusable */ if (err != OMX_ErrorNone) { diff --git a/omx/gstomx.h b/omx/gstomx.h index 2e99b40..3337455 100644 --- a/omx/gstomx.h +++ b/omx/gstomx.h @@ -268,7 +268,7 @@ GstOMXCore * gst_omx_core_acquire (const gchar * filename); void gst_omx_core_release (GstOMXCore * core); -GstOMXComponent * gst_omx_component_new (GstObject * parent, const GstOMXClassData *cdata); +GstOMXComponent * gst_omx_component_new (GstObject * parent, const gchar *core_name, const gchar *component_name, const gchar * component_role, guint64 hacks); void gst_omx_component_free (GstOMXComponent * comp); OMX_ERRORTYPE gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state); diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c index 634f42a..8cf6083 100644 --- a/omx/gstomxaudioenc.c +++ b/omx/gstomxaudioenc.c @@ -105,7 +105,9 @@ gst_omx_audio_enc_open (GstOMXAudioEnc * self) GstOMXAudioEncClass *klass = GST_OMX_AUDIO_ENC_GET_CLASS (self); self->component = - gst_omx_component_new (GST_OBJECT_CAST (self), &klass->cdata); + gst_omx_component_new (GST_OBJECT_CAST (self), klass->cdata.core_name, + klass->cdata.component_name, klass->cdata.component_role, + klass->cdata.hacks); self->started = FALSE; if (!self->component) diff --git a/omx/gstomxaudioenc.h b/omx/gstomxaudioenc.h index e2d55d8..39b9bdc 100644 --- a/omx/gstomxaudioenc.h +++ b/omx/gstomxaudioenc.h @@ -50,7 +50,6 @@ struct _GstOMXAudioEnc GstAudioEncoder parent; /* < protected > */ - GstOMXCore *core; GstOMXComponent *component; GstOMXPort *in_port, *out_port; diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index 2a89c3c..7cf26a0 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -131,7 +131,9 @@ gst_omx_video_dec_open (GstVideoDecoder * decoder) GST_DEBUG_OBJECT (self, "Opening decoder"); self->component = - gst_omx_component_new (GST_OBJECT_CAST (self), &klass->cdata); + gst_omx_component_new (GST_OBJECT_CAST (self), klass->cdata.core_name, + klass->cdata.component_name, klass->cdata.component_role, + klass->cdata.hacks); self->started = FALSE; if (!self->component) diff --git a/omx/gstomxvideodec.h b/omx/gstomxvideodec.h index 7258a9c..7951a16 100644 --- a/omx/gstomxvideodec.h +++ b/omx/gstomxvideodec.h @@ -50,7 +50,6 @@ struct _GstOMXVideoDec GstVideoDecoder parent; /* < protected > */ - GstOMXCore *core; GstOMXComponent *component; GstOMXPort *in_port, *out_port; diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 4c3f94c..26ff995 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -220,7 +220,9 @@ gst_omx_video_enc_open (GstVideoEncoder * encoder) GstOMXVideoEncClass *klass = GST_OMX_VIDEO_ENC_GET_CLASS (self); self->component = - gst_omx_component_new (GST_OBJECT_CAST (self), &klass->cdata); + gst_omx_component_new (GST_OBJECT_CAST (self), klass->cdata.core_name, + klass->cdata.component_name, klass->cdata.component_role, + klass->cdata.hacks); self->started = FALSE; if (!self->component) diff --git a/omx/gstomxvideoenc.h b/omx/gstomxvideoenc.h index b4dc7af..43bee27 100644 --- a/omx/gstomxvideoenc.h +++ b/omx/gstomxvideoenc.h @@ -53,7 +53,6 @@ struct _GstOMXVideoEnc GstOMXClassData cdata; - GstOMXCore *core; GstOMXComponent *component; GstOMXPort *in_port, *out_port;