/* rygel-sink-connection-manager.c generated by valac 0.56.19, the Vala compiler
 * generated from rygel-sink-connection-manager.vala, do not modify */

/*
 * Copyright (C) 2008 OpenedHand Ltd.
 * Copyright (C) 2009 Nokia Corporation.
 *
 * Author: Jorn Baayen <jorn@openedhand.com>
 *         Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *
 * 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-core.h"
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <glib.h>
#include "rygel-renderer.h"
#include <libgupnp/gupnp.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 RYGEL_TYPE_SINK_CONNECTION_MANAGER (rygel_sink_connection_manager_get_type ())
#define RYGEL_SINK_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SINK_CONNECTION_MANAGER, RygelSinkConnectionManager))
#define RYGEL_SINK_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SINK_CONNECTION_MANAGER, RygelSinkConnectionManagerClass))
#define RYGEL_IS_SINK_CONNECTION_MANAGER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SINK_CONNECTION_MANAGER))
#define RYGEL_IS_SINK_CONNECTION_MANAGER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SINK_CONNECTION_MANAGER))
#define RYGEL_SINK_CONNECTION_MANAGER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SINK_CONNECTION_MANAGER, RygelSinkConnectionManagerClass))

typedef struct _RygelSinkConnectionManager RygelSinkConnectionManager;
typedef struct _RygelSinkConnectionManagerClass RygelSinkConnectionManagerClass;
typedef struct _RygelSinkConnectionManagerPrivate RygelSinkConnectionManagerPrivate;
enum  {
	RYGEL_SINK_CONNECTION_MANAGER_0_PROPERTY,
	RYGEL_SINK_CONNECTION_MANAGER_NUM_PROPERTIES
};
static GParamSpec* rygel_sink_connection_manager_properties[RYGEL_SINK_CONNECTION_MANAGER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _RygelSinkConnectionManager {
	RygelConnectionManager parent_instance;
	RygelSinkConnectionManagerPrivate * priv;
};

struct _RygelSinkConnectionManagerClass {
	RygelConnectionManagerClass parent_class;
};

static gpointer rygel_sink_connection_manager_parent_class = NULL;

VALA_EXTERN GType rygel_sink_connection_manager_get_type (void) G_GNUC_CONST ;
static void rygel_sink_connection_manager_real_constructed (GObject* base);
static gchar* rygel_sink_connection_manager_real_get_current_protocol_info (RygelConnectionManager* base);
VALA_EXTERN RygelSinkConnectionManager* rygel_sink_connection_manager_new (void);
VALA_EXTERN RygelSinkConnectionManager* rygel_sink_connection_manager_construct (GType object_type);
static GType rygel_sink_connection_manager_get_type_once (void);

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

static void
rygel_sink_connection_manager_real_constructed (GObject* base)
{
	RygelSinkConnectionManager * self;
	gchar* _tmp0_;
	RygelMediaRendererPlugin* plugin = NULL;
	GUPnPRootDevice* _tmp1_;
	GUPnPRootDevice* _tmp2_;
	GUPnPRootDevice* _tmp3_;
	GUPnPResourceFactory* _tmp4_;
	GUPnPResourceFactory* _tmp5_;
	RygelMediaRendererPlugin* _tmp6_;
	RygelMediaRendererPlugin* _tmp7_;
	gchar* _tmp8_;
	self = (RygelSinkConnectionManager*) base;
	G_OBJECT_CLASS (rygel_sink_connection_manager_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, RYGEL_TYPE_CONNECTION_MANAGER, RygelConnectionManager));
	((RygelConnectionManager*) self)->rcs_id = 0;
	((RygelConnectionManager*) self)->av_transport_id = 0;
	_tmp0_ = g_strdup ("Input");
	_g_free0 (((RygelConnectionManager*) self)->direction);
	((RygelConnectionManager*) self)->direction = _tmp0_;
	g_object_get ((GUPnPService*) self, "root-device", &_tmp1_, NULL);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = gupnp_device_info_get_resource_factory ((GUPnPDeviceInfo*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _g_object_ref0 (RYGEL_IS_MEDIA_RENDERER_PLUGIN (_tmp5_) ? ((RygelMediaRendererPlugin*) _tmp5_) : NULL);
	_tmp7_ = _tmp6_;
	_g_object_unref0 (_tmp3_);
	plugin = _tmp7_;
	_tmp8_ = rygel_media_renderer_plugin_get_protocol_info (plugin);
	_g_free0 (((RygelConnectionManager*) self)->sink_protocol_info);
	((RygelConnectionManager*) self)->sink_protocol_info = _tmp8_;
	_g_object_unref0 (plugin);
}

static gchar*
rygel_sink_connection_manager_real_get_current_protocol_info (RygelConnectionManager* base)
{
	RygelSinkConnectionManager * self;
	RygelMediaRendererPlugin* plugin = NULL;
	GUPnPRootDevice* _tmp0_;
	GUPnPRootDevice* _tmp1_;
	GUPnPRootDevice* _tmp2_;
	GUPnPResourceFactory* _tmp3_;
	GUPnPResourceFactory* _tmp4_;
	RygelMediaRendererPlugin* _tmp5_;
	RygelMediaRendererPlugin* _tmp6_;
	RygelMediaPlayer* player = NULL;
	RygelMediaPlayer* _tmp7_;
	gchar* _tmp8_;
	gchar* _tmp9_;
	gchar* result;
	self = (RygelSinkConnectionManager*) base;
	g_object_get ((GUPnPService*) self, "root-device", &_tmp0_, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	_tmp3_ = gupnp_device_info_get_resource_factory ((GUPnPDeviceInfo*) _tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _g_object_ref0 (RYGEL_IS_MEDIA_RENDERER_PLUGIN (_tmp4_) ? ((RygelMediaRendererPlugin*) _tmp4_) : NULL);
	_tmp6_ = _tmp5_;
	_g_object_unref0 (_tmp2_);
	plugin = _tmp6_;
	_tmp7_ = rygel_media_renderer_plugin_get_player (plugin);
	player = _tmp7_;
	_tmp8_ = rygel_media_player_get_protocol_info (player);
	_tmp9_ = _tmp8_;
	result = _tmp9_;
	_g_object_unref0 (player);
	_g_object_unref0 (plugin);
	return result;
}

RygelSinkConnectionManager*
rygel_sink_connection_manager_construct (GType object_type)
{
	RygelSinkConnectionManager * self = NULL;
	self = (RygelSinkConnectionManager*) rygel_connection_manager_construct (object_type);
	return self;
}

RygelSinkConnectionManager*
rygel_sink_connection_manager_new (void)
{
	return rygel_sink_connection_manager_construct (RYGEL_TYPE_SINK_CONNECTION_MANAGER);
}

static void
rygel_sink_connection_manager_class_init (RygelSinkConnectionManagerClass * klass,
                                          gpointer klass_data)
{
	rygel_sink_connection_manager_parent_class = g_type_class_peek_parent (klass);
	((GObjectClass *) klass)->constructed = (void (*) (GObject*)) rygel_sink_connection_manager_real_constructed;
	((RygelConnectionManagerClass *) klass)->get_current_protocol_info = (gchar* (*) (RygelConnectionManager*)) rygel_sink_connection_manager_real_get_current_protocol_info;
}

static void
rygel_sink_connection_manager_instance_init (RygelSinkConnectionManager * self,
                                             gpointer klass)
{
}

 G_GNUC_NO_INLINE static GType
rygel_sink_connection_manager_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelSinkConnectionManagerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_sink_connection_manager_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelSinkConnectionManager), 0, (GInstanceInitFunc) rygel_sink_connection_manager_instance_init, NULL };
	GType rygel_sink_connection_manager_type_id;
	rygel_sink_connection_manager_type_id = g_type_register_static (RYGEL_TYPE_CONNECTION_MANAGER, "RygelSinkConnectionManager", &g_define_type_info, 0);
	return rygel_sink_connection_manager_type_id;
}

GType
rygel_sink_connection_manager_get_type (void)
{
	static volatile gsize rygel_sink_connection_manager_type_id__once = 0;
	if (g_once_init_enter (&rygel_sink_connection_manager_type_id__once)) {
		GType rygel_sink_connection_manager_type_id;
		rygel_sink_connection_manager_type_id = rygel_sink_connection_manager_get_type_once ();
		g_once_init_leave (&rygel_sink_connection_manager_type_id__once, rygel_sink_connection_manager_type_id);
	}
	return rygel_sink_connection_manager_type_id__once;
}

