struct _GstDateTime
{
+ GstMiniObject mini_object;
+
GDateTime *datetime;
GstDateTimeFields fields;
- volatile gint ref_count;
};
+GST_DEFINE_MINI_OBJECT_TYPE (GstDateTime, gst_date_time);
+
+static void gst_date_time_free (GstDateTime * datetime);
+
/**
* gst_date_time_new_from_g_date_time:
* @dt: (transfer full): the #GDateTime. The new #GstDateTime takes ownership.
return NULL;
gst_dt = g_slice_new (GstDateTime);
+
+ gst_mini_object_init (GST_MINI_OBJECT_CAST (gst_dt), 0, GST_TYPE_DATE_TIME,
+ NULL, NULL, (GstMiniObjectFreeFunction) gst_date_time_free);
+
gst_dt->datetime = dt;
gst_dt->fields = GST_DATE_TIME_FIELDS_YMD_HMS;
- gst_dt->ref_count = 1;
return gst_dt;
}
return gst_date_time_new_ymd (year, month, day);
}
-
static void
gst_date_time_free (GstDateTime * datetime)
{
GstDateTime *
gst_date_time_ref (GstDateTime * datetime)
{
- g_return_val_if_fail (datetime != NULL, NULL);
- g_return_val_if_fail (datetime->ref_count > 0, NULL);
- g_atomic_int_inc (&datetime->ref_count);
- return datetime;
+ return (GstDateTime *) gst_mini_object_ref (GST_MINI_OBJECT_CAST (datetime));
}
/**
void
gst_date_time_unref (GstDateTime * datetime)
{
- g_return_if_fail (datetime != NULL);
- g_return_if_fail (datetime->ref_count > 0);
-
- if (g_atomic_int_dec_and_test (&datetime->ref_count))
- gst_date_time_free (datetime);
+ gst_mini_object_unref (GST_MINI_OBJECT_CAST (datetime));
}
*/
typedef struct _GstDateTime GstDateTime;
+/**
+ * GST_TYPE_DATE_TIME:
+ *
+ * a boxed #GValue type for #GstDateTime that represents a date and time.
+ *
+ * Returns: the #GType of GstDateTime
+ */
+
+#define GST_TYPE_DATE_TIME gst_date_time_get_type()
+
+GType gst_date_time_get_type (void);
+
/* query which fields are set */
gboolean gst_date_time_has_year (const GstDateTime * datetime);
FUNC_VALUE_GET_TYPE (fraction, "GstFraction");
-G_DEFINE_BOXED_TYPE (GstDateTime, gst_date_time,
- (GBoxedCopyFunc) gst_date_time_ref, (GBoxedFreeFunc) gst_date_time_unref);
-
static const GTypeValueTable _gst_bitmask_value_table = {
gst_value_init_bitmask,
NULL,
#define GST_TYPE_FRACTION gst_fraction_get_type ()
/**
- * GST_TYPE_DATE_TIME:
- *
- * a boxed #GValue type for #GstDateTime that represents a date and time.
- *
- * Returns: the #GType of GstDateTime
- */
-
-#define GST_TYPE_DATE_TIME gst_date_time_get_type ()
-
-/**
* GST_TYPE_BITMASK:
*
* a #GValue type that represents a 64-bit bitmask.
GType gst_g_thread_get_type (void);
#endif
-GType gst_date_time_get_type (void);
-
void gst_value_register (const GstValueTable *table);
void gst_value_init_and_copy (GValue *dest,
const GValue *src);