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

#include "xmpp-vala.h"
#include <glib-object.h>
#include <glib.h>
#include <string.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

enum  {
	XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_0_PROPERTY,
	XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_NS_URI_PROPERTY,
	XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_REQUIRED_TRANSPORT_TYPE_PROPERTY,
	XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_REQUIRED_COMPONENTS_PROPERTY,
	XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jingle_rtp_content_type_properties[XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _XmppXepJingleRtpContentTypePrivate {
	XmppXepJingleRtpModule* module;
};

static gint XmppXepJingleRtpContentType_private_offset;
static gpointer xmpp_xep_jingle_rtp_content_type_parent_class = NULL;
static XmppXepJingleContentTypeIface * xmpp_xep_jingle_rtp_content_type_xmpp_xep_jingle_content_type_parent_iface = NULL;

static XmppXepJingleContentParameters* xmpp_xep_jingle_rtp_content_type_real_parse_content_parameters (XmppXepJingleContentType* base,
                                                                                                XmppStanzaNode* description,
                                                                                                GError** error);
static void xmpp_xep_jingle_rtp_content_type_finalize (GObject * obj);
static GType xmpp_xep_jingle_rtp_content_type_get_type_once (void);
static void _vala_xmpp_xep_jingle_rtp_content_type_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_xep_jingle_rtp_content_type_get_instance_private (XmppXepJingleRtpContentType* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJingleRtpContentType_private_offset);
}

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

XmppXepJingleRtpContentType*
xmpp_xep_jingle_rtp_content_type_construct (GType object_type,
                                            XmppXepJingleRtpModule* module)
{
	XmppXepJingleRtpContentType * self = NULL;
	XmppXepJingleRtpModule* _tmp0_;
	g_return_val_if_fail (module != NULL, NULL);
	self = (XmppXepJingleRtpContentType*) g_object_new (object_type, NULL);
	_tmp0_ = _g_object_ref0 (module);
	_g_object_unref0 (self->priv->module);
	self->priv->module = _tmp0_;
	return self;
}

XmppXepJingleRtpContentType*
xmpp_xep_jingle_rtp_content_type_new (XmppXepJingleRtpModule* module)
{
	return xmpp_xep_jingle_rtp_content_type_construct (XMPP_XEP_JINGLE_RTP_TYPE_CONTENT_TYPE, module);
}

static XmppXepJingleContentParameters*
xmpp_xep_jingle_rtp_content_type_real_parse_content_parameters (XmppXepJingleContentType* base,
                                                                XmppStanzaNode* description,
                                                                GError** error)
{
	XmppXepJingleRtpContentType * self;
	XmppXepJingleRtpParameters* _tmp0_ = NULL;
	XmppXepJingleRtpModule* _tmp1_;
	XmppXepJingleRtpParameters* _tmp2_;
	XmppXepJingleRtpParameters* _tmp3_;
	GError* _inner_error0_ = NULL;
	XmppXepJingleContentParameters* result;
	self = (XmppXepJingleRtpContentType*) base;
	g_return_val_if_fail (description != NULL, NULL);
	_tmp1_ = self->priv->module;
	_tmp2_ = xmpp_xep_jingle_rtp_parameters_new_from_node (_tmp1_, description, &_inner_error0_);
	_tmp0_ = _tmp2_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == XMPP_XEP_JINGLE_IQ_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			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;
		}
	}
	_tmp3_ = _tmp0_;
	_tmp0_ = NULL;
	result = (XmppXepJingleContentParameters*) _tmp3_;
	_g_object_unref0 (_tmp0_);
	return result;
}

XmppXepJingleContentParameters*
xmpp_xep_jingle_rtp_content_type_create_content_parameters (XmppXepJingleRtpContentType* self,
                                                            GObject* object,
                                                            GError** error)
{
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (object != NULL, NULL);
	g_assert_not_reached ();
}

static const gchar*
xmpp_xep_jingle_rtp_content_type_real_get_ns_uri (XmppXepJingleContentType* base)
{
	const gchar* result;
	XmppXepJingleRtpContentType* self;
	self = (XmppXepJingleRtpContentType*) base;
	result = XMPP_XEP_JINGLE_RTP_NS_URI;
	return result;
}

static XmppXepJingleTransportType
xmpp_xep_jingle_rtp_content_type_real_get_required_transport_type (XmppXepJingleContentType* base)
{
	XmppXepJingleTransportType result;
	XmppXepJingleRtpContentType* self;
	self = (XmppXepJingleRtpContentType*) base;
	result = XMPP_XEP_JINGLE_TRANSPORT_TYPE_DATAGRAM;
	return result;
}

static guint8
xmpp_xep_jingle_rtp_content_type_real_get_required_components (XmppXepJingleContentType* base)
{
	guint8 result;
	XmppXepJingleRtpContentType* self;
	self = (XmppXepJingleRtpContentType*) base;
	result = (guint8) 2;
	return result;
}

