gst/gstsegment.*: Make binding friendly.
authorWim Taymans <wim.taymans@gmail.com>
Mon, 21 Nov 2005 18:53:06 +0000 (18:53 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Mon, 21 Nov 2005 18:53:06 +0000 (18:53 +0000)
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
gst/gstsegment.c
gst/gstsegment.h

index c605a79..58da899 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2005-11-21  Wim Taymans  <wim@fluendo.com>
+
+       * 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  <wingo@pobox.com>
 
        * gst/gsttagsetter.h: 
index 4a14654..f1e79bd 100644 (file)
  * 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.
index d5eaedc..13f20a9 100644 (file)
@@ -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);