/* rygel-source-connection-manager.c generated by valac 0.15.1.36-84b2b, the Vala compiler
 * generated from rygel-source-connection-manager.vala, do not modify */

/*
 * Copyright (C) 2009 Nokia Corporation.
 * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *
 * 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 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 program; 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 <libgupnp/gupnp.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <libgupnp-av/gupnp-av.h>
#include <gst/gst.h>
#include <libgupnp-dlna/gupnp-dlna-discoverer.h>
#include <libgupnp-dlna/gupnp-dlna-profile.h>
#include <gio/gio.h>


#define RYGEL_TYPE_CONNECTION_MANAGER (rygel_connection_manager_get_type ())
#define RYGEL_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_CONNECTION_MANAGER, RygelConnectionManager))
#define RYGEL_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_CONNECTION_MANAGER, RygelConnectionManagerClass))
#define RYGEL_IS_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_CONNECTION_MANAGER))
#define RYGEL_IS_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_CONNECTION_MANAGER))
#define RYGEL_CONNECTION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_CONNECTION_MANAGER, RygelConnectionManagerClass))

typedef struct _RygelConnectionManager RygelConnectionManager;
typedef struct _RygelConnectionManagerClass RygelConnectionManagerClass;
typedef struct _RygelConnectionManagerPrivate RygelConnectionManagerPrivate;

#define RYGEL_TYPE_SOURCE_CONNECTION_MANAGER (rygel_source_connection_manager_get_type ())
#define RYGEL_SOURCE_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER, RygelSourceConnectionManager))
#define RYGEL_SOURCE_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER, RygelSourceConnectionManagerClass))
#define RYGEL_IS_SOURCE_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER))
#define RYGEL_IS_SOURCE_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER))
#define RYGEL_SOURCE_CONNECTION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SOURCE_CONNECTION_MANAGER, RygelSourceConnectionManagerClass))

typedef struct _RygelSourceConnectionManager RygelSourceConnectionManager;
typedef struct _RygelSourceConnectionManagerClass RygelSourceConnectionManagerClass;
typedef struct _RygelSourceConnectionManagerPrivate RygelSourceConnectionManagerPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define RYGEL_TYPE_TRANSCODE_MANAGER (rygel_transcode_manager_get_type ())
#define RYGEL_TRANSCODE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_TRANSCODE_MANAGER, RygelTranscodeManager))
#define RYGEL_TRANSCODE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_TRANSCODE_MANAGER, RygelTranscodeManagerClass))
#define RYGEL_IS_TRANSCODE_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_TRANSCODE_MANAGER))
#define RYGEL_IS_TRANSCODE_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_TRANSCODE_MANAGER))
#define RYGEL_TRANSCODE_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_TRANSCODE_MANAGER, RygelTranscodeManagerClass))

typedef struct _RygelTranscodeManager RygelTranscodeManager;
typedef struct _RygelTranscodeManagerClass RygelTranscodeManagerClass;

#define RYGEL_TYPE_HTTP_SERVER (rygel_http_server_get_type ())
#define RYGEL_HTTP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_HTTP_SERVER, RygelHTTPServer))
#define RYGEL_HTTP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_HTTP_SERVER, RygelHTTPServerClass))
#define RYGEL_IS_HTTP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_HTTP_SERVER))
#define RYGEL_IS_HTTP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_HTTP_SERVER))
#define RYGEL_HTTP_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_HTTP_SERVER, RygelHTTPServerClass))

typedef struct _RygelHTTPServer RygelHTTPServer;
typedef struct _RygelHTTPServerClass RygelHTTPServerClass;

#define RYGEL_TYPE_ROOT_DEVICE (rygel_root_device_get_type ())
#define RYGEL_ROOT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_ROOT_DEVICE, RygelRootDevice))
#define RYGEL_ROOT_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_ROOT_DEVICE, RygelRootDeviceClass))
#define RYGEL_IS_ROOT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_ROOT_DEVICE))
#define RYGEL_IS_ROOT_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_ROOT_DEVICE))
#define RYGEL_ROOT_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_ROOT_DEVICE, RygelRootDeviceClass))

typedef struct _RygelRootDevice RygelRootDevice;
typedef struct _RygelRootDeviceClass RygelRootDeviceClass;
typedef struct _RygelRootDevicePrivate RygelRootDevicePrivate;

#define RYGEL_TYPE_CONTENT_DIRECTORY (rygel_content_directory_get_type ())
#define RYGEL_CONTENT_DIRECTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectory))
#define RYGEL_CONTENT_DIRECTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectoryClass))
#define RYGEL_IS_CONTENT_DIRECTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_CONTENT_DIRECTORY))
#define RYGEL_IS_CONTENT_DIRECTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_CONTENT_DIRECTORY))
#define RYGEL_CONTENT_DIRECTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectoryClass))

typedef struct _RygelContentDirectory RygelContentDirectory;
typedef struct _RygelContentDirectoryClass RygelContentDirectoryClass;
typedef struct _RygelContentDirectoryPrivate RygelContentDirectoryPrivate;

#define RYGEL_TYPE_MEDIA_OBJECT (rygel_media_object_get_type ())
#define RYGEL_MEDIA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_OBJECT, RygelMediaObject))
#define RYGEL_MEDIA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_OBJECT, RygelMediaObjectClass))
#define RYGEL_IS_MEDIA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_OBJECT))
#define RYGEL_IS_MEDIA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_OBJECT))
#define RYGEL_MEDIA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_OBJECT, RygelMediaObjectClass))

typedef struct _RygelMediaObject RygelMediaObject;
typedef struct _RygelMediaObjectClass RygelMediaObjectClass;

#define RYGEL_TYPE_MEDIA_CONTAINER (rygel_media_container_get_type ())
#define RYGEL_MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_CONTAINER, RygelMediaContainer))
#define RYGEL_MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_CONTAINER, RygelMediaContainerClass))
#define RYGEL_IS_MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_CONTAINER))
#define RYGEL_IS_MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_CONTAINER))
#define RYGEL_MEDIA_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_CONTAINER, RygelMediaContainerClass))

typedef struct _RygelMediaContainer RygelMediaContainer;
typedef struct _RygelMediaContainerClass RygelMediaContainerClass;

struct _RygelConnectionManager {
	GUPnPService parent_instance;
	RygelConnectionManagerPrivate * priv;
	gchar* sink_protocol_info;
	gchar* connection_ids;
	gchar* source_protocol_info;
	gint rcs_id;
	gint av_transport_id;
	gchar* direction;
};

struct _RygelConnectionManagerClass {
	GUPnPServiceClass parent_class;
};

struct _RygelSourceConnectionManager {
	RygelConnectionManager parent_instance;
	RygelSourceConnectionManagerPrivate * priv;
};

struct _RygelSourceConnectionManagerClass {
	RygelConnectionManagerClass parent_class;
};

struct _RygelRootDevice {
	GUPnPRootDevice parent_instance;
	RygelRootDevicePrivate * priv;
	GeeArrayList* services;
};

struct _RygelRootDeviceClass {
	GUPnPRootDeviceClass parent_class;
};

struct _RygelContentDirectory {
	GUPnPService parent_instance;
	RygelContentDirectoryPrivate * priv;
	gchar* feature_list;
	RygelHTTPServer* http_server;
	RygelMediaContainer* root_container;
	GCancellable* cancellable;
	guint32 system_update_id;
};

struct _RygelContentDirectoryClass {
	GUPnPServiceClass parent_class;
};


static gpointer rygel_source_connection_manager_parent_class = NULL;

GType rygel_connection_manager_get_type (void) G_GNUC_CONST;
GType rygel_source_connection_manager_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_SOURCE_CONNECTION_MANAGER_DUMMY_PROPERTY
};
static void rygel_source_connection_manager_real_constructed (GObject* base);
static GeeArrayList* rygel_source_connection_manager_get_protocol_info (RygelSourceConnectionManager* self);
GType rygel_transcode_manager_get_type (void) G_GNUC_CONST;
GType rygel_http_server_get_type (void) G_GNUC_CONST;
static RygelHTTPServer* rygel_source_connection_manager_get_http_server (RygelSourceConnectionManager* self);
GeeArrayList* rygel_transcode_manager_get_protocol_info (RygelTranscodeManager* self);
gchar* rygel_transcode_manager_get_protocol (RygelTranscodeManager* self);
GType rygel_root_device_get_type (void) G_GNUC_CONST;
GType rygel_content_directory_get_type (void) G_GNUC_CONST;
GType rygel_media_object_get_type (void) G_GNUC_CONST;
GType rygel_media_container_get_type (void) G_GNUC_CONST;
RygelSourceConnectionManager* rygel_source_connection_manager_new (void);
RygelSourceConnectionManager* rygel_source_connection_manager_construct (GType object_type);
RygelConnectionManager* rygel_connection_manager_new (void);
RygelConnectionManager* rygel_connection_manager_construct (GType object_type);


static void rygel_source_connection_manager_real_constructed (GObject* base) {
	RygelSourceConnectionManager * self;
	gchar* _tmp0_;
	self = (RygelSourceConnectionManager*) base;
	G_OBJECT_CLASS (rygel_source_connection_manager_parent_class)->constructed ((GObject*) RYGEL_CONNECTION_MANAGER (self));
	((RygelConnectionManager*) self)->rcs_id = -1;
	((RygelConnectionManager*) self)->av_transport_id = -1;
	_tmp0_ = g_strdup ("Output");
	_g_free0 (((RygelConnectionManager*) self)->direction);
	((RygelConnectionManager*) self)->direction = _tmp0_;
	{
		GeeArrayList* _tmp1_ = NULL;
		GeeArrayList* _protocol_info_list;
		GeeArrayList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _protocol_info_size;
		gint _protocol_info_index;
		_tmp1_ = rygel_source_connection_manager_get_protocol_info (self);
		_protocol_info_list = _tmp1_;
		_tmp2_ = _protocol_info_list;
		_tmp3_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_protocol_info_size = _tmp4_;
		_protocol_info_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			gint _tmp7_;
			GeeArrayList* _tmp8_;
			gint _tmp9_;
			gpointer _tmp10_ = NULL;
			GUPnPProtocolInfo* protocol_info;
			const gchar* _tmp11_;
			const gchar* _tmp14_;
			GUPnPProtocolInfo* _tmp15_;
			gchar* _tmp16_ = NULL;
			gchar* _tmp17_;
			gchar* _tmp18_;
			_tmp5_ = _protocol_info_index;
			_protocol_info_index = _tmp5_ + 1;
			_tmp6_ = _protocol_info_index;
			_tmp7_ = _protocol_info_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _protocol_info_list;
			_tmp9_ = _protocol_info_index;
			_tmp10_ = gee_abstract_list_get ((GeeAbstractList*) _tmp8_, _tmp9_);
			protocol_info = (GUPnPProtocolInfo*) _tmp10_;
			_tmp11_ = ((RygelConnectionManager*) self)->source_protocol_info;
			if (g_strcmp0 (_tmp11_, "") != 0) {
				const gchar* _tmp12_;
				gchar* _tmp13_;
				_tmp12_ = ((RygelConnectionManager*) self)->source_protocol_info;
				_tmp13_ = g_strconcat (_tmp12_, ",", NULL);
				_g_free0 (((RygelConnectionManager*) self)->source_protocol_info);
				((RygelConnectionManager*) self)->source_protocol_info = _tmp13_;
			}
			_tmp14_ = ((RygelConnectionManager*) self)->source_protocol_info;
			_tmp15_ = protocol_info;
			_tmp16_ = gupnp_protocol_info_to_string (_tmp15_);
			_tmp17_ = _tmp16_;
			_tmp18_ = g_strconcat (_tmp14_, _tmp17_, NULL);
			_g_free0 (((RygelConnectionManager*) self)->source_protocol_info);
			((RygelConnectionManager*) self)->source_protocol_info = _tmp18_;
			_g_free0 (_tmp17_);
			_g_object_unref0 (protocol_info);
		}
		_g_object_unref0 (_protocol_info_list);
	}
}


static GeeArrayList* rygel_source_connection_manager_get_protocol_info (RygelSourceConnectionManager* self) {
	GeeArrayList* result = NULL;
	RygelHTTPServer* _tmp0_ = NULL;
	RygelHTTPServer* server;
	RygelHTTPServer* _tmp1_;
	GeeArrayList* _tmp2_ = NULL;
	GeeArrayList* protocol_infos;
	GUPnPDLNADiscoverer* _tmp3_;
	GUPnPDLNADiscoverer* discoverer;
	RygelHTTPServer* _tmp4_;
	gchar* _tmp5_ = NULL;
	gchar* protocol;
	GUPnPDLNADiscoverer* _tmp6_;
	GList* _tmp7_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = rygel_source_connection_manager_get_http_server (self);
	server = _tmp0_;
	_tmp1_ = server;
	_tmp2_ = rygel_transcode_manager_get_protocol_info ((RygelTranscodeManager*) _tmp1_);
	protocol_infos = _tmp2_;
	_tmp3_ = gupnp_dlna_discoverer_new ((GstClockTime) GST_SECOND, TRUE, FALSE);
	discoverer = _tmp3_;
	_tmp4_ = server;
	_tmp5_ = rygel_transcode_manager_get_protocol ((RygelTranscodeManager*) _tmp4_);
	protocol = _tmp5_;
	_tmp6_ = discoverer;
	_tmp7_ = gupnp_dlna_discoverer_list_profiles (_tmp6_);
	{
		GList* profile_collection = NULL;
		GList* profile_it = NULL;
		profile_collection = _tmp7_;
		for (profile_it = profile_collection; profile_it != NULL; profile_it = profile_it->next) {
			GUPnPDLNAProfile* profile = NULL;
			profile = (GUPnPDLNAProfile*) profile_it->data;
			{
				GUPnPProtocolInfo* _tmp8_;
				GUPnPProtocolInfo* protocol_info;
				GUPnPProtocolInfo* _tmp9_;
				const gchar* _tmp10_;
				GUPnPProtocolInfo* _tmp11_;
				GUPnPDLNAProfile* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				GUPnPProtocolInfo* _tmp15_;
				GUPnPDLNAProfile* _tmp16_;
				const gchar* _tmp17_;
				const gchar* _tmp18_;
				GeeArrayList* _tmp19_;
				GUPnPProtocolInfo* _tmp20_;
				gboolean _tmp21_ = FALSE;
				_tmp8_ = gupnp_protocol_info_new ();
				protocol_info = _tmp8_;
				_tmp9_ = protocol_info;
				_tmp10_ = protocol;
				gupnp_protocol_info_set_protocol (_tmp9_, _tmp10_);
				_tmp11_ = protocol_info;
				_tmp12_ = profile;
				_tmp13_ = gupnp_dlna_profile_get_mime (_tmp12_);
				_tmp14_ = _tmp13_;
				gupnp_protocol_info_set_mime_type (_tmp11_, _tmp14_);
				_tmp15_ = protocol_info;
				_tmp16_ = profile;
				_tmp17_ = gupnp_dlna_profile_get_name (_tmp16_);
				_tmp18_ = _tmp17_;
				gupnp_protocol_info_set_dlna_profile (_tmp15_, _tmp18_);
				_tmp19_ = protocol_infos;
				_tmp20_ = protocol_info;
				_tmp21_ = gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp19_, _tmp20_);
				if (!_tmp21_) {
					GeeArrayList* _tmp22_;
					GUPnPProtocolInfo* _tmp23_;
					_tmp22_ = protocol_infos;
					_tmp23_ = protocol_info;
					gee_abstract_list_insert ((GeeAbstractList*) _tmp22_, 0, _tmp23_);
				}
				_g_object_unref0 (protocol_info);
			}
		}
	}
	result = protocol_infos;
	_g_free0 (protocol);
	_g_object_unref0 (discoverer);
	_g_object_unref0 (server);
	return result;
}


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


static RygelHTTPServer* rygel_source_connection_manager_get_http_server (RygelSourceConnectionManager* self) {
	RygelHTTPServer* result = NULL;
	RygelHTTPServer* server;
	GUPnPRootDevice* _tmp0_ = NULL;
	GUPnPRootDevice* _tmp1_;
	RygelRootDevice* root_device;
	g_return_val_if_fail (self != NULL, NULL);
	server = NULL;
	g_object_get ((GUPnPService*) self, "root-device", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	root_device = RYGEL_ROOT_DEVICE (_tmp1_);
	{
		RygelRootDevice* _tmp2_;
		GeeArrayList* _tmp3_;
		GeeArrayList* _tmp4_;
		GeeArrayList* _service_list;
		GeeArrayList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _service_size;
		gint _service_index;
		_tmp2_ = root_device;
		_tmp3_ = _tmp2_->services;
		_tmp4_ = _g_object_ref0 (_tmp3_);
		_service_list = _tmp4_;
		_tmp5_ = _service_list;
		_tmp6_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_service_size = _tmp7_;
		_service_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			gint _tmp10_;
			GeeArrayList* _tmp11_;
			gint _tmp12_;
			gpointer _tmp13_ = NULL;
			GUPnPServiceInfo* service;
			GUPnPServiceInfo* _tmp14_;
			GType _tmp15_ = 0UL;
			gboolean _tmp16_ = FALSE;
			_tmp8_ = _service_index;
			_service_index = _tmp8_ + 1;
			_tmp9_ = _service_index;
			_tmp10_ = _service_size;
			if (!(_tmp9_ < _tmp10_)) {
				break;
			}
			_tmp11_ = _service_list;
			_tmp12_ = _service_index;
			_tmp13_ = gee_abstract_list_get ((GeeAbstractList*) _tmp11_, _tmp12_);
			service = (GUPnPServiceInfo*) _tmp13_;
			_tmp14_ = service;
			_tmp15_ = G_TYPE_FROM_INSTANCE ((GObject*) _tmp14_);
			_tmp16_ = g_type_is_a (_tmp15_, RYGEL_TYPE_CONTENT_DIRECTORY);
			if (_tmp16_) {
				GUPnPServiceInfo* _tmp17_;
				RygelContentDirectory* _tmp18_;
				RygelContentDirectory* content_directory;
				RygelContentDirectory* _tmp19_;
				RygelHTTPServer* _tmp20_;
				RygelHTTPServer* _tmp21_;
				_tmp17_ = service;
				_tmp18_ = _g_object_ref0 (RYGEL_CONTENT_DIRECTORY (_tmp17_));
				content_directory = _tmp18_;
				_tmp19_ = content_directory;
				_tmp20_ = _tmp19_->http_server;
				_tmp21_ = _g_object_ref0 (_tmp20_);
				_g_object_unref0 (server);
				server = _tmp21_;
				_g_object_unref0 (content_directory);
			}
			_g_object_unref0 (service);
		}
		_g_object_unref0 (_service_list);
	}
	result = server;
	_g_object_unref0 (root_device);
	return result;
}


RygelSourceConnectionManager* rygel_source_connection_manager_construct (GType object_type) {
	RygelSourceConnectionManager * self = NULL;
	self = (RygelSourceConnectionManager*) rygel_connection_manager_construct (object_type);
	return self;
}


RygelSourceConnectionManager* rygel_source_connection_manager_new (void) {
	return rygel_source_connection_manager_construct (RYGEL_TYPE_SOURCE_CONNECTION_MANAGER);
}


static void rygel_source_connection_manager_class_init (RygelSourceConnectionManagerClass * klass) {
	rygel_source_connection_manager_parent_class = g_type_class_peek_parent (klass);
	G_OBJECT_CLASS (klass)->constructed = rygel_source_connection_manager_real_constructed;
}


static void rygel_source_connection_manager_instance_init (RygelSourceConnectionManager * self) {
}


/**
 * UPnP ConnectionManager service for serving end-points (MediaServer).
 */
GType rygel_source_connection_manager_get_type (void) {
	static volatile gsize rygel_source_connection_manager_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_source_connection_manager_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelSourceConnectionManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_source_connection_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelSourceConnectionManager), 0, (GInstanceInitFunc) rygel_source_connection_manager_instance_init, NULL };
		GType rygel_source_connection_manager_type_id;
		rygel_source_connection_manager_type_id = g_type_register_static (RYGEL_TYPE_CONNECTION_MANAGER, "RygelSourceConnectionManager", &g_define_type_info, 0);
		g_once_init_leave (&rygel_source_connection_manager_type_id__volatile, rygel_source_connection_manager_type_id);
	}
	return rygel_source_connection_manager_type_id__volatile;
}



