Commit 37d7857e authored by Tim-Philipp Müller's avatar Tim-Philipp Müller
Browse files

baseparse: register boxed type for GstBaseFrameParse

To make this usable for bindings.

https://bugzilla.gnome.org/show_bug.cgi?id=518857
parent 8839c513
......@@ -538,6 +538,40 @@ gst_base_parse_init (GstBaseParse * parse, GstBaseParseClass * bclass)
GST_DEBUG_OBJECT (parse, "init ok");
}
static GstBaseParseFrame *
gst_base_parse_frame_copy (GstBaseParseFrame * frame)
{
GstBaseParseFrame *copy;
copy = g_slice_dup (GstBaseParseFrame, frame);
copy->buffer = gst_buffer_ref (frame->buffer);
return copy;
}
static void
gst_base_parse_frame_free (GstBaseParseFrame * frame)
{
if (frame->buffer)
gst_buffer_unref (frame->buffer);
g_slice_free (GstBaseParseFrame, frame);
}
GType
gst_base_parse_frame_get_type (void)
{
static volatile gsize frame_type = 0;
if (g_once_init_enter (&frame_type)) {
GType _type;
_type = g_boxed_type_register_static ("GstBaseParseFrame",
(GBoxedCopyFunc) gst_base_parse_frame_copy,
(GBoxedFreeFunc) gst_base_parse_frame_free);
g_once_init_leave (&frame_type, _type);
}
return (GType) frame_type;
}
/**
* gst_base_parse_frame_init:
* @parse: #GstBaseParse.
......@@ -565,14 +599,6 @@ gst_base_parse_frame_clear (GstBaseParse * parse, GstBaseParseFrame * frame)
}
}
/* free frame allocated with copy_and_clear (and not on the stack) */
static void
gst_base_parse_frame_free (GstBaseParseFrame * frame)
{
gst_base_parse_frame_clear (NULL, frame);
g_slice_free (GstBaseParseFrame, frame);
}
/* copy frame (taking ownership of contents of passed frame) */
static GstBaseParseFrame *
gst_base_parse_frame_copy_and_clear (GstBaseParseFrame * frame)
......
......@@ -257,6 +257,8 @@ struct _GstBaseParseClass {
GType gst_base_parse_get_type (void);
GType gst_base_parse_frame_get_type (void);
void gst_base_parse_frame_init (GstBaseParse * parse,
GstBaseParseFrame * frame);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment