mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 11:41:09 +00:00
turn GstOMXComponent to a GstMiniObject
Will use it for refcounting. https://bugzilla.gnome.org/show_bug.cgi?id=796918
This commit is contained in:
parent
7b6be347a6
commit
8efa0951ff
7 changed files with 37 additions and 8 deletions
27
omx/gstomx.c
27
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)
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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");
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
Loading…
Reference in a new issue