static void
xmpp_xep_jingle_rtp_content_type_class_init (XmppXepJingleRtpContentTypeClass * klass,
                                             gpointer klass_data)
{
	xmpp_xep_jingle_rtp_content_type_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepJingleRtpContentType_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_xmpp_xep_jingle_rtp_content_type_get_property;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jingle_rtp_content_type_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_NS_URI_PROPERTY, xmpp_xep_jingle_rtp_content_type_properties[XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_NS_URI_PROPERTY] = g_param_spec_string ("ns-uri", "ns-uri", "ns-uri", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_REQUIRED_TRANSPORT_TYPE_PROPERTY, xmpp_xep_jingle_rtp_content_type_properties[XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_REQUIRED_TRANSPORT_TYPE_PROPERTY] = g_param_spec_enum ("required-transport-type", "required-transport-type", "required-transport-type", XMPP_XEP_JINGLE_TYPE_TRANSPORT_TYPE, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_REQUIRED_COMPONENTS_PROPERTY, xmpp_xep_jingle_rtp_content_type_properties[XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_REQUIRED_COMPONENTS_PROPERTY] = g_param_spec_uchar ("required-components", "required-components", "required-components", 0, G_MAXUINT8, 0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
xmpp_xep_jingle_rtp_content_type_xmpp_xep_jingle_content_type_interface_init (XmppXepJingleContentTypeIface * iface,
                                                                              gpointer iface_data)
{
	xmpp_xep_jingle_rtp_content_type_xmpp_xep_jingle_content_type_parent_iface = g_type_interface_peek_parent (iface);
	iface->parse_content_parameters = (XmppXepJingleContentParameters* (*) (XmppXepJingleContentType*, XmppStanzaNode*, GError**)) xmpp_xep_jingle_rtp_content_type_real_parse_content_parameters;
	iface->get_ns_uri = xmpp_xep_jingle_rtp_content_type_real_get_ns_uri;
	iface->get_required_transport_type = xmpp_xep_jingle_rtp_content_type_real_get_required_transport_type;
	iface->get_required_components = xmpp_xep_jingle_rtp_content_type_real_get_required_components;
}

static void
xmpp_xep_jingle_rtp_content_type_instance_init (XmppXepJingleRtpContentType * self,
                                                gpointer klass)
{
	self->priv = xmpp_xep_jingle_rtp_content_type_get_instance_private (self);
}

static void
xmpp_xep_jingle_rtp_content_type_finalize (GObject * obj)
{
	XmppXepJingleRtpContentType * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JINGLE_RTP_TYPE_CONTENT_TYPE, XmppXepJingleRtpContentType);
	_g_object_unref0 (self->priv->module);
	G_OBJECT_CLASS (xmpp_xep_jingle_rtp_content_type_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jingle_rtp_content_type_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJingleRtpContentTypeClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jingle_rtp_content_type_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJingleRtpContentType), 0, (GInstanceInitFunc) xmpp_xep_jingle_rtp_content_type_instance_init, NULL };
	static const GInterfaceInfo xmpp_xep_jingle_content_type_info = { (GInterfaceInitFunc) xmpp_xep_jingle_rtp_content_type_xmpp_xep_jingle_content_type_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType xmpp_xep_jingle_rtp_content_type_type_id;
	xmpp_xep_jingle_rtp_content_type_type_id = g_type_register_static (G_TYPE_OBJECT, "XmppXepJingleRtpContentType", &g_define_type_info, 0);
	g_type_add_interface_static (xmpp_xep_jingle_rtp_content_type_type_id, XMPP_XEP_JINGLE_TYPE_CONTENT_TYPE, &xmpp_xep_jingle_content_type_info);
	XmppXepJingleRtpContentType_private_offset = g_type_add_instance_private (xmpp_xep_jingle_rtp_content_type_type_id, sizeof (XmppXepJingleRtpContentTypePrivate));
	return xmpp_xep_jingle_rtp_content_type_type_id;
}

GType
xmpp_xep_jingle_rtp_content_type_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_rtp_content_type_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_rtp_content_type_type_id__once)) {
		GType xmpp_xep_jingle_rtp_content_type_type_id;
		xmpp_xep_jingle_rtp_content_type_type_id = xmpp_xep_jingle_rtp_content_type_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_rtp_content_type_type_id__once, xmpp_xep_jingle_rtp_content_type_type_id);
	}
	return xmpp_xep_jingle_rtp_content_type_type_id__once;
}

static void
_vala_xmpp_xep_jingle_rtp_content_type_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	XmppXepJingleRtpContentType * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, XMPP_XEP_JINGLE_RTP_TYPE_CONTENT_TYPE, XmppXepJingleRtpContentType);
	switch (property_id) {
		case XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_NS_URI_PROPERTY:
		g_value_set_string (value, xmpp_xep_jingle_content_type_get_ns_uri ((XmppXepJingleContentType*) self));
		break;
		case XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_REQUIRED_TRANSPORT_TYPE_PROPERTY:
		g_value_set_enum (value, xmpp_xep_jingle_content_type_get_required_transport_type ((XmppXepJingleContentType*) self));
		break;
		case XMPP_XEP_JINGLE_RTP_CONTENT_TYPE_REQUIRED_COMPONENTS_PROPERTY:
		g_value_set_uchar (value, xmpp_xep_jingle_content_type_get_required_components ((XmppXepJingleContentType*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
_vala_memdup2 (gconstpointer mem,
               gsize byte_size)
{
	gpointer new_mem;
	if (mem && byte_size != 0) {
		new_mem = g_malloc (byte_size);
		memcpy (new_mem, mem, byte_size);
	} else {
		new_mem = NULL;
	}
	return new_mem;
}

