mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-18 12:15:19 +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 =
|
static OMX_CALLBACKTYPE callbacks =
|
||||||
{ EventHandler, EmptyBufferDone, FillBufferDone };
|
{ 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 */
|
/* NOTE: Uses comp->lock and comp->messages_lock */
|
||||||
GstOMXComponent *
|
GstOMXComponent *
|
||||||
gst_omx_component_new (GstObject * parent, const gchar * core_name,
|
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 = g_slice_new0 (GstOMXComponent);
|
||||||
comp->core = core;
|
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, ".")))
|
if ((dot = g_strrstr (component_name, ".")))
|
||||||
comp->name = g_strdup (dot + 1);
|
comp->name = g_strdup (dot + 1);
|
||||||
else
|
else
|
||||||
|
@ -859,7 +867,7 @@ gst_omx_component_new (GstObject * parent, const gchar * core_name,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* NOTE: Uses comp->messages_lock */
|
/* NOTE: Uses comp->messages_lock */
|
||||||
void
|
static void
|
||||||
gst_omx_component_free (GstOMXComponent * comp)
|
gst_omx_component_free (GstOMXComponent * comp)
|
||||||
{
|
{
|
||||||
gint i, n;
|
gint i, n;
|
||||||
|
@ -900,6 +908,23 @@ gst_omx_component_free (GstOMXComponent * comp)
|
||||||
g_slice_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 */
|
/* NOTE: Uses comp->lock and comp->messages_lock */
|
||||||
OMX_ERRORTYPE
|
OMX_ERRORTYPE
|
||||||
gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state)
|
gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state)
|
||||||
|
|
|
@ -327,6 +327,8 @@ struct _GstOMXPort {
|
||||||
};
|
};
|
||||||
|
|
||||||
struct _GstOMXComponent {
|
struct _GstOMXComponent {
|
||||||
|
GstMiniObject mini_object;
|
||||||
|
|
||||||
GstObject *parent;
|
GstObject *parent;
|
||||||
|
|
||||||
gchar *name; /* for debugging mostly */
|
gchar *name; /* for debugging mostly */
|
||||||
|
@ -411,9 +413,11 @@ guint64 gst_omx_parse_hacks (gchar ** hacks);
|
||||||
GstOMXCore * gst_omx_core_acquire (const gchar * filename);
|
GstOMXCore * gst_omx_core_acquire (const gchar * filename);
|
||||||
void gst_omx_core_release (GstOMXCore * core);
|
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);
|
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_ERRORTYPE gst_omx_component_set_state (GstOMXComponent * comp, OMX_STATETYPE state);
|
||||||
OMX_STATETYPE gst_omx_component_get_state (GstOMXComponent * comp, GstClockTime timeout);
|
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_in_port = NULL;
|
||||||
self->dec_out_port = NULL;
|
self->dec_out_port = NULL;
|
||||||
if (self->dec)
|
if (self->dec)
|
||||||
gst_omx_component_free (self->dec);
|
gst_omx_component_unref (self->dec);
|
||||||
self->dec = NULL;
|
self->dec = NULL;
|
||||||
|
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
|
|
@ -194,7 +194,7 @@ gst_omx_audio_enc_close (GstAudioEncoder * encoder)
|
||||||
self->enc_in_port = NULL;
|
self->enc_in_port = NULL;
|
||||||
self->enc_out_port = NULL;
|
self->enc_out_port = NULL;
|
||||||
if (self->enc)
|
if (self->enc)
|
||||||
gst_omx_component_free (self->enc);
|
gst_omx_component_unref (self->enc);
|
||||||
self->enc = NULL;
|
self->enc = NULL;
|
||||||
|
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
|
@ -358,7 +358,7 @@ gst_omx_audio_sink_close (GstAudioSink * audiosink)
|
||||||
self->in_port = NULL;
|
self->in_port = NULL;
|
||||||
self->out_port = NULL;
|
self->out_port = NULL;
|
||||||
if (self->comp)
|
if (self->comp)
|
||||||
gst_omx_component_free (self->comp);
|
gst_omx_component_unref (self->comp);
|
||||||
self->comp = NULL;
|
self->comp = NULL;
|
||||||
|
|
||||||
GST_DEBUG_OBJECT (self, "Closed audio sink");
|
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_in_port = NULL;
|
||||||
self->dec_out_port = NULL;
|
self->dec_out_port = NULL;
|
||||||
if (self->dec)
|
if (self->dec)
|
||||||
gst_omx_component_free (self->dec);
|
gst_omx_component_unref (self->dec);
|
||||||
self->dec = NULL;
|
self->dec = NULL;
|
||||||
|
|
||||||
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
|
#if defined (USE_OMX_TARGET_RPI) && defined (HAVE_GST_GL)
|
||||||
self->egl_in_port = NULL;
|
self->egl_in_port = NULL;
|
||||||
self->egl_out_port = NULL;
|
self->egl_out_port = NULL;
|
||||||
if (self->egl_render)
|
if (self->egl_render)
|
||||||
gst_omx_component_free (self->egl_render);
|
gst_omx_component_unref (self->egl_render);
|
||||||
self->egl_render = NULL;
|
self->egl_render = NULL;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
@ -959,7 +959,7 @@ gst_omx_video_enc_close (GstVideoEncoder * encoder)
|
||||||
self->enc_in_port = NULL;
|
self->enc_in_port = NULL;
|
||||||
self->enc_out_port = NULL;
|
self->enc_out_port = NULL;
|
||||||
if (self->enc)
|
if (self->enc)
|
||||||
gst_omx_component_free (self->enc);
|
gst_omx_component_unref (self->enc);
|
||||||
self->enc = NULL;
|
self->enc = NULL;
|
||||||
|
|
||||||
self->started = FALSE;
|
self->started = FALSE;
|
||||||
|
|
Loading…
Reference in a new issue