/* rygel-simple-media-engine.c generated by valac 0.56.1, the Vala compiler
 * generated from rygel-simple-media-engine.vala, do not modify */

/*
 * Copyright (C) 2012 Intel Corporation.
 * Copyright (C) 2013 Cable Television Laboratories, Inc.
 *
 * Author: Jens Georg <jensg@openismus.com>
 *         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 "rygel-server.h"
#include <glib-object.h>
#include <glib.h>
#include "rygel-core.h"
#include <gio/gio.h>
#include <gee.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <libgupnp-av/gupnp-av.h>
#include "rygel-media-engine-simple.h"

#define RYGEL_TYPE_SIMPLE_MEDIA_ENGINE (rygel_simple_media_engine_get_type ())
#define RYGEL_SIMPLE_MEDIA_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SIMPLE_MEDIA_ENGINE, RygelSimpleMediaEngine))
#define RYGEL_SIMPLE_MEDIA_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SIMPLE_MEDIA_ENGINE, RygelSimpleMediaEngineClass))
#define RYGEL_IS_SIMPLE_MEDIA_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SIMPLE_MEDIA_ENGINE))
#define RYGEL_IS_SIMPLE_MEDIA_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SIMPLE_MEDIA_ENGINE))
#define RYGEL_SIMPLE_MEDIA_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SIMPLE_MEDIA_ENGINE, RygelSimpleMediaEngineClass))

typedef struct _RygelSimpleMediaEngine RygelSimpleMediaEngine;
typedef struct _RygelSimpleMediaEngineClass RygelSimpleMediaEngineClass;
typedef struct _RygelSimpleMediaEnginePrivate RygelSimpleMediaEnginePrivate;

#define RYGEL_TYPE_SIMPLE_DATA_SOURCE (rygel_simple_data_source_get_type ())
#define RYGEL_SIMPLE_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SIMPLE_DATA_SOURCE, RygelSimpleDataSource))
#define RYGEL_SIMPLE_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SIMPLE_DATA_SOURCE, RygelSimpleDataSourceClass))
#define RYGEL_IS_SIMPLE_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SIMPLE_DATA_SOURCE))
#define RYGEL_IS_SIMPLE_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SIMPLE_DATA_SOURCE))
#define RYGEL_SIMPLE_DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SIMPLE_DATA_SOURCE, RygelSimpleDataSourceClass))

typedef struct _RygelSimpleDataSource RygelSimpleDataSource;
typedef struct _RygelSimpleDataSourceClass RygelSimpleDataSourceClass;
enum  {
	RYGEL_SIMPLE_MEDIA_ENGINE_0_PROPERTY,
	RYGEL_SIMPLE_MEDIA_ENGINE_NUM_PROPERTIES
};
static GParamSpec* rygel_simple_media_engine_properties[RYGEL_SIMPLE_MEDIA_ENGINE_NUM_PROPERTIES];
#define _g_thread_pool_free0(var) ((var == NULL) ? NULL : (var = (g_thread_pool_free (var, FALSE, TRUE), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _RygelSimpleMediaEngineGetResourcesForItemData RygelSimpleMediaEngineGetResourcesForItemData;

struct _RygelSimpleMediaEngine {
	RygelMediaEngine parent_instance;
	RygelSimpleMediaEnginePrivate * priv;
};

struct _RygelSimpleMediaEngineClass {
	RygelMediaEngineClass parent_class;
};

struct _RygelSimpleMediaEnginePrivate {
	GList* profiles;
	GThreadPool* pool;
};

struct _RygelSimpleMediaEngineGetResourcesForItemData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelSimpleMediaEngine* self;
	RygelMediaObject* object;
	GeeList* result;
	RygelMediaFileItem* item;
	RygelMediaFileItem* _tmp0_;
	gchar* source_uri;
	RygelMediaFileItem* _tmp1_;
	gchar* _tmp2_;
	const gchar* _tmp3_;
	GeeArrayList* resources;
	GeeArrayList* _tmp4_;
	RygelMediaResource* primary_res;
	RygelMediaFileItem* _tmp5_;
	RygelMediaResource* _tmp6_;
	const gchar* _tmp7_;
	RygelMediaResource* _tmp8_;
	RygelMediaResource* _tmp9_;
	RygelMediaResource* _tmp10_;
	GUPnPDLNAFlags _tmp11_;
	GUPnPDLNAFlags _tmp12_;
	RygelMediaResource* http_res;
	RygelMediaResource* _tmp13_;
	RygelMediaResource* _tmp14_;
	RygelMediaResource* _tmp15_;
	GeeArrayList* _tmp16_;
	RygelMediaResource* _tmp17_;
	GeeArrayList* _tmp18_;
	RygelMediaResource* _tmp19_;
};

static gint RygelSimpleMediaEngine_private_offset;
static gpointer rygel_simple_media_engine_parent_class = NULL;

VALA_EXTERN GType rygel_simple_media_engine_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType rygel_simple_data_source_get_type (void) G_GNUC_CONST ;
static void _rygel_dlna_profile_unref0_ (gpointer var);
static inline void _g_list_free__rygel_dlna_profile_unref0_ (GList* self);
static void rygel_simple_media_engine_real_constructed (GObject* base);
VALA_EXTERN void rygel_simple_data_source_pool_func (RygelSimpleDataSource* data);
static void _rygel_simple_data_source_pool_func_gfunc (gpointer data,
                                                gpointer self);
static GList* rygel_simple_media_engine_real_get_dlna_profiles (RygelMediaEngine* base);
static void rygel_simple_media_engine_real_get_resources_for_item_data_free (gpointer _data);
static void rygel_simple_media_engine_real_get_resources_for_item (RygelMediaEngine* base,
                                                            RygelMediaObject* object,
                                                            GAsyncReadyCallback _callback_,
                                                            gpointer _user_data_);
static gboolean rygel_simple_media_engine_real_get_resources_for_item_co (RygelSimpleMediaEngineGetResourcesForItemData* _data_);
static RygelDataSource* rygel_simple_media_engine_real_create_data_source_for_resource (RygelMediaEngine* base,
                                                                                 RygelMediaObject* object,
                                                                                 RygelMediaResource* resource,
                                                                                 GHashTable* replacements,
                                                                                 GError** error);
VALA_EXTERN RygelSimpleDataSource* rygel_simple_data_source_new (GThreadPool* pool,
                                                     const gchar* uri);
VALA_EXTERN RygelSimpleDataSource* rygel_simple_data_source_construct (GType object_type,
                                                           GThreadPool* pool,
                                                           const gchar* uri);
static RygelDataSource* rygel_simple_media_engine_real_create_data_source_for_uri (RygelMediaEngine* base,
                                                                            const gchar* uri,
                                                                            GError** error);
VALA_EXTERN RygelSimpleMediaEngine* rygel_simple_media_engine_new (void);
VALA_EXTERN RygelSimpleMediaEngine* rygel_simple_media_engine_construct (GType object_type);
static void rygel_simple_media_engine_finalize (GObject * obj);
static GType rygel_simple_media_engine_get_type_once (void);

static inline gpointer
rygel_simple_media_engine_get_instance_private (RygelSimpleMediaEngine* self)
{
	return G_STRUCT_MEMBER_P (self, RygelSimpleMediaEngine_private_offset);
}

static void
_rygel_dlna_profile_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (rygel_dlna_profile_unref (var), NULL));
}

static inline void
_g_list_free__rygel_dlna_profile_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _rygel_dlna_profile_unref0_);
}

static void
_rygel_simple_data_source_pool_func_gfunc (gpointer data,
                                           gpointer self)
{
	rygel_simple_data_source_pool_func ((RygelSimpleDataSource*) data);
}

static void
rygel_simple_media_engine_real_constructed (GObject* base)
{
	RygelSimpleMediaEngine * self;
	GError* _inner_error0_ = NULL;
	self = (RygelSimpleMediaEngine*) base;
	(self->priv->profiles == NULL) ? NULL : (self->priv->profiles = (_g_list_free__rygel_dlna_profile_unref0_ (self->priv->profiles), NULL));
	self->priv->profiles = NULL;
	{
		GThreadPool* _tmp0_ = NULL;
		GThreadPool* _tmp1_;
		GThreadPool* _tmp2_;
		_tmp1_ = g_thread_pool_new (_rygel_simple_data_source_pool_func_gfunc, NULL, 10, TRUE, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		_g_thread_pool_free0 (self->priv->pool);
		self->priv->pool = _tmp2_;
		_g_thread_pool_free0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
		g_debug ("rygel-simple-media-engine.vala:46: Failed to create pool");
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		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;
	}
}

static GList*
rygel_simple_media_engine_real_get_dlna_profiles (RygelMediaEngine* base)
{
	RygelSimpleMediaEngine * self;
	GList* _tmp0_;
	GList* result;
	self = (RygelSimpleMediaEngine*) base;
	_tmp0_ = self->priv->profiles;
	result = _tmp0_;
	return result;
}

static void
rygel_simple_media_engine_real_get_resources_for_item_data_free (gpointer _data)
{
	RygelSimpleMediaEngineGetResourcesForItemData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->object);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelSimpleMediaEngineGetResourcesForItemData, _data_);
}

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

static void
rygel_simple_media_engine_real_get_resources_for_item (RygelMediaEngine* base,
                                                       RygelMediaObject* object,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_)
{
	RygelSimpleMediaEngine * self;
	RygelSimpleMediaEngineGetResourcesForItemData* _data_;
	RygelSimpleMediaEngine* _tmp0_;
	RygelMediaObject* _tmp1_;
	g_return_if_fail (object != NULL);
	self = (RygelSimpleMediaEngine*) base;
	_data_ = g_slice_new0 (RygelSimpleMediaEngineGetResourcesForItemData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_simple_media_engine_real_get_resources_for_item_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (object);
	_g_object_unref0 (_data_->object);
	_data_->object = _tmp1_;
	rygel_simple_media_engine_real_get_resources_for_item_co (_data_);
}

static GeeList*
rygel_simple_media_engine_get_resources_for_item_finish (RygelMediaEngine* base,
                                                         GAsyncResult* _res_)
{
	GeeList* result;
	RygelSimpleMediaEngineGetResourcesForItemData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static gboolean
rygel_simple_media_engine_real_get_resources_for_item_co (RygelSimpleMediaEngineGetResourcesForItemData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!G_TYPE_CHECK_INSTANCE_TYPE (_data_->object, RYGEL_TYPE_MEDIA_FILE_ITEM)) {
		g_warning ("rygel-simple-media-engine.vala:57: %s", _ ("Can only process file-based MediaObjects (MediaFileItems)"));
		_data_->result = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (!g_task_get_completed (_data_->_async_result)) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp0_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->object, RYGEL_TYPE_MEDIA_FILE_ITEM) ? ((RygelMediaFileItem*) _data_->object) : NULL);
	_data_->item = _data_->_tmp0_;
	_data_->_tmp1_ = _data_->item;
	_data_->_tmp2_ = rygel_media_object_get_primary_uri ((RygelMediaObject*) _data_->_tmp1_);
	_data_->source_uri = _data_->_tmp2_;
	_data_->_tmp3_ = _data_->source_uri;
	g_debug ("rygel-simple-media-engine.vala:67: get_resources_for_item (%s)", _data_->_tmp3_);
	_data_->_tmp4_ = gee_array_list_new (RYGEL_TYPE_MEDIA_RESOURCE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_data_->resources = _data_->_tmp4_;
	_data_->_tmp5_ = _data_->item;
	_data_->_tmp6_ = rygel_media_file_item_get_primary_resource (_data_->_tmp5_);
	_data_->primary_res = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->source_uri;
	if (g_str_has_prefix (_data_->_tmp7_, "file://")) {
		_data_->_tmp8_ = _data_->primary_res;
		rygel_media_resource_set_dlna_operation (_data_->_tmp8_, GUPNP_DLNA_OPERATION_RANGE);
		_data_->_tmp9_ = _data_->primary_res;
		_data_->_tmp10_ = _data_->primary_res;
		_data_->_tmp11_ = rygel_media_resource_get_dlna_flags (_data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		rygel_media_resource_set_dlna_flags (_data_->_tmp10_, _data_->_tmp12_ | GUPNP_DLNA_FLAGS_CONNECTION_STALL);
		_data_->_tmp13_ = _data_->primary_res;
		_data_->_tmp14_ = rygel_media_resource_new_from_resource ("primary_http", _data_->_tmp13_);
		_data_->http_res = _data_->_tmp14_;
		_data_->_tmp15_ = _data_->http_res;
		rygel_media_resource_set_uri (_data_->_tmp15_, "");
		_data_->_tmp16_ = _data_->resources;
		_data_->_tmp17_ = _data_->http_res;
		gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp16_, _data_->_tmp17_);
		_g_object_unref0 (_data_->http_res);
	}
	_data_->_tmp18_ = _data_->resources;
	_data_->_tmp19_ = _data_->primary_res;
	gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp18_, _data_->_tmp19_);
	_data_->result = (GeeList*) _data_->resources;
	_g_object_unref0 (_data_->primary_res);
	_g_free0 (_data_->source_uri);
	_g_object_unref0 (_data_->item);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

static RygelDataSource*
rygel_simple_media_engine_real_create_data_source_for_resource (RygelMediaEngine* base,
                                                                RygelMediaObject* object,
                                                                RygelMediaResource* resource,
                                                                GHashTable* replacements,
                                                                GError** error)
{
	RygelSimpleMediaEngine * self;
	gchar* source_uri = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	GThreadPool* _tmp4_;
	const gchar* _tmp5_;
	RygelSimpleDataSource* _tmp6_;
	RygelDataSource* result;
	self = (RygelSimpleMediaEngine*) base;
	g_return_val_if_fail (object != NULL, NULL);
	g_return_val_if_fail (resource != NULL, NULL);
	g_return_val_if_fail (replacements != NULL, NULL);
	if (!G_TYPE_CHECK_INSTANCE_TYPE (object, RYGEL_TYPE_MEDIA_FILE_ITEM)) {
		g_warning ("rygel-simple-media-engine.vala:99: %s", _ ("Can only process file-based MediaObjects (MediaFileItems)"));
		result = NULL;
		return result;
	}
	_tmp0_ = rygel_media_object_get_primary_uri (object);
	_tmp1_ = _tmp0_;
	_tmp2_ = rygel_media_object_apply_replacements (replacements, _tmp1_);
	_tmp3_ = _tmp2_;
	_g_free0 (_tmp1_);
	source_uri = _tmp3_;
	_tmp4_ = self->priv->pool;
	_tmp5_ = source_uri;
	_tmp6_ = rygel_simple_data_source_new (_tmp4_, _tmp5_);
	result = (RygelDataSource*) _tmp6_;
	_g_free0 (source_uri);
	return result;
}

static RygelDataSource*
rygel_simple_media_engine_real_create_data_source_for_uri (RygelMediaEngine* base,
                                                           const gchar* uri,
                                                           GError** error)
{
	RygelSimpleMediaEngine * self;
	GThreadPool* _tmp0_;
	RygelSimpleDataSource* _tmp1_;
	RygelDataSource* result;
	self = (RygelSimpleMediaEngine*) base;
	g_return_val_if_fail (uri != NULL, NULL);
	if (!g_str_has_prefix (uri, "file://")) {
		result = NULL;
		return result;
	}
	g_debug ("rygel-simple-media-engine.vala:115: creating data source for %s", uri);
	_tmp0_ = self->priv->pool;
	_tmp1_ = rygel_simple_data_source_new (_tmp0_, uri);
	result = (RygelDataSource*) _tmp1_;
	return result;
}

RygelSimpleMediaEngine*
rygel_simple_media_engine_construct (GType object_type)
{
	RygelSimpleMediaEngine * self = NULL;
	self = (RygelSimpleMediaEngine*) rygel_media_engine_construct (object_type);
	return self;
}

RygelSimpleMediaEngine*
rygel_simple_media_engine_new (void)
{
	return rygel_simple_media_engine_construct (RYGEL_TYPE_SIMPLE_MEDIA_ENGINE);
}

static void
rygel_simple_media_engine_class_init (RygelSimpleMediaEngineClass * klass,
                                      gpointer klass_data)
{
	rygel_simple_media_engine_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RygelSimpleMediaEngine_private_offset);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) rygel_simple_media_engine_real_constructed;
	((RygelMediaEngineClass *) klass)->get_dlna_profiles = (GList* (*) (RygelMediaEngine*)) rygel_simple_media_engine_real_get_dlna_profiles;
	((RygelMediaEngineClass *) klass)->get_resources_for_item = (void (*) (RygelMediaEngine*, RygelMediaObject*, GAsyncReadyCallback, gpointer)) rygel_simple_media_engine_real_get_resources_for_item;
	((RygelMediaEngineClass *) klass)->get_resources_for_item_finish = (GeeList* (*) (RygelMediaEngine*, GAsyncResult*)) rygel_simple_media_engine_get_resources_for_item_finish;
	((RygelMediaEngineClass *) klass)->create_data_source_for_resource = (RygelDataSource* (*) (RygelMediaEngine*, RygelMediaObject*, RygelMediaResource*, GHashTable*, GError**)) rygel_simple_media_engine_real_create_data_source_for_resource;
	((RygelMediaEngineClass *) klass)->create_data_source_for_uri = (RygelDataSource* (*) (RygelMediaEngine*, const gchar*, GError**)) rygel_simple_media_engine_real_create_data_source_for_uri;
	G_OBJECT_CLASS (klass)->finalize = rygel_simple_media_engine_finalize;
}

static void
rygel_simple_media_engine_instance_init (RygelSimpleMediaEngine * self,
                                         gpointer klass)
{
	self->priv = rygel_simple_media_engine_get_instance_private (self);
}

static void
rygel_simple_media_engine_finalize (GObject * obj)
{
	RygelSimpleMediaEngine * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_SIMPLE_MEDIA_ENGINE, RygelSimpleMediaEngine);
	(self->priv->profiles == NULL) ? NULL : (self->priv->profiles = (_g_list_free__rygel_dlna_profile_unref0_ (self->priv->profiles), NULL));
	_g_thread_pool_free0 (self->priv->pool);
	G_OBJECT_CLASS (rygel_simple_media_engine_parent_class)->finalize (obj);
}

/**
 * The simple media engine does not use GStreamer or any other
 * multimedia framework. Therefore its capabilities are limited.
 *
 * It does not support transcoding - get_resources() returns null.
 * Also, its RygelSimpleDataSource does not support time-base seeking.
 */
