/* QuicktimeMetdataLoader.c generated by valac 0.56.19, the Vala compiler
 * generated from QuicktimeMetdataLoader.vala, do not modify */

#include "shotwell-internal-video-metadata-handling.h"
#include <gio/gio.h>
#include <glib.h>
#include <glib-object.h>
#include "metadata.h"
#include <stdlib.h>
#include <string.h>
#include <gobject/gvaluecollector.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_date_time_unref0(var) ((var == NULL) ? NULL : (var = (g_date_time_unref (var), NULL)))

#define TYPE_QUICK_TIME_ATOM (quick_time_atom_get_type ())
#define QUICK_TIME_ATOM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TYPE_QUICK_TIME_ATOM, QuickTimeAtom))
#define QUICK_TIME_ATOM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TYPE_QUICK_TIME_ATOM, QuickTimeAtomClass))
#define IS_QUICK_TIME_ATOM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TYPE_QUICK_TIME_ATOM))
#define IS_QUICK_TIME_ATOM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TYPE_QUICK_TIME_ATOM))
#define QUICK_TIME_ATOM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TYPE_QUICK_TIME_ATOM, QuickTimeAtomClass))

typedef struct _QuickTimeAtom QuickTimeAtom;
typedef struct _QuickTimeAtomClass QuickTimeAtomClass;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _quick_time_atom_unref0(var) ((var == NULL) ? NULL : (var = (quick_time_atom_unref (var), NULL)))
typedef struct _ParamSpecQuickTimeMetadataLoader ParamSpecQuickTimeMetadataLoader;

struct _QuickTimeMetadataLoaderPrivate {
	GFile* file;
};

struct _ParamSpecQuickTimeMetadataLoader {
	GParamSpec parent_instance;
};

static gint QuickTimeMetadataLoader_private_offset;
static gpointer quick_time_metadata_loader_parent_class = NULL;

static GDateTime* quick_time_metadata_loader_get_creation_date_time_for_quicktime (QuickTimeMetadataLoader* self);
VALA_EXTERN gpointer quick_time_atom_ref (gpointer instance);
VALA_EXTERN void quick_time_atom_unref (gpointer instance);
VALA_EXTERN GParamSpec* param_spec_quick_time_atom (const gchar* name,
                                        const gchar* nick,
                                        const gchar* blurb,
                                        GType object_type,
                                        GParamFlags flags);
VALA_EXTERN void value_set_quick_time_atom (GValue* value,
                                gpointer v_object);
VALA_EXTERN void value_take_quick_time_atom (GValue* value,
                                 gpointer v_object);
VALA_EXTERN gpointer value_get_quick_time_atom (const GValue* value);
VALA_EXTERN GType quick_time_atom_get_type (void) G_GNUC_CONST ;
VALA_EXTERN QuickTimeAtom* quick_time_atom_new (GFile* file);
VALA_EXTERN QuickTimeAtom* quick_time_atom_construct (GType object_type,
                                          GFile* file);
VALA_EXTERN void quick_time_atom_open_file (QuickTimeAtom* self,
                                GError** error);
VALA_EXTERN void quick_time_atom_read_atom (QuickTimeAtom* self,
                                GError** error);
VALA_EXTERN gchar* quick_time_atom_get_current_atom_name (QuickTimeAtom* self);
VALA_EXTERN void quick_time_atom_next_atom (QuickTimeAtom* self,
                                GError** error);
VALA_EXTERN gboolean quick_time_atom_is_last_atom (QuickTimeAtom* self);
VALA_EXTERN void quick_time_atom_close_file (QuickTimeAtom* self,
                                 GError** error);
VALA_EXTERN QuickTimeAtom* quick_time_atom_get_first_child_atom (QuickTimeAtom* self);
VALA_EXTERN guint64 quick_time_atom_section_size_remaining (QuickTimeAtom* self);
VALA_EXTERN guint32 quick_time_atom_read_uint32 (QuickTimeAtom* self,
                                     GError** error);
static void quick_time_metadata_loader_finalize (QuickTimeMetadataLoader * obj);
static GType quick_time_metadata_loader_get_type_once (void);

static inline gpointer
quick_time_metadata_loader_get_instance_private (QuickTimeMetadataLoader* self)
{
	return G_STRUCT_MEMBER_P (self, QuickTimeMetadataLoader_private_offset);
}

