omx: Some minor refactoring and cleanup
authorSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 12 Feb 2013 10:49:21 +0000 (11:49 +0100)
committerSebastian Dröge <sebastian.droege@collabora.co.uk>
Tue, 12 Feb 2013 10:49:21 +0000 (11:49 +0100)
omx/gstomx.c
omx/gstomx.h
omx/gstomxaudioenc.c
omx/gstomxaudioenc.h
omx/gstomxvideodec.c
omx/gstomxvideodec.h
omx/gstomxvideoenc.c
omx/gstomxvideoenc.h

index d9e9f20..712cf33 100644 (file)
@@ -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 (&param);
 
-    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, &param);
 
     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) {
index 2e99b40..3337455 100644 (file)
@@ -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);
index 634f42a..8cf6083 100644 (file)
@@ -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)
index e2d55d8..39b9bdc 100644 (file)
@@ -50,7 +50,6 @@ struct _GstOMXAudioEnc
   GstAudioEncoder parent;
 
   /* < protected > */
-  GstOMXCore *core;
   GstOMXComponent *component;
   GstOMXPort *in_port, *out_port;
 
index 2a89c3c..7cf26a0 100644 (file)
@@ -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)
index 7258a9c..7951a16 100644 (file)
@@ -50,7 +50,6 @@ struct _GstOMXVideoDec
   GstVideoDecoder parent;
 
   /* < protected > */
-  GstOMXCore *core;
   GstOMXComponent *component;
   GstOMXPort *in_port, *out_port;
 
index 4c3f94c..26ff995 100644 (file)
@@ -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)
index b4dc7af..43bee27 100644 (file)
@@ -53,7 +53,6 @@ struct _GstOMXVideoEnc
 
   GstOMXClassData cdata;
 
-  GstOMXCore *core;
   GstOMXComponent *component;
   GstOMXPort *in_port, *out_port;