Will use it for refcounting.
https://bugzilla.gnome.org/show_bug.cgi?id=796918
static OMX_CALLBACKTYPE callbacks =
{ EventHandler, EmptyBufferDone, FillBufferDone };
+GST_DEFINE_MINI_OBJECT_TYPE (GstOMXComponent, gst_omx_component);
+
+static void gst_omx_component_free (GstOMXComponent * comp);
+
/* NOTE: Uses comp->lock and comp->messages_lock */
GstOMXComponent *
gst_omx_component_new (GstObject * parent, const gchar * core_name,
comp = g_slice_new0 (GstOMXComponent);
comp->core = core;
+ gst_mini_object_init (GST_MINI_OBJECT_CAST (comp), 0,
+ gst_omx_component_get_type (), NULL, NULL,
+ (GstMiniObjectFreeFunction) gst_omx_component_free);
+
if ((dot = g_strrstr (component_name, ".")))
comp->name = g_strdup (dot + 1);
else
}
/* NOTE: Uses comp->messages_lock */
-void
+static void
gst_omx_component_free (GstOMXComponent * comp)
{
gint i, n;
g_slice_free (GstOMXComponent, comp);
}
+GstOMXComponent *
+gst_omx_component_ref (GstOMXComponent * comp)
+{
+ g_return_val_if_fail (comp, NULL);
+
+ gst_mini_object_ref (GST_MINI_OBJECT_CAST (comp));
+ return comp;
+}
+
+void
+gst_omx_component_unref (GstOMXComponent * comp)
+{
+ g_return_if_fail (comp);
+
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (comp));
+}
+
/* NOTE: Uses comp->lock and comp->messages_lock */
OMX_ERRORTYPE
gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state)
};
struct _GstOMXComponent {
+ GstMiniObject mini_object;
+
GstObject *parent;
gchar *name; /* for debugging mostly */
GstOMXCore * gst_omx_core_acquire (const gchar * filename);
void gst_omx_core_release (GstOMXCore * core);
+GType gst_omx_component_get_type (void);
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);
+GstOMXComponent * gst_omx_component_ref (GstOMXComponent * comp);
+void gst_omx_component_unref (GstOMXComponent * comp);
OMX_ERRORTYPE gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state);
OMX_STATETYPE gst_omx_component_get_state (GstOMXComponent * comp, GstClockTime timeout);
self->dec_in_port = NULL;
self->dec_out_port = NULL;
if (self->dec)
- gst_omx_component_free (self->dec);
+ gst_omx_component_unref (self->dec);
self->dec = NULL;
self->started = FALSE;
self->enc_in_port = NULL;
self->enc_out_port = NULL;
if (self->enc)
- gst_omx_component_free (self->enc);
+ gst_omx_component_unref (self->enc);
self->enc = NULL;
return TRUE;
self->in_port = NULL;
self->out_port = NULL;
if (self->comp)
- gst_omx_component_free (self->comp);
+ gst_omx_component_unref (self->comp);
self->comp = NULL;
GST_DEBUG_OBJECT (self, "Closed audio sink");
self->dec_in_port = NULL;
self->dec_out_port = NULL;
if (self->dec)
- gst_omx_component_free (self->dec);
+ gst_omx_component_unref (self->dec);
self->dec = NULL;
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
self->egl_in_port = NULL;
self->egl_out_port = NULL;
if (self->egl_render)
- gst_omx_component_free (self->egl_render);
+ gst_omx_component_unref (self->egl_render);
self->egl_render = NULL;
#endif
self->enc_in_port = NULL;
self->enc_out_port = NULL;
if (self->enc)
- gst_omx_component_free (self->enc);
+ gst_omx_component_unref (self->enc);
self->enc = NULL;
self->started = FALSE;