static gpointer
_g_object_ref0 (gpointer self)
{
	return self ? g_object_ref (self) : NULL;
}

QuickTimeMetadataLoader*
quick_time_metadata_loader_construct (GType object_type,
                                      GFile* file)
{
	QuickTimeMetadataLoader* self = NULL;
	GFile* _tmp0_;
	g_return_val_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (file, g_file_get_type ()), NULL);
	self = (QuickTimeMetadataLoader*) g_type_create_instance (object_type);
	_tmp0_ = _g_object_ref0 (file);
	_g_object_unref0 (self->priv->file);
	self->priv->file = _tmp0_;
	return self;
}

QuickTimeMetadataLoader*
quick_time_metadata_loader_new (GFile* file)
{
	return quick_time_metadata_loader_construct (TYPE_QUICK_TIME_METADATA_LOADER, file);
}

MetadataDateTime*
quick_time_metadata_loader_get_creation_date_time (QuickTimeMetadataLoader* self)
{
	GDateTime* dt = NULL;
	GDateTime* _tmp0_;
	GDateTime* _tmp1_;
	MetadataDateTime* result;
	g_return_val_if_fail (IS_QUICK_TIME_METADATA_LOADER (self), NULL);
	_tmp0_ = quick_time_metadata_loader_get_creation_date_time_for_quicktime (self);
	dt = _tmp0_;
	_tmp1_ = dt;
	if (_tmp1_ == NULL) {
		result = NULL;
		_g_date_time_unref0 (dt);
		return result;
	} else {
		GDateTime* _tmp2_;
		MetadataDateTime* _tmp3_;
		_tmp2_ = dt;
		_tmp3_ = metadata_date_time_new (_tmp2_);
		result = _tmp3_;
		_g_date_time_unref0 (dt);
		return result;
	}
}

gchar*
quick_time_metadata_loader_get_title (QuickTimeMetadataLoader* self)
{
	gchar* result;
	g_return_val_if_fail (IS_QUICK_TIME_METADATA_LOADER (self), NULL);
	result = NULL;
	return result;
}

