/* rygel-playspeed.c generated by valac 0.30.0.35-2c9e8, the Vala compiler
 * generated from rygel-playspeed.vala, do not modify */

/*
 * Copyright (C) 2013  Cable Television Laboratories, Inc.
 *
 * Author: Craig Pratt <craig@ecaspia.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 of the License, or (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public
 * License along with this library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <float.h>
#include <math.h>
#include <gobject/gvaluecollector.h>


#define RYGEL_TYPE_PLAY_SPEED (rygel_play_speed_get_type ())
#define RYGEL_PLAY_SPEED(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_PLAY_SPEED, RygelPlaySpeed))
#define RYGEL_PLAY_SPEED_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_PLAY_SPEED, RygelPlaySpeedClass))
#define RYGEL_IS_PLAY_SPEED(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_PLAY_SPEED))
#define RYGEL_IS_PLAY_SPEED_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_PLAY_SPEED))
#define RYGEL_PLAY_SPEED_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_PLAY_SPEED, RygelPlaySpeedClass))

typedef struct _RygelPlaySpeed RygelPlaySpeed;
typedef struct _RygelPlaySpeedClass RygelPlaySpeedClass;
typedef struct _RygelPlaySpeedPrivate RygelPlaySpeedPrivate;
#define _rygel_play_speed_unref0(var) ((var == NULL) ? NULL : (var = (rygel_play_speed_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _RygelParamSpecPlaySpeed RygelParamSpecPlaySpeed;

struct _RygelPlaySpeed {
	GTypeInstance parent_instance;
	volatile int ref_count;
	RygelPlaySpeedPrivate * priv;
	gint numerator;
	guint denominator;
};

struct _RygelPlaySpeedClass {
	GTypeClass parent_class;
	void (*finalize) (RygelPlaySpeed *self);
};

typedef enum  {
	RYGEL_PLAY_SPEED_ERROR_INVALID_SPEED_FORMAT,
	RYGEL_PLAY_SPEED_ERROR_SPEED_NOT_PRESENT
} RygelPlaySpeedError;
#define RYGEL_PLAY_SPEED_ERROR rygel_play_speed_error_quark ()
struct _RygelParamSpecPlaySpeed {
	GParamSpec parent_instance;
};


static gpointer rygel_play_speed_parent_class = NULL;

gpointer rygel_play_speed_ref (gpointer instance);
void rygel_play_speed_unref (gpointer instance);
GParamSpec* rygel_param_spec_play_speed (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void rygel_value_set_play_speed (GValue* value, gpointer v_object);
void rygel_value_take_play_speed (GValue* value, gpointer v_object);
gpointer rygel_value_get_play_speed (const GValue* value);
GType rygel_play_speed_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_PLAY_SPEED_DUMMY_PROPERTY
};
RygelPlaySpeed* rygel_play_speed_new (gint numerator, guint denominator);
RygelPlaySpeed* rygel_play_speed_construct (GType object_type, gint numerator, guint denominator);
GQuark rygel_play_speed_error_quark (void);
RygelPlaySpeed* rygel_play_speed_new_from_string (const gchar* speed, GError** error);
RygelPlaySpeed* rygel_play_speed_construct_from_string (GType object_type, const gchar* speed, GError** error);
static void rygel_play_speed_parse (RygelPlaySpeed* self, const gchar* speed, GError** error);
gboolean rygel_play_speed_equals (RygelPlaySpeed* self, RygelPlaySpeed* that);
gboolean rygel_play_speed_is_positive (RygelPlaySpeed* self);
gboolean rygel_play_speed_is_normal_rate (RygelPlaySpeed* self);
gchar* rygel_play_speed_to_string (RygelPlaySpeed* self);
gfloat rygel_play_speed_to_float (RygelPlaySpeed* self);
gdouble rygel_play_speed_to_double (RygelPlaySpeed* self);
static void rygel_play_speed_finalize (RygelPlaySpeed* obj);
static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


RygelPlaySpeed* rygel_play_speed_construct (GType object_type, gint numerator, guint denominator) {
	RygelPlaySpeed* self = NULL;
	gint _tmp0_ = 0;
	guint _tmp1_ = 0U;
	self = (RygelPlaySpeed*) g_type_create_instance (object_type);
	_tmp0_ = numerator;
	self->numerator = _tmp0_;
	_tmp1_ = denominator;
	self->denominator = _tmp1_;
	return self;
}


RygelPlaySpeed* rygel_play_speed_new (gint numerator, guint denominator) {
	return rygel_play_speed_construct (RYGEL_TYPE_PLAY_SPEED, numerator, denominator);
}


RygelPlaySpeed* rygel_play_speed_construct_from_string (GType object_type, const gchar* speed, GError** error) {
	RygelPlaySpeed* self = NULL;
	const gchar* _tmp0_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (speed != NULL, NULL);
	self = (RygelPlaySpeed*) g_type_create_instance (object_type);
	_tmp0_ = speed;
	rygel_play_speed_parse (self, _tmp0_, &_inner_error_);
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		if (_inner_error_->domain == RYGEL_PLAY_SPEED_ERROR) {
			g_propagate_error (error, _inner_error_);
			_rygel_play_speed_unref0 (self);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return NULL;
		}
	}
	return self;
}


RygelPlaySpeed* rygel_play_speed_new_from_string (const gchar* speed, GError** error) {
	return rygel_play_speed_construct_from_string (RYGEL_TYPE_PLAY_SPEED, speed, error);
}


gboolean rygel_play_speed_equals (RygelPlaySpeed* self, RygelPlaySpeed* that) {
	gboolean result = FALSE;
	RygelPlaySpeed* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	gint _tmp2_ = 0;
	RygelPlaySpeed* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (that != NULL, FALSE);
	_tmp0_ = that;
	if (_tmp0_ == NULL) {
		result = FALSE;
		return result;
	}
	_tmp2_ = self->numerator;
	_tmp3_ = that;
	_tmp4_ = _tmp3_->numerator;
	if (_tmp2_ == _tmp4_) {
		guint _tmp5_ = 0U;
		RygelPlaySpeed* _tmp6_ = NULL;
		guint _tmp7_ = 0U;
		_tmp5_ = self->denominator;
		_tmp6_ = that;
		_tmp7_ = _tmp6_->denominator;
		_tmp1_ = _tmp5_ == _tmp7_;
	} else {
		_tmp1_ = FALSE;
	}
	result = _tmp1_;
	return result;
}


gboolean rygel_play_speed_is_positive (RygelPlaySpeed* self) {
	gboolean result = FALSE;
	gint _tmp0_ = 0;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->numerator;
	result = _tmp0_ > 0;
	return result;
}


gboolean rygel_play_speed_is_normal_rate (RygelPlaySpeed* self) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	gint _tmp1_ = 0;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp1_ = self->numerator;
	if (_tmp1_ == 1) {
		guint _tmp2_ = 0U;
		_tmp2_ = self->denominator;
		_tmp0_ = _tmp2_ == ((guint) 1);
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}


gchar* rygel_play_speed_to_string (RygelPlaySpeed* self) {
	gchar* result = NULL;
	guint _tmp0_ = 0U;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->denominator;
	if (_tmp0_ == ((guint) 1)) {
		gint _tmp1_ = 0;
		gchar* _tmp2_ = NULL;
		_tmp1_ = self->numerator;
		_tmp2_ = g_strdup_printf ("%i", _tmp1_);
		result = _tmp2_;
		return result;
	} else {
		gint _tmp3_ = 0;
		guint _tmp4_ = 0U;
		gchar* _tmp5_ = NULL;
		_tmp3_ = self->numerator;
		_tmp4_ = self->denominator;
		_tmp5_ = g_strdup_printf ("%d/%u", _tmp3_, _tmp4_);
		result = _tmp5_;
		return result;
	}
}


gfloat rygel_play_speed_to_float (RygelPlaySpeed* self) {
	gfloat result = 0.0F;
	gint _tmp0_ = 0;
	guint _tmp1_ = 0U;
	g_return_val_if_fail (self != NULL, 0.0F);
	_tmp0_ = self->numerator;
	_tmp1_ = self->denominator;
	result = ((gfloat) _tmp0_) / _tmp1_;
	return result;
}


gdouble rygel_play_speed_to_double (RygelPlaySpeed* self) {
	gdouble result = 0.0;
	gint _tmp0_ = 0;
	guint _tmp1_ = 0U;
	g_return_val_if_fail (self != NULL, 0.0);
	_tmp0_ = self->numerator;
	_tmp1_ = self->denominator;
	result = ((gdouble) _tmp0_) / _tmp1_;
	return result;
}


static gboolean string_contains (const gchar* self, const gchar* needle) {
	gboolean result = FALSE;
	const gchar* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (needle != NULL, FALSE);
	_tmp0_ = needle;
	_tmp1_ = strstr ((gchar*) self, (gchar*) _tmp0_);
	result = _tmp1_ != NULL;
	return result;
}


static void rygel_play_speed_parse (RygelPlaySpeed* self, const gchar* speed, GError** error) {
	const gchar* _tmp0_ = NULL;
	gboolean _tmp1_ = FALSE;
	gint _tmp18_ = 0;
	guint _tmp26_ = 0U;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (speed != NULL);
	_tmp0_ = speed;
	_tmp1_ = string_contains (_tmp0_, "/");
	if (!_tmp1_) {
		const gchar* _tmp2_ = NULL;
		gint _tmp3_ = 0;
		_tmp2_ = speed;
		_tmp3_ = atoi (_tmp2_);
		self->numerator = _tmp3_;
		self->denominator = (guint) 1;
	} else {
		gchar** elements = NULL;
		const gchar* _tmp4_ = NULL;
		gchar** _tmp5_ = NULL;
		gchar** _tmp6_ = NULL;
		gint elements_length1 = 0;
		gint _elements_size_ = 0;
		gchar** _tmp7_ = NULL;
		gint _tmp7__length1 = 0;
		gchar** _tmp12_ = NULL;
		gint _tmp12__length1 = 0;
		const gchar* _tmp13_ = NULL;
		gint _tmp14_ = 0;
		gchar** _tmp15_ = NULL;
		gint _tmp15__length1 = 0;
		const gchar* _tmp16_ = NULL;
		gint _tmp17_ = 0;
		_tmp4_ = speed;
		_tmp6_ = _tmp5_ = g_strsplit (_tmp4_, "/", 0);
		elements = _tmp6_;
		elements_length1 = _vala_array_length (_tmp5_);
		_elements_size_ = elements_length1;
		_tmp7_ = elements;
		_tmp7__length1 = elements_length1;
		if (_tmp7__length1 != 2) {
			gchar* msg = NULL;
			gchar* _tmp8_ = NULL;
			const gchar* _tmp9_ = NULL;
			const gchar* _tmp10_ = NULL;
			GError* _tmp11_ = NULL;
			_tmp8_ = g_strdup ("Missing/extra numerator/denominator in fraction %s");
			msg = _tmp8_;
			_tmp9_ = msg;
			_tmp10_ = speed;
			_tmp11_ = g_error_new (RYGEL_PLAY_SPEED_ERROR, RYGEL_PLAY_SPEED_ERROR_INVALID_SPEED_FORMAT, _tmp9_, _tmp10_);
			_inner_error_ = _tmp11_;
			if (_inner_error_->domain == RYGEL_PLAY_SPEED_ERROR) {
				g_propagate_error (error, _inner_error_);
				_g_free0 (msg);
				elements = (_vala_array_free (elements, elements_length1, (GDestroyNotify) g_free), NULL);
				return;
			} else {
				_g_free0 (msg);
				elements = (_vala_array_free (elements, elements_length1, (GDestroyNotify) g_free), NULL);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
				g_clear_error (&_inner_error_);
				return;
			}
			_g_free0 (msg);
		}
		_tmp12_ = elements;
		_tmp12__length1 = elements_length1;
		_tmp13_ = _tmp12_[0];
		_tmp14_ = atoi (_tmp13_);
		self->numerator = _tmp14_;
		_tmp15_ = elements;
		_tmp15__length1 = elements_length1;
		_tmp16_ = _tmp15_[1];
		_tmp17_ = atoi (_tmp16_);
		self->denominator = (guint) _tmp17_;
		elements = (_vala_array_free (elements, elements_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp18_ = self->numerator;
	if (_tmp18_ == 0) {
		gchar* msg = NULL;
		gchar* _tmp19_ = NULL;
		const gchar* _tmp20_ = NULL;
		const gchar* _tmp21_ = NULL;
		gchar* _tmp22_ = NULL;
		gchar* _tmp23_ = NULL;
		GError* _tmp24_ = NULL;
		GError* _tmp25_ = NULL;
		_tmp19_ = g_strdup ("Invalid numerator in speed %s");
		msg = _tmp19_;
		_tmp20_ = msg;
		_tmp21_ = speed;
		_tmp22_ = g_strdup_printf (_tmp20_, _tmp21_);
		_tmp23_ = _tmp22_;
		_tmp24_ = g_error_new_literal (RYGEL_PLAY_SPEED_ERROR, RYGEL_PLAY_SPEED_ERROR_INVALID_SPEED_FORMAT, _tmp23_);
		_tmp25_ = _tmp24_;
		_g_free0 (_tmp23_);
		_inner_error_ = _tmp25_;
		if (_inner_error_->domain == RYGEL_PLAY_SPEED_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_free0 (msg);
			return;
		} else {
			_g_free0 (msg);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		_g_free0 (msg);
	}
	_tmp26_ = self->denominator;
	if (_tmp26_ <= ((guint) 0)) {
		gchar* msg = NULL;
		gchar* _tmp27_ = NULL;
		const gchar* _tmp28_ = NULL;
		const gchar* _tmp29_ = NULL;
		gchar* _tmp30_ = NULL;
		gchar* _tmp31_ = NULL;
		GError* _tmp32_ = NULL;
		GError* _tmp33_ = NULL;
		_tmp27_ = g_strdup ("Invalid numerator in speed %s");
		msg = _tmp27_;
		_tmp28_ = msg;
		_tmp29_ = speed;
		_tmp30_ = g_strdup_printf (_tmp28_, _tmp29_);
		_tmp31_ = _tmp30_;
		_tmp32_ = g_error_new_literal (RYGEL_PLAY_SPEED_ERROR, RYGEL_PLAY_SPEED_ERROR_INVALID_SPEED_FORMAT, _tmp31_);
		_tmp33_ = _tmp32_;
		_g_free0 (_tmp31_);
		_inner_error_ = _tmp33_;
		if (_inner_error_->domain == RYGEL_PLAY_SPEED_ERROR) {
			g_propagate_error (error, _inner_error_);
			_g_free0 (msg);
			return;
		} else {
			_g_free0 (msg);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
		_g_free0 (msg);
	}
}


static void rygel_value_play_speed_init (GValue* value) {
	value->data[0].v_pointer = NULL;
}


static void rygel_value_play_speed_free_value (GValue* value) {
	if (value->data[0].v_pointer) {
		rygel_play_speed_unref (value->data[0].v_pointer);
	}
}


static void rygel_value_play_speed_copy_value (const GValue* src_value, GValue* dest_value) {
	if (src_value->data[0].v_pointer) {
		dest_value->data[0].v_pointer = rygel_play_speed_ref (src_value->data[0].v_pointer);
	} else {
		dest_value->data[0].v_pointer = NULL;
	}
}


static gpointer rygel_value_play_speed_peek_pointer (const GValue* value) {
	return value->data[0].v_pointer;
}


static gchar* rygel_value_play_speed_collect_value (GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	if (collect_values[0].v_pointer) {
		RygelPlaySpeed* object;
		object = collect_values[0].v_pointer;
		if (object->parent_instance.g_class == NULL) {
			return g_strconcat ("invalid unclassed object pointer for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		} else if (!g_value_type_compatible (G_TYPE_FROM_INSTANCE (object), G_VALUE_TYPE (value))) {
			return g_strconcat ("invalid object type `", g_type_name (G_TYPE_FROM_INSTANCE (object)), "' for value type `", G_VALUE_TYPE_NAME (value), "'", NULL);
		}
		value->data[0].v_pointer = rygel_play_speed_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}


static gchar* rygel_value_play_speed_lcopy_value (const GValue* value, guint n_collect_values, GTypeCValue* collect_values, guint collect_flags) {
	RygelPlaySpeed** object_p;
	object_p = collect_values[0].v_pointer;
	if (!object_p) {
		return g_strdup_printf ("value location for `%s' passed as NULL", G_VALUE_TYPE_NAME (value));
	}
	if (!value->data[0].v_pointer) {
		*object_p = NULL;
	} else if (collect_flags & G_VALUE_NOCOPY_CONTENTS) {
		*object_p = value->data[0].v_pointer;
	} else {
		*object_p = rygel_play_speed_ref (value->data[0].v_pointer);
	}
	return NULL;
}


GParamSpec* rygel_param_spec_play_speed (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags) {
	RygelParamSpecPlaySpeed* spec;
	g_return_val_if_fail (g_type_is_a (object_type, RYGEL_TYPE_PLAY_SPEED), NULL);
	spec = g_param_spec_internal (G_TYPE_PARAM_OBJECT, name, nick, blurb, flags);
	G_PARAM_SPEC (spec)->value_type = object_type;
	return G_PARAM_SPEC (spec);
}


gpointer rygel_value_get_play_speed (const GValue* value) {
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_TYPE_PLAY_SPEED), NULL);
	return value->data[0].v_pointer;
}


void rygel_value_set_play_speed (GValue* value, gpointer v_object) {
	RygelPlaySpeed* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_TYPE_PLAY_SPEED));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_TYPE_PLAY_SPEED));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
		rygel_play_speed_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		rygel_play_speed_unref (old);
	}
}


void rygel_value_take_play_speed (GValue* value, gpointer v_object) {
	RygelPlaySpeed* old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, RYGEL_TYPE_PLAY_SPEED));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, RYGEL_TYPE_PLAY_SPEED));
		g_return_if_fail (g_value_type_compatible (G_TYPE_FROM_INSTANCE (v_object), G_VALUE_TYPE (value)));
		value->data[0].v_pointer = v_object;
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		rygel_play_speed_unref (old);
	}
}


static void rygel_play_speed_class_init (RygelPlaySpeedClass * klass) {
	rygel_play_speed_parent_class = g_type_class_peek_parent (klass);
	((RygelPlaySpeedClass *) klass)->finalize = rygel_play_speed_finalize;
}


static void rygel_play_speed_instance_init (RygelPlaySpeed * self) {
	self->ref_count = 1;
}


static void rygel_play_speed_finalize (RygelPlaySpeed* obj) {
	RygelPlaySpeed * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_PLAY_SPEED, RygelPlaySpeed);
	g_signal_handlers_destroy (self);
}


/**
 * This is a container for a PlaySpeed value.
 *
 * A Playspeed can be positive or negative whole numbers or fractions.
 * e.g. "2". "1/2", "-1/4"
 */
