mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-01-10 17:35:59 +00:00
flowcombiner: add boxed type for bindings
https://bugzilla.gnome.org/show_bug.cgi?id=731355
This commit is contained in:
parent
2a14482c62
commit
49fedb521f
2 changed files with 32 additions and 2 deletions
|
@ -70,8 +70,16 @@ struct _GstFlowCombiner
|
|||
GQueue pads;
|
||||
|
||||
GstFlowReturn last_ret;
|
||||
volatile gint ref_count;
|
||||
};
|
||||
|
||||
static GstFlowCombiner *gst_flow_combiner_ref (GstFlowCombiner * combiner);
|
||||
static void gst_flow_combiner_unref (GstFlowCombiner * combiner);
|
||||
|
||||
G_DEFINE_BOXED_TYPE (GstFlowCombiner, gst_flow_combiner,
|
||||
(GBoxedCopyFunc) gst_flow_combiner_ref,
|
||||
(GBoxedFreeFunc) gst_flow_combiner_unref);
|
||||
|
||||
/**
|
||||
* gst_flow_combiner_new:
|
||||
*
|
||||
|
@ -87,6 +95,7 @@ gst_flow_combiner_new (void)
|
|||
|
||||
g_queue_init (&combiner->pads);
|
||||
combiner->last_ret = GST_FLOW_OK;
|
||||
combiner->ref_count = 1;
|
||||
|
||||
return combiner;
|
||||
}
|
||||
|
@ -101,11 +110,28 @@ gst_flow_combiner_new (void)
|
|||
*/
|
||||
void
|
||||
gst_flow_combiner_free (GstFlowCombiner * combiner)
|
||||
{
|
||||
gst_flow_combiner_unref (combiner);
|
||||
}
|
||||
|
||||
static GstFlowCombiner *
|
||||
gst_flow_combiner_ref (GstFlowCombiner * combiner)
|
||||
{
|
||||
g_return_if_fail (combiner != NULL);
|
||||
|
||||
g_queue_clear (&combiner->pads);
|
||||
g_slice_free (GstFlowCombiner, combiner);
|
||||
g_atomic_int_inc (&combiner->ref_count);
|
||||
}
|
||||
|
||||
static void
|
||||
gst_flow_combiner_unref (GstFlowCombiner * combiner)
|
||||
{
|
||||
g_return_if_fail (combiner != NULL);
|
||||
g_return_if_fail (combiner->ref_count > 0);
|
||||
|
||||
if (g_atomic_int_dec_and_test (&combiner->ref_count)) {
|
||||
g_queue_clear (&combiner->pads);
|
||||
g_slice_free (GstFlowCombiner, combiner);
|
||||
}
|
||||
}
|
||||
|
||||
static GstFlowReturn
|
||||
|
|
|
@ -30,6 +30,8 @@
|
|||
|
||||
G_BEGIN_DECLS
|
||||
|
||||
#define GST_TYPE_FLOW_COMBINER gst_flow_combiner_get_type()
|
||||
|
||||
/**
|
||||
* GstFlowCombiner:
|
||||
*
|
||||
|
@ -49,6 +51,8 @@ void gst_flow_combiner_add_pad (GstFlowCombiner * combiner, GstP
|
|||
|
||||
void gst_flow_combiner_remove_pad (GstFlowCombiner * combiner, GstPad * pad);
|
||||
|
||||
GType gst_flow_combiner_get_type (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
#endif /* __GST_FLOW_COMBINER_H__ */
|
||||
|
|
Loading…
Reference in a new issue