From 5be62b88b873eba8b22036215eb9a90df968d210 Mon Sep 17 00:00:00 2001 From: Wim Taymans Date: Mon, 21 Nov 2005 18:53:06 +0000 Subject: [PATCH] gst/gstsegment.*: Make binding friendly. Original commit message from CVS: * gst/gstsegment.c: (gst_segment_copy), (gst_segment_get_type), (gst_segment_new), (gst_segment_free), (gst_segment_init), (gst_segment_set_duration), (gst_segment_set_last_stop), (gst_segment_set_seek), (gst_segment_set_newsegment), (gst_segment_to_stream_time), (gst_segment_to_running_time), (gst_segment_clip): * gst/gstsegment.h: Make binding friendly. --- ChangeLog | 11 +++++++++++ gst/gstsegment.c | 56 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ gst/gstsegment.h | 5 +++++ 3 files changed, 72 insertions(+) diff --git a/ChangeLog b/ChangeLog index c605a79..58da899 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2005-11-21 Wim Taymans + + * gst/gstsegment.c: (gst_segment_copy), (gst_segment_get_type), + (gst_segment_new), (gst_segment_free), (gst_segment_init), + (gst_segment_set_duration), (gst_segment_set_last_stop), + (gst_segment_set_seek), (gst_segment_set_newsegment), + (gst_segment_to_stream_time), (gst_segment_to_running_time), + (gst_segment_clip): + * gst/gstsegment.h: + Make binding friendly. + 2005-11-21 Andy Wingo * gst/gsttagsetter.h: diff --git a/gst/gstsegment.c b/gst/gstsegment.c index 4a14654..f1e79bd 100644 --- a/gst/gstsegment.c +++ b/gst/gstsegment.c @@ -37,6 +37,62 @@ * Last reviewed on 2005-20-09 (0.9.5) */ +static GstSegment * +gst_segment_copy (GstSegment * segment) +{ + GstSegment *result = NULL; + + if (segment) { + result = gst_segment_new (); + memcpy (result, segment, sizeof (GstSegment)); + } + return NULL; +} + +GType +gst_segment_get_type (void) +{ + static GType gst_segment_type = 0; + + if (!gst_segment_type) { + gst_segment_type = g_boxed_type_register_static ("GstSegment", + (GBoxedCopyFunc) gst_segment_copy, (GBoxedFreeFunc) gst_segment_free); + } + + return gst_segment_type; +} + +/** + * gst_segment_new: + * + * Allocate a new #GstSegment structure and initialize it using + * gst_segment_init(). + * + * Returns: a new #GstSegment, free with gst_segment_free(). + */ +GstSegment * +gst_segment_new (void) +{ + GstSegment *result; + + result = g_new0 (GstSegment, 1); + gst_segment_init (result, GST_FORMAT_UNDEFINED); + + return result; +} + +/** + * gst_segment_free: + * @segment: a #GstSegment + * + * Free the allocated segment @segment. + */ +void +gst_segment_free (GstSegment * segment) +{ + g_free (segment); +} + /** * gst_segment_init: * @segment: a #GstSegment structure. diff --git a/gst/gstsegment.h b/gst/gstsegment.h index d5eaedc..13f20a9 100644 --- a/gst/gstsegment.h +++ b/gst/gstsegment.h @@ -64,6 +64,11 @@ struct _GstSegment { gpointer _gst_reserved[GST_PADDING]; }; +GType gst_segment_get_type (void); + +GstSegment * gst_segment_new (void); +void gst_segment_free (GstSegment *segment); + void gst_segment_init (GstSegment *segment, GstFormat format); void gst_segment_set_duration (GstSegment *segment, GstFormat format, gint64 duration); -- 2.7.4