static GType
rygel_simple_media_engine_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelSimpleMediaEngineClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_simple_media_engine_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelSimpleMediaEngine), 0, (GInstanceInitFunc) rygel_simple_media_engine_instance_init, NULL };
	GType rygel_simple_media_engine_type_id;
	rygel_simple_media_engine_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_ENGINE, "RygelSimpleMediaEngine", &g_define_type_info, 0);
	RygelSimpleMediaEngine_private_offset = g_type_add_instance_private (rygel_simple_media_engine_type_id, sizeof (RygelSimpleMediaEnginePrivate));
	return rygel_simple_media_engine_type_id;
}

GType
rygel_simple_media_engine_get_type (void)
{
	static volatile gsize rygel_simple_media_engine_type_id__once = 0;
	if (g_once_init_enter (&rygel_simple_media_engine_type_id__once)) {
		GType rygel_simple_media_engine_type_id;
		rygel_simple_media_engine_type_id = rygel_simple_media_engine_get_type_once ();
		g_once_init_leave (&rygel_simple_media_engine_type_id__once, rygel_simple_media_engine_type_id);
	}
	return rygel_simple_media_engine_type_id__once;
}

RygelMediaEngine*
module_get_instance (void)
{
	RygelSimpleMediaEngine* _tmp0_;
	RygelMediaEngine* result;
	_tmp0_ = rygel_simple_media_engine_new ();
	result = (RygelMediaEngine*) _tmp0_;
	return result;
}

