diff options
author | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2018-07-24 15:06:01 +0200 |
---|---|---|
committer | Guillaume Desmottes <guillaume.desmottes@collabora.co.uk> | 2018-08-30 10:59:30 +0200 |
commit | 8efa0951ffed6953e52735162f09ab09fb116a3b (patch) | |
tree | dab102a956a47ba051edab18972d290c7b801cb2 | |
parent | 7b6be347a6dc94c0ca16272fa249bc77b68f43ee (diff) | |
download | gst-omx-8efa0951ffed6953e52735162f09ab09fb116a3b.tar.gz |
turn GstOMXComponent to a GstMiniObject
Will use it for refcounting.
https://bugzilla.gnome.org/show_bug.cgi?id=796918
-rw-r--r-- | omx/gstomx.c | 27 | ||||
-rw-r--r-- | omx/gstomx.h | 6 | ||||
-rw-r--r-- | omx/gstomxaudiodec.c | 2 | ||||
-rw-r--r-- | omx/gstomxaudioenc.c | 2 | ||||
-rw-r--r-- | omx/gstomxaudiosink.c | 2 | ||||
-rw-r--r-- | omx/gstomxvideodec.c | 4 | ||||
-rw-r--r-- | omx/gstomxvideoenc.c | 2 |
7 files changed, 37 insertions, 8 deletions
diff --git a/omx/gstomx.c b/omx/gstomx.c index 0acf413..6096806 100644 --- a/omx/gstomx.c +++ b/omx/gstomx.c @@ -775,6 +775,10 @@ FillBufferDone (OMX_HANDLETYPE hComponent, OMX_PTR pAppData, 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, @@ -792,6 +796,10 @@ 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 @@ -859,7 +867,7 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name, } /* NOTE: Uses comp->messages_lock */ -void +static void gst_omx_component_free (GstOMXComponent * comp) { gint i, n; @@ -900,6 +908,23 @@ gst_omx_component_free (GstOMXComponent * comp) 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) diff --git a/omx/gstomx.h b/omx/gstomx.h index 81b49dd..cab62bd 100644 --- a/omx/gstomx.h +++ b/omx/gstomx.h @@ -327,6 +327,8 @@ struct _GstOMXPort { }; struct _GstOMXComponent { + GstMiniObject mini_object; + GstObject *parent; gchar *name; /* for debugging mostly */ @@ -411,9 +413,11 @@ guint64 gst_omx_parse_hacks (gchar ** hacks); 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); diff --git a/omx/gstomxaudiodec.c b/omx/gstomxaudiodec.c index d482391..1fb0bd5 100644 --- a/omx/gstomxaudiodec.c +++ b/omx/gstomxaudiodec.c @@ -206,7 +206,7 @@ gst_omx_audio_dec_close (GstAudioDecoder * decoder) 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; diff --git a/omx/gstomxaudioenc.c b/omx/gstomxaudioenc.c index f9c2581..036b911 100644 --- a/omx/gstomxaudioenc.c +++ b/omx/gstomxaudioenc.c @@ -194,7 +194,7 @@ gst_omx_audio_enc_close (GstAudioEncoder * encoder) 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; diff --git a/omx/gstomxaudiosink.c b/omx/gstomxaudiosink.c index 1739739..0f1c23e 100644 --- a/omx/gstomxaudiosink.c +++ b/omx/gstomxaudiosink.c @@ -358,7 +358,7 @@ gst_omx_audio_sink_close (GstAudioSink * audiosink) 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"); diff --git a/omx/gstomxvideodec.c b/omx/gstomxvideodec.c index c699067..6791fb7 100644 --- a/omx/gstomxvideodec.c +++ b/omx/gstomxvideodec.c @@ -428,14 +428,14 @@ gst_omx_video_dec_close (GstVideoDecoder * decoder) 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 diff --git a/omx/gstomxvideoenc.c b/omx/gstomxvideoenc.c index 2e9498f..a8a0212 100644 --- a/omx/gstomxvideoenc.c +++ b/omx/gstomxvideoenc.c @@ -959,7 +959,7 @@ gst_omx_video_enc_close (GstVideoEncoder * encoder) 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; |