GType rygel_play_speed_get_type (void) {
	static volatile gsize rygel_play_speed_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_play_speed_type_id__volatile)) {
		static const GTypeValueTable g_define_type_value_table = { rygel_value_play_speed_init, rygel_value_play_speed_free_value, rygel_value_play_speed_copy_value, rygel_value_play_speed_peek_pointer, "p", rygel_value_play_speed_collect_value, "p", rygel_value_play_speed_lcopy_value };
		static const GTypeInfo g_define_type_info = { sizeof (RygelPlaySpeedClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_play_speed_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelPlaySpeed), 0, (GInstanceInitFunc) rygel_play_speed_instance_init, &g_define_type_value_table };
		static const GTypeFundamentalInfo g_define_type_fundamental_info = { (G_TYPE_FLAG_CLASSED | G_TYPE_FLAG_INSTANTIATABLE | G_TYPE_FLAG_DERIVABLE | G_TYPE_FLAG_DEEP_DERIVABLE) };
		GType rygel_play_speed_type_id;
		rygel_play_speed_type_id = g_type_register_fundamental (g_type_fundamental_next (), "RygelPlaySpeed", &g_define_type_info, &g_define_type_fundamental_info, 0);
		g_once_init_leave (&rygel_play_speed_type_id__volatile, rygel_play_speed_type_id);
	}
	return rygel_play_speed_type_id__volatile;
}


gpointer rygel_play_speed_ref (gpointer instance) {
	RygelPlaySpeed* self;
	self = instance;
	g_atomic_int_inc (&self->ref_count);
	return instance;
}


void rygel_play_speed_unref (gpointer instance) {
	RygelPlaySpeed* self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		RYGEL_PLAY_SPEED_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}


static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	if ((array != NULL) && (destroy_func != NULL)) {
		int i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}


static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func) {
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}


static gint _vala_array_length (gpointer array) {
	int length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}