gboolean
quick_time_metadata_loader_is_supported (QuickTimeMetadataLoader* self)
{
	QuickTimeAtom* test = NULL;
	GFile* _tmp0_;
	QuickTimeAtom* _tmp1_;
	gboolean ret = FALSE;
	GError* _inner_error0_ = NULL;
	gboolean result;
	g_return_val_if_fail (IS_QUICK_TIME_METADATA_LOADER (self), FALSE);
	_tmp0_ = self->priv->file;
	_tmp1_ = quick_time_atom_new (_tmp0_);
	test = _tmp1_;
	ret = FALSE;
	{
		QuickTimeAtom* _tmp2_;
		QuickTimeAtom* _tmp3_;
		QuickTimeAtom* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gboolean _tmp7_;
		_tmp2_ = test;
		quick_time_atom_open_file (_tmp2_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp3_ = test;
		quick_time_atom_read_atom (_tmp3_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp4_ = test;
		_tmp5_ = quick_time_atom_get_current_atom_name (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = g_strcmp0 ("ftyp", _tmp6_) == 0;
		_g_free0 (_tmp6_);
		if (_tmp7_) {
			ret = TRUE;
		} else {
			while (TRUE) {
				QuickTimeAtom* _tmp8_;
				gchar* _tmp9_;
				gchar* _tmp10_;
				gboolean _tmp11_;
				QuickTimeAtom* _tmp12_;
				QuickTimeAtom* _tmp13_;
				QuickTimeAtom* _tmp14_;
				_tmp8_ = test;
				_tmp9_ = quick_time_atom_get_current_atom_name (_tmp8_);
				_tmp10_ = _tmp9_;
				_tmp11_ = g_strcmp0 ("moov", _tmp10_) == 0;
				_g_free0 (_tmp10_);
				if (_tmp11_) {
					ret = TRUE;
					break;
				}
				_tmp12_ = test;
				quick_time_atom_next_atom (_tmp12_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
				_tmp13_ = test;
				quick_time_atom_read_atom (_tmp13_, &_inner_error0_);
				if (G_UNLIKELY (_inner_error0_ != NULL)) {
					goto __catch0_g_error;
				}
				_tmp14_ = test;
				if (quick_time_atom_is_last_atom (_tmp14_)) {
					break;
				}
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GFile* _tmp15_;
		gchar* _tmp16_;
		gchar* _tmp17_;
		GError* _tmp18_;
		const gchar* _tmp19_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp15_ = self->priv->file;
		_tmp16_ = g_file_get_path (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp18_ = e;
		_tmp19_ = _tmp18_->message;
		g_debug ("QuicktimeMetdataLoader.vala:56: Error while testing for QuickTime file" \
" for %s: %s", _tmp17_, _tmp19_);
		_g_free0 (_tmp17_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp20_ = FALSE;
		_quick_time_atom_unref0 (test);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp20_;
	}
	{
		QuickTimeAtom* _tmp21_;
		_tmp21_ = test;
		quick_time_atom_close_file (_tmp21_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* e = NULL;
		GError* _tmp22_;
		const gchar* _tmp23_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp22_ = e;
		_tmp23_ = _tmp22_->message;
		g_debug ("QuicktimeMetdataLoader.vala:62: Error while closing Quicktime file: %s", _tmp23_);
		_g_error_free0 (e);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		gboolean _tmp24_ = FALSE;
		_quick_time_atom_unref0 (test);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return _tmp24_;
	}
	result = ret;
	_quick_time_atom_unref0 (test);
	return result;
}

static GDateTime*
quick_time_metadata_loader_get_creation_date_time_for_quicktime (QuickTimeMetadataLoader* self)
{
	QuickTimeAtom* test = NULL;
	GFile* _tmp0_;
	QuickTimeAtom* _tmp1_;
	GDateTime* timestamp = NULL;
	GError* _inner_error0_ = NULL;
	GDateTime* result;
	g_return_val_if_fail (IS_QUICK_TIME_METADATA_LOADER (self), NULL);
	_tmp0_ = self->priv->file;
	_tmp1_ = quick_time_atom_new (_tmp0_);
	test = _tmp1_;
	timestamp = NULL;
	{
		QuickTimeAtom* _tmp2_;
		gboolean done = FALSE;
		_tmp2_ = test;
		quick_time_atom_open_file (_tmp2_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		done = FALSE;
		while (TRUE) {
			QuickTimeAtom* _tmp3_;
			QuickTimeAtom* _tmp4_;
			QuickTimeAtom* _tmp5_;
			gchar* _tmp6_;
			gchar* _tmp7_;
			gboolean _tmp8_;
			QuickTimeAtom* _tmp29_;
			if (!(!done)) {
				break;
			}
			_tmp3_ = test;
			quick_time_atom_read_atom (_tmp3_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
			_tmp4_ = test;
			if (quick_time_atom_is_last_atom (_tmp4_)) {
				break;
			}
			_tmp5_ = test;
			_tmp6_ = quick_time_atom_get_current_atom_name (_tmp5_);
			_tmp7_ = _tmp6_;
			_tmp8_ = g_strcmp0 ("moov", _tmp7_) == 0;
			_g_free0 (_tmp7_);
			if (_tmp8_) {
				QuickTimeAtom* child = NULL;
				QuickTimeAtom* _tmp9_;
				QuickTimeAtom* _tmp10_;
				_tmp9_ = test;
				_tmp10_ = quick_time_atom_get_first_child_atom (_tmp9_);
				child = _tmp10_;
				while (TRUE) {
					QuickTimeAtom* _tmp11_;
					gboolean _tmp12_ = FALSE;
					QuickTimeAtom* _tmp13_;
					QuickTimeAtom* _tmp15_;
					gchar* _tmp16_;
					gchar* _tmp17_;
					gboolean _tmp18_;
					QuickTimeAtom* _tmp28_;
					if (!(!done)) {
						break;
					}
					_tmp11_ = child;
					quick_time_atom_read_atom (_tmp11_, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						_quick_time_atom_unref0 (child);
						goto __catch0_g_error;
					}
					_tmp13_ = child;
					if (quick_time_atom_is_last_atom (_tmp13_)) {
						_tmp12_ = TRUE;
					} else {
						QuickTimeAtom* _tmp14_;
						_tmp14_ = child;
						_tmp12_ = ((guint64) 0) == quick_time_atom_section_size_remaining (_tmp14_);
					}
					if (_tmp12_) {
						done = TRUE;
						break;
					}
					_tmp15_ = child;
					_tmp16_ = quick_time_atom_get_current_atom_name (_tmp15_);
					_tmp17_ = _tmp16_;
					_tmp18_ = g_strcmp0 ("mvhd", _tmp17_) == 0;
					_g_free0 (_tmp17_);
					if (_tmp18_) {
						QuickTimeAtom* _tmp19_;
						guint32 _tmp20_ = 0U;
						QuickTimeAtom* _tmp21_;
						_tmp19_ = child;
						quick_time_atom_read_uint32 (_tmp19_, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							_quick_time_atom_unref0 (child);
							goto __catch0_g_error;
						}
						_tmp21_ = child;
						_tmp20_ = quick_time_atom_read_uint32 (_tmp21_, &_inner_error0_);
						if (G_UNLIKELY (_inner_error0_ != NULL)) {
							_quick_time_atom_unref0 (child);
							goto __catch0_g_error;
						}
						if ((_tmp20_ - QUICK_TIME_METADATA_LOADER_QUICKTIME_EPOCH_ADJUSTMENT) < ((gint64) 0)) {
							guint32 _tmp22_ = 0U;
							QuickTimeAtom* _tmp23_;
							GDateTime* _tmp24_;
							_tmp23_ = child;
							_tmp22_ = quick_time_atom_read_uint32 (_tmp23_, &_inner_error0_);
							if (G_UNLIKELY (_inner_error0_ != NULL)) {
								_quick_time_atom_unref0 (child);
								goto __catch0_g_error;
							}
							_tmp24_ = g_date_time_new_from_unix_utc ((gint64) _tmp22_);
							_g_date_time_unref0 (timestamp);
							timestamp = _tmp24_;
						} else {
							guint32 _tmp25_ = 0U;
							QuickTimeAtom* _tmp26_;
							GDateTime* _tmp27_;
							_tmp26_ = child;
							_tmp25_ = quick_time_atom_read_uint32 (_tmp26_, &_inner_error0_);
							if (G_UNLIKELY (_inner_error0_ != NULL)) {
								_quick_time_atom_unref0 (child);
								goto __catch0_g_error;
							}
							_tmp27_ = g_date_time_new_from_unix_utc (_tmp25_ - QUICK_TIME_METADATA_LOADER_QUICKTIME_EPOCH_ADJUSTMENT);
							_g_date_time_unref0 (timestamp);
							timestamp = _tmp27_;
						}
						done = TRUE;
						break;
					}
					_tmp28_ = child;
					quick_time_atom_next_atom (_tmp28_, &_inner_error0_);
					if (G_UNLIKELY (_inner_error0_ != NULL)) {
						_quick_time_atom_unref0 (child);
						goto __catch0_g_error;
					}
				}
				_quick_time_atom_unref0 (child);
			}
			_tmp29_ = test;
			quick_time_atom_next_atom (_tmp29_, &_inner_error0_);
			if (G_UNLIKELY (_inner_error0_ != NULL)) {
				goto __catch0_g_error;
			}
		}
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* e = NULL;
		GError* _tmp30_;
		const gchar* _tmp31_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp30_ = e;
		_tmp31_ = _tmp30_->message;
		g_debug ("QuicktimeMetdataLoader.vala:116: Error while testing for QuickTime fil" \
"e: %s", _tmp31_);
		_g_error_free0 (e);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_date_time_unref0 (timestamp);
		_quick_time_atom_unref0 (test);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	{
		QuickTimeAtom* _tmp32_;
		_tmp32_ = test;
		quick_time_atom_close_file (_tmp32_, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* e = NULL;
		GError* _tmp33_;
		const gchar* _tmp34_;
		e = _inner_error0_;
		_inner_error0_ = NULL;
		_tmp33_ = e;
		_tmp34_ = _tmp33_->message;
		g_debug ("QuicktimeMetdataLoader.vala:122: Error while closing Quicktime file: %" \
"s", _tmp34_);
		_g_error_free0 (e);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		_g_date_time_unref0 (timestamp);
		_quick_time_atom_unref0 (test);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
		g_clear_error (&_inner_error0_);
		return NULL;
	}
	result = timestamp;
	_quick_time_atom_unref0 (test);
	return result;
}

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

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

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

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

static gchar*
value_quick_time_metadata_loader_collect_value (GValue* value,
                                                guint n_collect_values,
                                                GTypeCValue* collect_values,
                                                guint collect_flags)
{
	if (collect_values[0].v_pointer) {
		QuickTimeMetadataLoader * 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 = quick_time_metadata_loader_ref (object);
	} else {
		value->data[0].v_pointer = NULL;
	}
	return NULL;
}

static gchar*
value_quick_time_metadata_loader_lcopy_value (const GValue* value,
                                              guint n_collect_values,
                                              GTypeCValue* collect_values,
                                              guint collect_flags)
{
	QuickTimeMetadataLoader ** 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 = quick_time_metadata_loader_ref (value->data[0].v_pointer);
	}
	return NULL;
}

GParamSpec*
param_spec_quick_time_metadata_loader (const gchar* name,
                                       const gchar* nick,
                                       const gchar* blurb,
                                       GType object_type,
                                       GParamFlags flags)
{
	ParamSpecQuickTimeMetadataLoader* spec;
	g_return_val_if_fail (g_type_is_a (object_type, TYPE_QUICK_TIME_METADATA_LOADER), 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
value_get_quick_time_metadata_loader (const GValue* value)
{
	g_return_val_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_QUICK_TIME_METADATA_LOADER), NULL);
	return value->data[0].v_pointer;
}

void
value_set_quick_time_metadata_loader (GValue* value,
                                      gpointer v_object)
{
	QuickTimeMetadataLoader * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_QUICK_TIME_METADATA_LOADER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_QUICK_TIME_METADATA_LOADER));
		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;
		quick_time_metadata_loader_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		quick_time_metadata_loader_unref (old);
	}
}

void
value_take_quick_time_metadata_loader (GValue* value,
                                       gpointer v_object)
{
	QuickTimeMetadataLoader * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, TYPE_QUICK_TIME_METADATA_LOADER));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, TYPE_QUICK_TIME_METADATA_LOADER));
		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) {
		quick_time_metadata_loader_unref (old);
	}
}

static void
quick_time_metadata_loader_class_init (QuickTimeMetadataLoaderClass * klass,
                                       gpointer klass_data)
{
	quick_time_metadata_loader_parent_class = g_type_class_peek_parent (klass);
	((QuickTimeMetadataLoaderClass *) klass)->finalize = quick_time_metadata_loader_finalize;
	g_type_class_adjust_private_offset (klass, &QuickTimeMetadataLoader_private_offset);
}

static void
quick_time_metadata_loader_instance_init (QuickTimeMetadataLoader * self,
                                          gpointer klass)
{
	self->priv = quick_time_metadata_loader_get_instance_private (self);
	self->priv->file = NULL;
	self->ref_count = 1;
}

static void
quick_time_metadata_loader_finalize (QuickTimeMetadataLoader * obj)
{
	QuickTimeMetadataLoader * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TYPE_QUICK_TIME_METADATA_LOADER, QuickTimeMetadataLoader);
	g_signal_handlers_destroy (self);
	_g_object_unref0 (self->priv->file);
}

static GType
quick_time_metadata_loader_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { value_quick_time_metadata_loader_init, value_quick_time_metadata_loader_free_value, value_quick_time_metadata_loader_copy_value, value_quick_time_metadata_loader_peek_pointer, "p", value_quick_time_metadata_loader_collect_value, "p", value_quick_time_metadata_loader_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (QuickTimeMetadataLoaderClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) quick_time_metadata_loader_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (QuickTimeMetadataLoader), 0, (GInstanceInitFunc) quick_time_metadata_loader_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 quick_time_metadata_loader_type_id;
	quick_time_metadata_loader_type_id = g_type_register_fundamental (g_type_fundamental_next (), "QuickTimeMetadataLoader", &g_define_type_info, &g_define_type_fundamental_info, 0);
	QuickTimeMetadataLoader_private_offset = g_type_add_instance_private (quick_time_metadata_loader_type_id, sizeof (QuickTimeMetadataLoaderPrivate));
	return quick_time_metadata_loader_type_id;
}

GType
quick_time_metadata_loader_get_type (void)
{
	static volatile gsize quick_time_metadata_loader_type_id__once = 0;
	if (g_once_init_enter (&quick_time_metadata_loader_type_id__once)) {
		GType quick_time_metadata_loader_type_id;
		quick_time_metadata_loader_type_id = quick_time_metadata_loader_get_type_once ();
		g_once_init_leave (&quick_time_metadata_loader_type_id__once, quick_time_metadata_loader_type_id);
	}
	return quick_time_metadata_loader_type_id__once;
}

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

void
quick_time_metadata_loader_unref (gpointer instance)
{
	QuickTimeMetadataLoader * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		QUICK_TIME_METADATA_LOADER_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

