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

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

enum  {
	XMPP_XEP_JINGLE_RTP_MODULE_0_PROPERTY,
	XMPP_XEP_JINGLE_RTP_MODULE_NUM_PROPERTIES
};
static GParamSpec* xmpp_xep_jingle_rtp_module_properties[XMPP_XEP_JINGLE_RTP_MODULE_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmpp_jid_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_jid_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _xmpp_xep_jingle_rtp_crypto_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_jingle_rtp_crypto_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
typedef struct _XmppXepJingleRtpModuleStartCallData XmppXepJingleRtpModuleStartCallData;
typedef struct _XmppXepJingleRtpModuleAddOutgoingVideoContentData XmppXepJingleRtpModuleAddOutgoingVideoContentData;
typedef struct _XmppXepJingleRtpModuleIsAvailableData XmppXepJingleRtpModuleIsAvailableData;
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
typedef struct _XmppXepJingleRtpParamSpecCrypto XmppXepJingleRtpParamSpecCrypto;

struct _XmppXepJingleRtpModulePrivate {
	XmppXepJingleRtpContentType* content_type;
};

struct _XmppXepJingleRtpModuleStartCallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepJingleRtpModule* self;
	XmppXmppStream* stream;
	XmppJid* receiver_full_jid;
	gboolean video;
	gchar* sid;
	XmppJid* muji_room;
	XmppXepJingleSession* result;
	XmppXepJingleModule* jingle_module;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppJid* my_jid;
	XmppFlagIdentity* _tmp2_;
	gpointer _tmp3_;
	XmppBindFlag* _tmp4_;
	XmppJid* _tmp5_;
	XmppJid* _tmp6_;
	XmppJid* _tmp7_;
	XmppJid* _tmp8_;
	GError* _tmp9_;
	GeeArrayList* contents;
	GeeArrayList* _tmp10_;
	XmppXepJingleRtpParameters* audio_content_parameters;
	GeeList* _tmp11_;
	GeeList* _tmp12_;
	XmppXepJingleRtpParameters* _tmp13_;
	XmppXepJingleRtpParameters* _tmp14_;
	XmppXepJingleRtpParameters* _tmp15_;
	XmppXepJingleRtpCrypto* _tmp16_;
	XmppXepJingleRtpParameters* _tmp17_;
	GeeList* _tmp18_;
	GeeList* _tmp19_;
	GeeList* _tmp20_;
	XmppXepJingleTransport* audio_transport;
	XmppXepJingleModule* _tmp21_;
	XmppXepJingleRtpContentType* _tmp22_;
	XmppXepJingleTransportType _tmp23_;
	XmppXepJingleTransportType _tmp24_;
	XmppXepJingleRtpContentType* _tmp25_;
	guint8 _tmp26_;
	guint8 _tmp27_;
	GeeSet* _tmp28_;
	GeeSet* _tmp29_;
	XmppXepJingleTransport* _tmp30_;
	XmppXepJingleTransport* _tmp31_;
	XmppXepJingleTransport* _tmp32_;
	GError* _tmp33_;
	XmppXepJingleTransportParameters* audio_transport_params;
	XmppXepJingleTransport* _tmp34_;
	XmppXepJingleRtpContentType* _tmp35_;
	guint8 _tmp36_;
	guint8 _tmp37_;
	XmppJid* _tmp38_;
	XmppXepJingleTransportParameters* _tmp39_;
	XmppXepJingleContent* audio_content;
	XmppXepJingleRtpContentType* _tmp40_;
	XmppXepJingleRtpParameters* _tmp41_;
	XmppXepJingleTransport* _tmp42_;
	XmppXepJingleTransportParameters* _tmp43_;
	XmppJid* _tmp44_;
	XmppXepJingleContent* _tmp45_;
	GeeArrayList* _tmp46_;
	XmppXepJingleContent* _tmp47_;
	XmppXepJingleContent* video_content;
	XmppXepJingleRtpParameters* video_content_parameters;
	GeeList* _tmp48_;
	GeeList* _tmp49_;
	XmppXepJingleRtpParameters* _tmp50_;
	XmppXepJingleRtpParameters* _tmp51_;
	XmppXepJingleRtpParameters* _tmp52_;
	XmppXepJingleRtpCrypto* _tmp53_;
	XmppXepJingleRtpParameters* _tmp54_;
	GeeList* _tmp55_;
	GeeList* _tmp56_;
	GeeList* _tmp57_;
	XmppXepJingleTransport* video_transport;
	XmppModuleIdentity* _tmp58_;
	gpointer _tmp59_;
	XmppXepJingleModule* _tmp60_;
	XmppXepJingleRtpContentType* _tmp61_;
	XmppXepJingleTransportType _tmp62_;
	XmppXepJingleTransportType _tmp63_;
	XmppXepJingleRtpContentType* _tmp64_;
	guint8 _tmp65_;
	guint8 _tmp66_;
	GeeSet* _tmp67_;
	GeeSet* _tmp68_;
	XmppXepJingleTransport* _tmp69_;
	XmppXepJingleTransport* _tmp70_;
	XmppXepJingleTransport* _tmp71_;
	GError* _tmp72_;
	XmppXepJingleTransportParameters* video_transport_params;
	XmppXepJingleTransport* _tmp73_;
	XmppXepJingleRtpContentType* _tmp74_;
	guint8 _tmp75_;
	guint8 _tmp76_;
	XmppJid* _tmp77_;
	XmppXepJingleTransportParameters* _tmp78_;
	XmppXepJingleRtpContentType* _tmp79_;
	XmppXepJingleRtpParameters* _tmp80_;
	XmppXepJingleTransport* _tmp81_;
	XmppXepJingleTransportParameters* _tmp82_;
	XmppJid* _tmp83_;
	XmppXepJingleContent* _tmp84_;
	GeeArrayList* _tmp85_;
	XmppXepJingleContent* _tmp86_;
	XmppXepJingleSession* session;
	XmppXepJingleModule* _tmp87_;
	GeeArrayList* _tmp88_;
	XmppXepJingleSession* _tmp89_;
	GError* e;
	GError* _tmp90_;
	const gchar* _tmp91_;
	const gchar* _tmp92_;
	gchar* _tmp93_;
	gchar* _tmp94_;
	GError* _tmp95_;
	GError* _tmp96_;
	GError* _inner_error0_;
};

struct _XmppXepJingleRtpModuleAddOutgoingVideoContentData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepJingleRtpModule* self;
	XmppXmppStream* stream;
	XmppXepJingleSession* session;
	XmppJid* muji_muc;
	XmppXepJingleContent* result;
	XmppJid* my_jid;
	XmppJid* _tmp0_;
	XmppJid* _tmp1_;
	XmppJid* _tmp2_;
	XmppJid* receiver_full_jid;
	XmppJid* _tmp3_;
	XmppJid* _tmp4_;
	XmppJid* _tmp5_;
	XmppXepJingleContent* content;
	GeeList* _c_list;
	GeeList* _tmp6_;
	gint _c_size;
	GeeList* _tmp7_;
	gint _tmp8_;
	gint _tmp9_;
	gint _c_index;
	gint _tmp10_;
	gint _tmp11_;
	XmppXepJingleContent* c;
	GeeList* _tmp12_;
	gpointer _tmp13_;
	XmppXepJingleRtpParameters* parameters;
	XmppXepJingleContent* _tmp14_;
	XmppXepJingleContentParameters* _tmp15_;
	XmppXepJingleRtpParameters* _tmp16_;
	XmppXepJingleRtpParameters* _tmp17_;
	XmppXepJingleRtpParameters* _tmp18_;
	const gchar* _tmp19_;
	const gchar* _tmp20_;
	XmppXepJingleContent* _tmp21_;
	XmppXepJingleContent* _tmp22_;
	XmppXepJingleContent* _tmp23_;
	XmppXepJingleRtpParameters* video_content_parameters;
	GeeList* _tmp24_;
	GeeList* _tmp25_;
	XmppXepJingleRtpParameters* _tmp26_;
	XmppXepJingleRtpParameters* _tmp27_;
	XmppXepJingleRtpParameters* _tmp28_;
	XmppXepJingleRtpCrypto* _tmp29_;
	XmppXepJingleRtpParameters* _tmp30_;
	GeeList* _tmp31_;
	GeeList* _tmp32_;
	GeeList* _tmp33_;
	XmppXepJingleTransport* video_transport;
	XmppModuleIdentity* _tmp34_;
	gpointer _tmp35_;
	XmppXepJingleModule* _tmp36_;
	XmppXepJingleRtpContentType* _tmp37_;
	XmppXepJingleTransportType _tmp38_;
	XmppXepJingleTransportType _tmp39_;
	XmppXepJingleRtpContentType* _tmp40_;
	guint8 _tmp41_;
	guint8 _tmp42_;
	XmppJid* _tmp43_;
	GeeSet* _tmp44_;
	GeeSet* _tmp45_;
	XmppXepJingleTransport* _tmp46_;
	XmppXepJingleTransport* _tmp47_;
	XmppXepJingleTransport* _tmp48_;
	GError* _tmp49_;
	XmppXepJingleTransportParameters* video_transport_params;
	XmppXepJingleTransport* _tmp50_;
	XmppXepJingleRtpContentType* _tmp51_;
	guint8 _tmp52_;
	guint8 _tmp53_;
	XmppJid* _tmp54_;
	XmppJid* _tmp55_;
	XmppXepJingleTransportParameters* _tmp56_;
	XmppXepJingleSenders _tmp57_;
	gboolean _tmp58_;
	gboolean _tmp59_;
	XmppXepJingleRtpContentType* _tmp60_;
	XmppXepJingleRtpParameters* _tmp61_;
	XmppXepJingleTransport* _tmp62_;
	XmppXepJingleTransportParameters* _tmp63_;
	XmppJid* _tmp64_;
	XmppJid* _tmp65_;
	XmppXepJingleContent* _tmp66_;
	XmppXepJingleContent* _tmp67_;
	gboolean we_initiated;
	gboolean _tmp68_;
	gboolean _tmp69_;
	XmppXepJingleSenders _tmp70_;
	XmppXepJingleSenders want_sender;
	gboolean _tmp71_;
	XmppXepJingleContent* _tmp72_;
	XmppXepJingleSenders _tmp73_;
	XmppXepJingleSenders _tmp74_;
	XmppXepJingleContent* _tmp75_;
	XmppXepJingleSenders _tmp76_;
	XmppXepJingleSenders _tmp77_;
	XmppXepJingleContent* _tmp78_;
	XmppXepJingleSenders _tmp79_;
	XmppXepJingleSenders _tmp80_;
	XmppXepJingleContent* _tmp81_;
	XmppXepJingleContent* _tmp82_;
	GError* _inner_error0_;
};

struct _XmppXepJingleRtpModuleIsAvailableData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	XmppXepJingleRtpModule* self;
	XmppXmppStream* stream;
	XmppJid* full_jid;
	gboolean result;
	gboolean* has_feature;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	gboolean _tmp3_;
	gboolean* _tmp4_;
	gboolean* _tmp5_;
	gboolean _tmp6_;
	gboolean* _tmp7_;
	gboolean* _tmp8_;
	XmppModuleIdentity* _tmp9_;
	gpointer _tmp10_;
	XmppXepJingleModule* _tmp11_;
	XmppXepJingleRtpContentType* _tmp12_;
	XmppXepJingleTransportType _tmp13_;
	XmppXepJingleTransportType _tmp14_;
	XmppXepJingleRtpContentType* _tmp15_;
	guint8 _tmp16_;
	guint8 _tmp17_;
	gboolean _tmp18_;
};

struct _XmppXepJingleRtpCryptoPrivate {
	gchar* _crypto_suite;
	gchar* _key_params;
	gchar* _session_params;
	gchar* _tag;
};

struct _XmppXepJingleRtpParamSpecCrypto {
	GParamSpec parent_instance;
};

static gint XmppXepJingleRtpModule_private_offset;
static gpointer xmpp_xep_jingle_rtp_module_parent_class = NULL;
XmppModuleIdentity* xmpp_xep_jingle_rtp_module_IDENTITY = NULL;
static gint XmppXepJingleRtpCrypto_private_offset;
static gpointer xmpp_xep_jingle_rtp_crypto_parent_class = NULL;

static XmppXepJingleRtpCrypto* xmpp_xep_jingle_rtp_module_real_generate_local_crypto (XmppXepJingleRtpModule* self);
static XmppXepJingleRtpCrypto* xmpp_xep_jingle_rtp_module_real_pick_remote_crypto (XmppXepJingleRtpModule* self,
                                                                            GeeList* cryptos);
static XmppXepJingleRtpCrypto* xmpp_xep_jingle_rtp_module_real_pick_local_crypto (XmppXepJingleRtpModule* self,
                                                                           XmppXepJingleRtpCrypto* remote);
static XmppXepJingleRtpStream* xmpp_xep_jingle_rtp_module_real_create_stream (XmppXepJingleRtpModule* self,
                                                                       XmppXepJingleContent* content);
static gboolean xmpp_xep_jingle_rtp_module_real_is_header_extension_supported (XmppXepJingleRtpModule* self,
                                                                        const gchar* media,
                                                                        XmppXepJingleRtpHeaderExtension* ext);
static GeeList* xmpp_xep_jingle_rtp_module_real_get_suggested_header_extensions (XmppXepJingleRtpModule* self,
                                                                          const gchar* media);
static void xmpp_xep_jingle_rtp_module_real_close_stream (XmppXepJingleRtpModule* self,
                                                   XmppXepJingleRtpStream* stream);
static void xmpp_xep_jingle_rtp_module_start_call_data_free (gpointer _data);
static gboolean xmpp_xep_jingle_rtp_module_start_call_co (XmppXepJingleRtpModuleStartCallData* _data_);
static void xmpp_xep_jingle_rtp_module_start_call_ready (GObject* source_object,
                                                  GAsyncResult* _res_,
                                                  gpointer _user_data_);
static void xmpp_xep_jingle_rtp_module_add_outgoing_video_content_data_free (gpointer _data);
static gboolean xmpp_xep_jingle_rtp_module_add_outgoing_video_content_co (XmppXepJingleRtpModuleAddOutgoingVideoContentData* _data_);
static void xmpp_xep_jingle_rtp_module_add_outgoing_video_content_ready (GObject* source_object,
                                                                  GAsyncResult* _res_,
                                                                  gpointer _user_data_);
static void xmpp_xep_jingle_rtp_module_real_attach (XmppXmppStreamModule* base,
                                             XmppXmppStream* stream);
static void xmpp_xep_jingle_rtp_module_real_detach (XmppXmppStreamModule* base,
                                             XmppXmppStream* stream);
static void xmpp_xep_jingle_rtp_module_is_available_data_free (gpointer _data);
static gboolean xmpp_xep_jingle_rtp_module_is_available_co (XmppXepJingleRtpModuleIsAvailableData* _data_);
static void xmpp_xep_jingle_rtp_module_is_available_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static gboolean* _bool_dup (gboolean* self);
static gchar* xmpp_xep_jingle_rtp_module_real_get_ns (XmppXmppStreamModule* base);
static gchar* xmpp_xep_jingle_rtp_module_real_get_id (XmppXmppStreamModule* base);
static void xmpp_xep_jingle_rtp_module_finalize (GObject * obj);
static GType xmpp_xep_jingle_rtp_module_get_type_once (void);
static void xmpp_xep_jingle_rtp_crypto_set_crypto_suite (XmppXepJingleRtpCrypto* self,
                                                  const gchar* value);
static void xmpp_xep_jingle_rtp_crypto_set_key_params (XmppXepJingleRtpCrypto* self,
                                                const gchar* value);
static void xmpp_xep_jingle_rtp_crypto_set_session_params (XmppXepJingleRtpCrypto* self,
                                                    const gchar* value);
static void xmpp_xep_jingle_rtp_crypto_set_tag (XmppXepJingleRtpCrypto* self,
                                         const gchar* value);
static guint8* _vala_array_dup10 (guint8* self,
                           gssize length);
static guint8* _vala_array_dup11 (guint8* self,
                           gssize length);
static void xmpp_xep_jingle_rtp_crypto_finalize (XmppXepJingleRtpCrypto * obj);
static GType xmpp_xep_jingle_rtp_crypto_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
xmpp_xep_jingle_rtp_module_get_instance_private (XmppXepJingleRtpModule* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJingleRtpModule_private_offset);
}

XmppXepJingleRtpModule*
xmpp_xep_jingle_rtp_module_construct (GType object_type)
{
	XmppXepJingleRtpModule * self = NULL;
	XmppXepJingleRtpContentType* _tmp0_;
	self = (XmppXepJingleRtpModule*) xmpp_xmpp_stream_module_construct (object_type);
	_tmp0_ = xmpp_xep_jingle_rtp_content_type_new (self);
	_g_object_unref0 (self->priv->content_type);
	self->priv->content_type = _tmp0_;
	return self;
}

void
xmpp_xep_jingle_rtp_module_get_supported_payloads (XmppXepJingleRtpModule* self,
                                                   const gchar* media,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	XmppXepJingleRtpModuleClass* _klass_;
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->get_supported_payloads) {
		_klass_->get_supported_payloads (self, media, _callback_, _user_data_);
	}
}

GeeList*
xmpp_xep_jingle_rtp_module_get_supported_payloads_finish (XmppXepJingleRtpModule* self,
                                                          GAsyncResult* _res_)
{
	XmppXepJingleRtpModuleClass* _klass_;
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->get_supported_payloads_finish) {
		return _klass_->get_supported_payloads_finish (self, _res_);
	}
	return NULL;
}

void
xmpp_xep_jingle_rtp_module_is_payload_supported (XmppXepJingleRtpModule* self,
                                                 const gchar* media,
                                                 XmppXepJingleRtpPayloadType* payload_type,
                                                 GAsyncReadyCallback _callback_,
                                                 gpointer _user_data_)
{
	XmppXepJingleRtpModuleClass* _klass_;
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->is_payload_supported) {
		_klass_->is_payload_supported (self, media, payload_type, _callback_, _user_data_);
	}
}

gboolean
xmpp_xep_jingle_rtp_module_is_payload_supported_finish (XmppXepJingleRtpModule* self,
                                                        GAsyncResult* _res_)
{
	XmppXepJingleRtpModuleClass* _klass_;
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->is_payload_supported_finish) {
		return _klass_->is_payload_supported_finish (self, _res_);
	}
	return FALSE;
}

void
xmpp_xep_jingle_rtp_module_pick_payload_type (XmppXepJingleRtpModule* self,
                                              const gchar* media,
                                              GeeList* payloads,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_)
{
	XmppXepJingleRtpModuleClass* _klass_;
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->pick_payload_type) {
		_klass_->pick_payload_type (self, media, payloads, _callback_, _user_data_);
	}
}

XmppXepJingleRtpPayloadType*
xmpp_xep_jingle_rtp_module_pick_payload_type_finish (XmppXepJingleRtpModule* self,
                                                     GAsyncResult* _res_)
{
	XmppXepJingleRtpModuleClass* _klass_;
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->pick_payload_type_finish) {
		return _klass_->pick_payload_type_finish (self, _res_);
	}
	return NULL;
}

static XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_module_real_generate_local_crypto (XmppXepJingleRtpModule* self)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_jingle_rtp_module_generate_local_crypto'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_module_generate_local_crypto (XmppXepJingleRtpModule* self)
{
	XmppXepJingleRtpModuleClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->generate_local_crypto) {
		return _klass_->generate_local_crypto (self);
	}
	return NULL;
}

static XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_module_real_pick_remote_crypto (XmppXepJingleRtpModule* self,
                                                    GeeList* cryptos)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_jingle_rtp_module_pick_remote_crypto'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_module_pick_remote_crypto (XmppXepJingleRtpModule* self,
                                               GeeList* cryptos)
{
	XmppXepJingleRtpModuleClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->pick_remote_crypto) {
		return _klass_->pick_remote_crypto (self, cryptos);
	}
	return NULL;
}

static XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_module_real_pick_local_crypto (XmppXepJingleRtpModule* self,
                                                   XmppXepJingleRtpCrypto* remote)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_jingle_rtp_module_pick_local_crypto'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_module_pick_local_crypto (XmppXepJingleRtpModule* self,
                                              XmppXepJingleRtpCrypto* remote)
{
	XmppXepJingleRtpModuleClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->pick_local_crypto) {
		return _klass_->pick_local_crypto (self, remote);
	}
	return NULL;
}

static XmppXepJingleRtpStream*
xmpp_xep_jingle_rtp_module_real_create_stream (XmppXepJingleRtpModule* self,
                                               XmppXepJingleContent* content)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_jingle_rtp_module_create_stream'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

XmppXepJingleRtpStream*
xmpp_xep_jingle_rtp_module_create_stream (XmppXepJingleRtpModule* self,
                                          XmppXepJingleContent* content)
{
	XmppXepJingleRtpModuleClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->create_stream) {
		return _klass_->create_stream (self, content);
	}
	return NULL;
}

static gboolean
xmpp_xep_jingle_rtp_module_real_is_header_extension_supported (XmppXepJingleRtpModule* self,
                                                               const gchar* media,
                                                               XmppXepJingleRtpHeaderExtension* ext)
{
	gboolean _tmp0_ = FALSE;
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_jingle_rtp_module_is_header_extension_supported'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return _tmp0_;
}

gboolean
xmpp_xep_jingle_rtp_module_is_header_extension_supported (XmppXepJingleRtpModule* self,
                                                          const gchar* media,
                                                          XmppXepJingleRtpHeaderExtension* ext)
{
	XmppXepJingleRtpModuleClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->is_header_extension_supported) {
		return _klass_->is_header_extension_supported (self, media, ext);
	}
	return FALSE;
}

static GeeList*
xmpp_xep_jingle_rtp_module_real_get_suggested_header_extensions (XmppXepJingleRtpModule* self,
                                                                 const gchar* media)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_jingle_rtp_module_get_suggested_header_extensions'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return NULL;
}

GeeList*
xmpp_xep_jingle_rtp_module_get_suggested_header_extensions (XmppXepJingleRtpModule* self,
                                                            const gchar* media)
{
	XmppXepJingleRtpModuleClass* _klass_;
	g_return_val_if_fail (self != NULL, NULL);
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->get_suggested_header_extensions) {
		return _klass_->get_suggested_header_extensions (self, media);
	}
	return NULL;
}

static void
xmpp_xep_jingle_rtp_module_real_close_stream (XmppXepJingleRtpModule* self,
                                              XmppXepJingleRtpStream* stream)
{
	g_critical ("Type `%s' does not implement abstract method `xmpp_xep_jingle_rtp_module_close_stream'", g_type_name (G_TYPE_FROM_INSTANCE (self)));
	return;
}

void
xmpp_xep_jingle_rtp_module_close_stream (XmppXepJingleRtpModule* self,
                                         XmppXepJingleRtpStream* stream)
{
	XmppXepJingleRtpModuleClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = XMPP_XEP_JINGLE_RTP_MODULE_GET_CLASS (self);
	if (_klass_->close_stream) {
		_klass_->close_stream (self, stream);
	}
}

static void
xmpp_xep_jingle_rtp_module_start_call_data_free (gpointer _data)
{
	XmppXepJingleRtpModuleStartCallData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_xmpp_jid_unref0 (_data_->receiver_full_jid);
	_g_free0 (_data_->sid);
	_xmpp_jid_unref0 (_data_->muji_room);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepJingleRtpModuleStartCallData, _data_);
}

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

static gpointer
_xmpp_jid_ref0 (gpointer self)
{
	return self ? xmpp_jid_ref (self) : NULL;
}

void
xmpp_xep_jingle_rtp_module_start_call (XmppXepJingleRtpModule* self,
                                       XmppXmppStream* stream,
                                       XmppJid* receiver_full_jid,
                                       gboolean video,
                                       const gchar* sid,
                                       XmppJid* muji_room,
                                       GAsyncReadyCallback _callback_,
                                       gpointer _user_data_)
{
	XmppXepJingleRtpModuleStartCallData* _data_;
	XmppXepJingleRtpModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppJid* _tmp2_;
	gchar* _tmp3_;
	XmppJid* _tmp4_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (receiver_full_jid != NULL);
	g_return_if_fail (sid != NULL);
	_data_ = g_slice_new0 (XmppXepJingleRtpModuleStartCallData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_jingle_rtp_module_start_call_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _xmpp_jid_ref0 (receiver_full_jid);
	_xmpp_jid_unref0 (_data_->receiver_full_jid);
	_data_->receiver_full_jid = _tmp2_;
	_data_->video = video;
	_tmp3_ = g_strdup (sid);
	_g_free0 (_data_->sid);
	_data_->sid = _tmp3_;
	_tmp4_ = _xmpp_jid_ref0 (muji_room);
	_xmpp_jid_unref0 (_data_->muji_room);
	_data_->muji_room = _tmp4_;
	xmpp_xep_jingle_rtp_module_start_call_co (_data_);
}

XmppXepJingleSession*
xmpp_xep_jingle_rtp_module_start_call_finish (XmppXepJingleRtpModule* self,
                                              GAsyncResult* _res_,
                                              GError** error)
{
	XmppXepJingleSession* result;
	XmppXepJingleRtpModuleStartCallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
xmpp_xep_jingle_rtp_module_start_call_ready (GObject* source_object,
                                             GAsyncResult* _res_,
                                             gpointer _user_data_)
{
	XmppXepJingleRtpModuleStartCallData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_jingle_rtp_module_start_call_co (_data_);
}

static const gchar*
string_to_string (const gchar* self)
{
	const gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	result = self;
	return result;
}

static gboolean
xmpp_xep_jingle_rtp_module_start_call_co (XmppXepJingleRtpModuleStartCallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_xep_jingle_module_IDENTITY;
	_data_->_tmp1_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_JINGLE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp0_);
	_data_->jingle_module = (XmppXepJingleModule*) _data_->_tmp1_;
	_data_->_tmp2_ = xmpp_bind_flag_IDENTITY;
	_data_->_tmp3_ = xmpp_xmpp_stream_get_flag (_data_->stream, XMPP_BIND_TYPE_FLAG, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp2_);
	_data_->_tmp4_ = (XmppBindFlag*) _data_->_tmp3_;
	_data_->_tmp5_ = _data_->_tmp4_->my_jid;
	_data_->_tmp6_ = _xmpp_jid_ref0 (_data_->_tmp5_);
	_data_->_tmp7_ = _data_->_tmp6_;
	_g_object_unref0 (_data_->_tmp4_);
	_data_->my_jid = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->my_jid;
	if (_data_->_tmp8_ == NULL) {
		_data_->_tmp9_ = g_error_new_literal (XMPP_XEP_JINGLE_ERROR, XMPP_XEP_JINGLE_ERROR_GENERAL, "Couldn't determine own JID");
		_data_->_inner_error0_ = _data_->_tmp9_;
		if (_data_->_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_xmpp_jid_unref0 (_data_->my_jid);
			_g_object_unref0 (_data_->jingle_module);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_xmpp_jid_unref0 (_data_->my_jid);
			_g_object_unref0 (_data_->jingle_module);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp10_ = gee_array_list_new (XMPP_XEP_JINGLE_TYPE_CONTENT, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	_data_->contents = _data_->_tmp10_;
	_data_->_state_ = 1;
	xmpp_xep_jingle_rtp_module_get_supported_payloads (_data_->self, "audio", xmpp_xep_jingle_rtp_module_start_call_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp11_ = xmpp_xep_jingle_rtp_module_get_supported_payloads_finish (_data_->self, _data_->_res_);
	_data_->_tmp12_ = _data_->_tmp11_;
	_data_->_tmp13_ = xmpp_xep_jingle_rtp_parameters_new (_data_->self, "audio", _data_->_tmp12_, NULL, FALSE, NULL, NULL, FALSE, NULL);
	_data_->_tmp14_ = _data_->_tmp13_;
	_g_object_unref0 (_data_->_tmp12_);
	_data_->audio_content_parameters = _data_->_tmp14_;
	_data_->_tmp15_ = _data_->audio_content_parameters;
	_data_->_tmp16_ = xmpp_xep_jingle_rtp_module_generate_local_crypto (_data_->self);
	_xmpp_xep_jingle_rtp_crypto_unref0 (_data_->_tmp15_->local_crypto);
	_data_->_tmp15_->local_crypto = _data_->_tmp16_;
	_data_->_tmp17_ = _data_->audio_content_parameters;
	_data_->_tmp18_ = _data_->_tmp17_->header_extensions;
	_data_->_tmp19_ = xmpp_xep_jingle_rtp_module_get_suggested_header_extensions (_data_->self, "audio");
	_data_->_tmp20_ = _data_->_tmp19_;
	gee_collection_add_all ((GeeCollection*) _data_->_tmp18_, (GeeCollection*) _data_->_tmp20_);
	_g_object_unref0 (_data_->_tmp20_);
	_data_->_tmp21_ = _data_->jingle_module;
	_data_->_tmp22_ = _data_->self->priv->content_type;
	_data_->_tmp23_ = xmpp_xep_jingle_content_type_get_required_transport_type ((XmppXepJingleContentType*) _data_->_tmp22_);
	_data_->_tmp24_ = _data_->_tmp23_;
	_data_->_tmp25_ = _data_->self->priv->content_type;
	_data_->_tmp26_ = xmpp_xep_jingle_content_type_get_required_components ((XmppXepJingleContentType*) _data_->_tmp25_);
	_data_->_tmp27_ = _data_->_tmp26_;
	_data_->_tmp28_ = gee_set_empty (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
	_data_->_tmp29_ = _data_->_tmp28_;
	_data_->_state_ = 2;
	xmpp_xep_jingle_module_select_transport (_data_->_tmp21_, _data_->stream, _data_->_tmp24_, _data_->_tmp27_, _data_->receiver_full_jid, _data_->_tmp29_, xmpp_xep_jingle_rtp_module_start_call_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp30_ = xmpp_xep_jingle_module_select_transport_finish (_data_->_tmp21_, _data_->_res_);
	_data_->_tmp31_ = _data_->_tmp30_;
	_g_object_unref0 (_data_->_tmp29_);
	_data_->audio_transport = _data_->_tmp31_;
	_data_->_tmp32_ = _data_->audio_transport;
	if (_data_->_tmp32_ == NULL) {
		_data_->_tmp33_ = g_error_new_literal (XMPP_XEP_JINGLE_ERROR, XMPP_XEP_JINGLE_ERROR_NO_SHARED_PROTOCOLS, "No suitable audio transports");
		_data_->_inner_error0_ = _data_->_tmp33_;
		if (_data_->_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->audio_transport);
			_g_object_unref0 (_data_->audio_content_parameters);
			_g_object_unref0 (_data_->contents);
			_xmpp_jid_unref0 (_data_->my_jid);
			_g_object_unref0 (_data_->jingle_module);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->audio_transport);
			_g_object_unref0 (_data_->audio_content_parameters);
			_g_object_unref0 (_data_->contents);
			_xmpp_jid_unref0 (_data_->my_jid);
			_g_object_unref0 (_data_->jingle_module);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp34_ = _data_->audio_transport;
	_data_->_tmp35_ = _data_->self->priv->content_type;
	_data_->_tmp36_ = xmpp_xep_jingle_content_type_get_required_components ((XmppXepJingleContentType*) _data_->_tmp35_);
	_data_->_tmp37_ = _data_->_tmp36_;
	_data_->_tmp38_ = _data_->my_jid;
	_data_->_tmp39_ = xmpp_xep_jingle_transport_create_transport_parameters (_data_->_tmp34_, _data_->stream, _data_->_tmp37_, _data_->_tmp38_, _data_->receiver_full_jid, &_data_->_inner_error0_);
	_data_->audio_transport_params = _data_->_tmp39_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		if (_data_->_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
			g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
			_g_object_unref0 (_data_->audio_transport);
			_g_object_unref0 (_data_->audio_content_parameters);
			_g_object_unref0 (_data_->contents);
			_xmpp_jid_unref0 (_data_->my_jid);
			_g_object_unref0 (_data_->jingle_module);
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_object_unref0 (_data_->audio_transport);
			_g_object_unref0 (_data_->audio_content_parameters);
			_g_object_unref0 (_data_->contents);
			_xmpp_jid_unref0 (_data_->my_jid);
			_g_object_unref0 (_data_->jingle_module);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
	}
	_data_->_tmp40_ = _data_->self->priv->content_type;
	_data_->_tmp41_ = _data_->audio_content_parameters;
	_data_->_tmp42_ = _data_->audio_transport;
	_data_->_tmp43_ = _data_->audio_transport_params;
	_data_->_tmp44_ = _data_->my_jid;
	_data_->_tmp45_ = xmpp_xep_jingle_content_new_initiate_sent ("audio", XMPP_XEP_JINGLE_SENDERS_BOTH, (XmppXepJingleContentType*) _data_->_tmp40_, (XmppXepJingleContentParameters*) _data_->_tmp41_, _data_->_tmp42_, _data_->_tmp43_, NULL, NULL, _data_->_tmp44_, _data_->receiver_full_jid);
	_data_->audio_content = _data_->_tmp45_;
	_data_->_tmp46_ = _data_->contents;
	_data_->_tmp47_ = _data_->audio_content;
	gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp46_, _data_->_tmp47_);
	_data_->video_content = NULL;
	if (_data_->video) {
		_data_->_state_ = 3;
		xmpp_xep_jingle_rtp_module_get_supported_payloads (_data_->self, "video", xmpp_xep_jingle_rtp_module_start_call_ready, _data_);
		return FALSE;
		_state_3:
		_data_->_tmp48_ = xmpp_xep_jingle_rtp_module_get_supported_payloads_finish (_data_->self, _data_->_res_);
		_data_->_tmp49_ = _data_->_tmp48_;
		_data_->_tmp50_ = xmpp_xep_jingle_rtp_parameters_new (_data_->self, "video", _data_->_tmp49_, NULL, FALSE, NULL, NULL, FALSE, NULL);
		_data_->_tmp51_ = _data_->_tmp50_;
		_g_object_unref0 (_data_->_tmp49_);
		_data_->video_content_parameters = _data_->_tmp51_;
		_data_->_tmp52_ = _data_->video_content_parameters;
		_data_->_tmp53_ = xmpp_xep_jingle_rtp_module_generate_local_crypto (_data_->self);
		_xmpp_xep_jingle_rtp_crypto_unref0 (_data_->_tmp52_->local_crypto);
		_data_->_tmp52_->local_crypto = _data_->_tmp53_;
		_data_->_tmp54_ = _data_->video_content_parameters;
		_data_->_tmp55_ = _data_->_tmp54_->header_extensions;
		_data_->_tmp56_ = xmpp_xep_jingle_rtp_module_get_suggested_header_extensions (_data_->self, "video");
		_data_->_tmp57_ = _data_->_tmp56_;
		gee_collection_add_all ((GeeCollection*) _data_->_tmp55_, (GeeCollection*) _data_->_tmp57_);
		_g_object_unref0 (_data_->_tmp57_);
		_data_->_tmp58_ = xmpp_xep_jingle_module_IDENTITY;
		_data_->_tmp59_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_JINGLE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp58_);
		_data_->_tmp60_ = (XmppXepJingleModule*) _data_->_tmp59_;
		_data_->_tmp61_ = _data_->self->priv->content_type;
		_data_->_tmp62_ = xmpp_xep_jingle_content_type_get_required_transport_type ((XmppXepJingleContentType*) _data_->_tmp61_);
		_data_->_tmp63_ = _data_->_tmp62_;
		_data_->_tmp64_ = _data_->self->priv->content_type;
		_data_->_tmp65_ = xmpp_xep_jingle_content_type_get_required_components ((XmppXepJingleContentType*) _data_->_tmp64_);
		_data_->_tmp66_ = _data_->_tmp65_;
		_data_->_tmp67_ = gee_set_empty (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
		_data_->_tmp68_ = _data_->_tmp67_;
		_data_->_state_ = 4;
		xmpp_xep_jingle_module_select_transport (_data_->_tmp60_, _data_->stream, _data_->_tmp63_, _data_->_tmp66_, _data_->receiver_full_jid, _data_->_tmp68_, xmpp_xep_jingle_rtp_module_start_call_ready, _data_);
		return FALSE;
		_state_4:
		_data_->_tmp69_ = xmpp_xep_jingle_module_select_transport_finish (_data_->_tmp60_, _data_->_res_);
		_data_->_tmp70_ = _data_->_tmp69_;
		_g_object_unref0 (_data_->_tmp68_);
		_g_object_unref0 (_data_->_tmp60_);
		_data_->video_transport = _data_->_tmp70_;
		_data_->_tmp71_ = _data_->video_transport;
		if (_data_->_tmp71_ == NULL) {
			_data_->_tmp72_ = g_error_new_literal (XMPP_XEP_JINGLE_ERROR, XMPP_XEP_JINGLE_ERROR_NO_SHARED_PROTOCOLS, "No suitable video transports");
			_data_->_inner_error0_ = _data_->_tmp72_;
			if (_data_->_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->video_transport);
				_g_object_unref0 (_data_->video_content_parameters);
				_g_object_unref0 (_data_->video_content);
				_g_object_unref0 (_data_->audio_content);
				_g_object_unref0 (_data_->audio_transport_params);
				_g_object_unref0 (_data_->audio_transport);
				_g_object_unref0 (_data_->audio_content_parameters);
				_g_object_unref0 (_data_->contents);
				_xmpp_jid_unref0 (_data_->my_jid);
				_g_object_unref0 (_data_->jingle_module);
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (_data_->video_transport);
				_g_object_unref0 (_data_->video_content_parameters);
				_g_object_unref0 (_data_->video_content);
				_g_object_unref0 (_data_->audio_content);
				_g_object_unref0 (_data_->audio_transport_params);
				_g_object_unref0 (_data_->audio_transport);
				_g_object_unref0 (_data_->audio_content_parameters);
				_g_object_unref0 (_data_->contents);
				_xmpp_jid_unref0 (_data_->my_jid);
				_g_object_unref0 (_data_->jingle_module);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
		_data_->_tmp73_ = _data_->video_transport;
		_data_->_tmp74_ = _data_->self->priv->content_type;
		_data_->_tmp75_ = xmpp_xep_jingle_content_type_get_required_components ((XmppXepJingleContentType*) _data_->_tmp74_);
		_data_->_tmp76_ = _data_->_tmp75_;
		_data_->_tmp77_ = _data_->my_jid;
		_data_->_tmp78_ = xmpp_xep_jingle_transport_create_transport_parameters (_data_->_tmp73_, _data_->stream, _data_->_tmp76_, _data_->_tmp77_, _data_->receiver_full_jid, &_data_->_inner_error0_);
		_data_->video_transport_params = _data_->_tmp78_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (_data_->_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->video_transport);
				_g_object_unref0 (_data_->video_content_parameters);
				_g_object_unref0 (_data_->video_content);
				_g_object_unref0 (_data_->audio_content);
				_g_object_unref0 (_data_->audio_transport_params);
				_g_object_unref0 (_data_->audio_transport);
				_g_object_unref0 (_data_->audio_content_parameters);
				_g_object_unref0 (_data_->contents);
				_xmpp_jid_unref0 (_data_->my_jid);
				_g_object_unref0 (_data_->jingle_module);
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (_data_->video_transport);
				_g_object_unref0 (_data_->video_content_parameters);
				_g_object_unref0 (_data_->video_content);
				_g_object_unref0 (_data_->audio_content);
				_g_object_unref0 (_data_->audio_transport_params);
				_g_object_unref0 (_data_->audio_transport);
				_g_object_unref0 (_data_->audio_content_parameters);
				_g_object_unref0 (_data_->contents);
				_xmpp_jid_unref0 (_data_->my_jid);
				_g_object_unref0 (_data_->jingle_module);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
		_data_->_tmp79_ = _data_->self->priv->content_type;
		_data_->_tmp80_ = _data_->video_content_parameters;
		_data_->_tmp81_ = _data_->video_transport;
		_data_->_tmp82_ = _data_->video_transport_params;
		_data_->_tmp83_ = _data_->my_jid;
		_data_->_tmp84_ = xmpp_xep_jingle_content_new_initiate_sent ("video", XMPP_XEP_JINGLE_SENDERS_BOTH, (XmppXepJingleContentType*) _data_->_tmp79_, (XmppXepJingleContentParameters*) _data_->_tmp80_, _data_->_tmp81_, _data_->_tmp82_, NULL, NULL, _data_->_tmp83_, _data_->receiver_full_jid);
		_g_object_unref0 (_data_->video_content);
		_data_->video_content = _data_->_tmp84_;
		_data_->_tmp85_ = _data_->contents;
		_data_->_tmp86_ = _data_->video_content;
		gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp85_, _data_->_tmp86_);
		_g_object_unref0 (_data_->video_transport_params);
		_g_object_unref0 (_data_->video_transport);
		_g_object_unref0 (_data_->video_content_parameters);
	}
	{
		_data_->_tmp87_ = _data_->jingle_module;
		_data_->_tmp88_ = _data_->contents;
		_data_->_state_ = 5;
		xmpp_xep_jingle_module_create_session (_data_->_tmp87_, _data_->stream, (GeeList*) _data_->_tmp88_, _data_->receiver_full_jid, _data_->sid, _data_->muji_room, xmpp_xep_jingle_rtp_module_start_call_ready, _data_);
		return FALSE;
		_state_5:
		_data_->_tmp89_ = xmpp_xep_jingle_module_create_session_finish (_data_->_tmp87_, _data_->_res_, &_data_->_inner_error0_);
		_data_->session = _data_->_tmp89_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (_data_->_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
				goto __catch0_xmpp_xep_jingle_error;
			}
			_g_object_unref0 (_data_->video_content);
			_g_object_unref0 (_data_->audio_content);
			_g_object_unref0 (_data_->audio_transport_params);
			_g_object_unref0 (_data_->audio_transport);
			_g_object_unref0 (_data_->audio_content_parameters);
			_g_object_unref0 (_data_->contents);
			_xmpp_jid_unref0 (_data_->my_jid);
			_g_object_unref0 (_data_->jingle_module);
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
			g_clear_error (&_data_->_inner_error0_);
			g_object_unref (_data_->_async_result);
			return FALSE;
		}
		_data_->result = _data_->session;
		_g_object_unref0 (_data_->video_content);
		_g_object_unref0 (_data_->audio_content);
		_g_object_unref0 (_data_->audio_transport_params);
		_g_object_unref0 (_data_->audio_transport);
		_g_object_unref0 (_data_->audio_content_parameters);
		_g_object_unref0 (_data_->contents);
		_xmpp_jid_unref0 (_data_->my_jid);
		_g_object_unref0 (_data_->jingle_module);
		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;
	}
	goto __finally0;
	__catch0_xmpp_xep_jingle_error:
	{
		_data_->e = _data_->_inner_error0_;
		_data_->_inner_error0_ = NULL;
		_data_->_tmp90_ = _data_->e;
		_data_->_tmp91_ = _data_->_tmp90_->message;
		_data_->_tmp92_ = string_to_string (_data_->_tmp91_);
		_data_->_tmp93_ = g_strconcat ("Couldn't create Jingle session: ", _data_->_tmp92_, NULL);
		_data_->_tmp94_ = _data_->_tmp93_;
		_data_->_tmp95_ = g_error_new_literal (XMPP_XEP_JINGLE_ERROR, XMPP_XEP_JINGLE_ERROR_GENERAL, _data_->_tmp94_);
		_data_->_tmp96_ = _data_->_tmp95_;
		_g_free0 (_data_->_tmp94_);
		_data_->_inner_error0_ = _data_->_tmp96_;
		_g_error_free0 (_data_->e);
		goto __finally0;
	}
	__finally0:
	if (_data_->_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		_g_object_unref0 (_data_->video_content);
		_g_object_unref0 (_data_->audio_content);
		_g_object_unref0 (_data_->audio_transport_params);
		_g_object_unref0 (_data_->audio_transport);
		_g_object_unref0 (_data_->audio_content_parameters);
		_g_object_unref0 (_data_->contents);
		_xmpp_jid_unref0 (_data_->my_jid);
		_g_object_unref0 (_data_->jingle_module);
		g_object_unref (_data_->_async_result);
		return FALSE;
	} else {
		_g_object_unref0 (_data_->video_content);
		_g_object_unref0 (_data_->audio_content);
		_g_object_unref0 (_data_->audio_transport_params);
		_g_object_unref0 (_data_->audio_transport);
		_g_object_unref0 (_data_->audio_content_parameters);
		_g_object_unref0 (_data_->contents);
		_xmpp_jid_unref0 (_data_->my_jid);
		_g_object_unref0 (_data_->jingle_module);
		g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
		g_clear_error (&_data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
}

static void
xmpp_xep_jingle_rtp_module_add_outgoing_video_content_data_free (gpointer _data)
{
	XmppXepJingleRtpModuleAddOutgoingVideoContentData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_g_object_unref0 (_data_->session);
	_xmpp_jid_unref0 (_data_->muji_muc);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepJingleRtpModuleAddOutgoingVideoContentData, _data_);
}

void
xmpp_xep_jingle_rtp_module_add_outgoing_video_content (XmppXepJingleRtpModule* self,
                                                       XmppXmppStream* stream,
                                                       XmppXepJingleSession* session,
                                                       XmppJid* muji_muc,
                                                       GAsyncReadyCallback _callback_,
                                                       gpointer _user_data_)
{
	XmppXepJingleRtpModuleAddOutgoingVideoContentData* _data_;
	XmppXepJingleRtpModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppXepJingleSession* _tmp2_;
	XmppJid* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (session != NULL);
	_data_ = g_slice_new0 (XmppXepJingleRtpModuleAddOutgoingVideoContentData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_jingle_rtp_module_add_outgoing_video_content_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _g_object_ref0 (session);
	_g_object_unref0 (_data_->session);
	_data_->session = _tmp2_;
	_tmp3_ = _xmpp_jid_ref0 (muji_muc);
	_xmpp_jid_unref0 (_data_->muji_muc);
	_data_->muji_muc = _tmp3_;
	xmpp_xep_jingle_rtp_module_add_outgoing_video_content_co (_data_);
}

XmppXepJingleContent*
xmpp_xep_jingle_rtp_module_add_outgoing_video_content_finish (XmppXepJingleRtpModule* self,
                                                              GAsyncResult* _res_,
                                                              GError** error)
{
	XmppXepJingleContent* result;
	XmppXepJingleRtpModuleAddOutgoingVideoContentData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
xmpp_xep_jingle_rtp_module_add_outgoing_video_content_ready (GObject* source_object,
                                                             GAsyncResult* _res_,
                                                             gpointer _user_data_)
{
	XmppXepJingleRtpModuleAddOutgoingVideoContentData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_jingle_rtp_module_add_outgoing_video_content_co (_data_);
}

static gboolean
xmpp_xep_jingle_rtp_module_add_outgoing_video_content_co (XmppXepJingleRtpModuleAddOutgoingVideoContentData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_xep_jingle_session_get_local_full_jid (_data_->session);
	_data_->_tmp1_ = _data_->_tmp0_;
	_data_->_tmp2_ = _xmpp_jid_ref0 (_data_->_tmp1_);
	_data_->my_jid = _data_->_tmp2_;
	_data_->_tmp3_ = xmpp_xep_jingle_session_get_peer_full_jid (_data_->session);
	_data_->_tmp4_ = _data_->_tmp3_;
	_data_->_tmp5_ = _xmpp_jid_ref0 (_data_->_tmp4_);
	_data_->receiver_full_jid = _data_->_tmp5_;
	_data_->content = NULL;
	{
		_data_->_tmp6_ = _data_->session->contents;
		_data_->_c_list = _data_->_tmp6_;
		_data_->_tmp7_ = _data_->_c_list;
		_data_->_tmp8_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp7_);
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_c_size = _data_->_tmp9_;
		_data_->_c_index = -1;
		while (TRUE) {
			_data_->_c_index = _data_->_c_index + 1;
			_data_->_tmp10_ = _data_->_c_index;
			_data_->_tmp11_ = _data_->_c_size;
			if (!(_data_->_tmp10_ < _data_->_tmp11_)) {
				break;
			}
			_data_->_tmp12_ = _data_->_c_list;
			_data_->_tmp13_ = gee_list_get (_data_->_tmp12_, _data_->_c_index);
			_data_->c = (XmppXepJingleContent*) _data_->_tmp13_;
			_data_->_tmp14_ = _data_->c;
			_data_->_tmp15_ = _data_->_tmp14_->content_params;
			_data_->_tmp16_ = _g_object_ref0 (XMPP_XEP_JINGLE_RTP_IS_PARAMETERS (_data_->_tmp15_) ? ((XmppXepJingleRtpParameters*) _data_->_tmp15_) : NULL);
			_data_->parameters = _data_->_tmp16_;
			_data_->_tmp17_ = _data_->parameters;
			if (_data_->_tmp17_ == NULL) {
				_g_object_unref0 (_data_->parameters);
				_g_object_unref0 (_data_->c);
				continue;
			}
			_data_->_tmp18_ = _data_->parameters;
			_data_->_tmp19_ = xmpp_xep_jingle_rtp_parameters_get_media (_data_->_tmp18_);
			_data_->_tmp20_ = _data_->_tmp19_;
			if (g_strcmp0 (_data_->_tmp20_, "video") == 0) {
				_data_->_tmp21_ = _data_->c;
				_data_->_tmp22_ = _g_object_ref0 (_data_->_tmp21_);
				_g_object_unref0 (_data_->content);
				_data_->content = _data_->_tmp22_;
				_g_object_unref0 (_data_->parameters);
				_g_object_unref0 (_data_->c);
				break;
			}
			_g_object_unref0 (_data_->parameters);
			_g_object_unref0 (_data_->c);
		}
	}
	_data_->_tmp23_ = _data_->content;
	if (_data_->_tmp23_ == NULL) {
		_data_->_state_ = 1;
		xmpp_xep_jingle_rtp_module_get_supported_payloads (_data_->self, "video", xmpp_xep_jingle_rtp_module_add_outgoing_video_content_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp24_ = xmpp_xep_jingle_rtp_module_get_supported_payloads_finish (_data_->self, _data_->_res_);
		_data_->_tmp25_ = _data_->_tmp24_;
		_data_->_tmp26_ = xmpp_xep_jingle_rtp_parameters_new (_data_->self, "video", _data_->_tmp25_, NULL, FALSE, NULL, NULL, FALSE, NULL);
		_data_->_tmp27_ = _data_->_tmp26_;
		_g_object_unref0 (_data_->_tmp25_);
		_data_->video_content_parameters = _data_->_tmp27_;
		_data_->_tmp28_ = _data_->video_content_parameters;
		_data_->_tmp29_ = xmpp_xep_jingle_rtp_module_generate_local_crypto (_data_->self);
		_xmpp_xep_jingle_rtp_crypto_unref0 (_data_->_tmp28_->local_crypto);
		_data_->_tmp28_->local_crypto = _data_->_tmp29_;
		_data_->_tmp30_ = _data_->video_content_parameters;
		_data_->_tmp31_ = _data_->_tmp30_->header_extensions;
		_data_->_tmp32_ = xmpp_xep_jingle_rtp_module_get_suggested_header_extensions (_data_->self, "video");
		_data_->_tmp33_ = _data_->_tmp32_;
		gee_collection_add_all ((GeeCollection*) _data_->_tmp31_, (GeeCollection*) _data_->_tmp33_);
		_g_object_unref0 (_data_->_tmp33_);
		_data_->_tmp34_ = xmpp_xep_jingle_module_IDENTITY;
		_data_->_tmp35_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_JINGLE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp34_);
		_data_->_tmp36_ = (XmppXepJingleModule*) _data_->_tmp35_;
		_data_->_tmp37_ = _data_->self->priv->content_type;
		_data_->_tmp38_ = xmpp_xep_jingle_content_type_get_required_transport_type ((XmppXepJingleContentType*) _data_->_tmp37_);
		_data_->_tmp39_ = _data_->_tmp38_;
		_data_->_tmp40_ = _data_->self->priv->content_type;
		_data_->_tmp41_ = xmpp_xep_jingle_content_type_get_required_components ((XmppXepJingleContentType*) _data_->_tmp40_);
		_data_->_tmp42_ = _data_->_tmp41_;
		_data_->_tmp43_ = _data_->receiver_full_jid;
		_data_->_tmp44_ = gee_set_empty (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free);
		_data_->_tmp45_ = _data_->_tmp44_;
		_data_->_state_ = 2;
		xmpp_xep_jingle_module_select_transport (_data_->_tmp36_, _data_->stream, _data_->_tmp39_, _data_->_tmp42_, _data_->_tmp43_, _data_->_tmp45_, xmpp_xep_jingle_rtp_module_add_outgoing_video_content_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp46_ = xmpp_xep_jingle_module_select_transport_finish (_data_->_tmp36_, _data_->_res_);
		_data_->_tmp47_ = _data_->_tmp46_;
		_g_object_unref0 (_data_->_tmp45_);
		_g_object_unref0 (_data_->_tmp36_);
		_data_->video_transport = _data_->_tmp47_;
		_data_->_tmp48_ = _data_->video_transport;
		if (_data_->_tmp48_ == NULL) {
			_data_->_tmp49_ = g_error_new_literal (XMPP_XEP_JINGLE_ERROR, XMPP_XEP_JINGLE_ERROR_NO_SHARED_PROTOCOLS, "No suitable video transports");
			_data_->_inner_error0_ = _data_->_tmp49_;
			if (_data_->_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->video_transport);
				_g_object_unref0 (_data_->video_content_parameters);
				_g_object_unref0 (_data_->content);
				_xmpp_jid_unref0 (_data_->receiver_full_jid);
				_xmpp_jid_unref0 (_data_->my_jid);
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (_data_->video_transport);
				_g_object_unref0 (_data_->video_content_parameters);
				_g_object_unref0 (_data_->content);
				_xmpp_jid_unref0 (_data_->receiver_full_jid);
				_xmpp_jid_unref0 (_data_->my_jid);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
		_data_->_tmp50_ = _data_->video_transport;
		_data_->_tmp51_ = _data_->self->priv->content_type;
		_data_->_tmp52_ = xmpp_xep_jingle_content_type_get_required_components ((XmppXepJingleContentType*) _data_->_tmp51_);
		_data_->_tmp53_ = _data_->_tmp52_;
		_data_->_tmp54_ = _data_->my_jid;
		_data_->_tmp55_ = _data_->receiver_full_jid;
		_data_->_tmp56_ = xmpp_xep_jingle_transport_create_transport_parameters (_data_->_tmp50_, _data_->stream, _data_->_tmp53_, _data_->_tmp54_, _data_->_tmp55_, &_data_->_inner_error0_);
		_data_->video_transport_params = _data_->_tmp56_;
		if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
			if (_data_->_inner_error0_->domain == XMPP_XEP_JINGLE_ERROR) {
				g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
				_g_object_unref0 (_data_->video_transport);
				_g_object_unref0 (_data_->video_content_parameters);
				_g_object_unref0 (_data_->content);
				_xmpp_jid_unref0 (_data_->receiver_full_jid);
				_xmpp_jid_unref0 (_data_->my_jid);
				g_object_unref (_data_->_async_result);
				return FALSE;
			} else {
				_g_object_unref0 (_data_->video_transport);
				_g_object_unref0 (_data_->video_content_parameters);
				_g_object_unref0 (_data_->content);
				_xmpp_jid_unref0 (_data_->receiver_full_jid);
				_xmpp_jid_unref0 (_data_->my_jid);
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error0_->message, g_quark_to_string (_data_->_inner_error0_->domain), _data_->_inner_error0_->code);
				g_clear_error (&_data_->_inner_error0_);
				g_object_unref (_data_->_async_result);
				return FALSE;
			}
		}
		_data_->_tmp58_ = xmpp_xep_jingle_session_get_we_initiated (_data_->session);
		_data_->_tmp59_ = _data_->_tmp58_;
		if (_data_->_tmp59_) {
			_data_->_tmp57_ = XMPP_XEP_JINGLE_SENDERS_INITIATOR;
		} else {
			_data_->_tmp57_ = XMPP_XEP_JINGLE_SENDERS_RESPONDER;
		}
		_data_->_tmp60_ = _data_->self->priv->content_type;
		_data_->_tmp61_ = _data_->video_content_parameters;
		_data_->_tmp62_ = _data_->video_transport;
		_data_->_tmp63_ = _data_->video_transport_params;
		_data_->_tmp64_ = _data_->my_jid;
		_data_->_tmp65_ = _data_->receiver_full_jid;
		_data_->_tmp66_ = xmpp_xep_jingle_content_new_initiate_sent ("video", _data_->_tmp57_, (XmppXepJingleContentType*) _data_->_tmp60_, (XmppXepJingleContentParameters*) _data_->_tmp61_, _data_->_tmp62_, _data_->_tmp63_, NULL, NULL, _data_->_tmp64_, _data_->_tmp65_);
		_g_object_unref0 (_data_->content);
		_data_->content = _data_->_tmp66_;
		_data_->_tmp67_ = _data_->content;
		xmpp_xep_jingle_session_add_content (_data_->session, _data_->_tmp67_, NULL, NULL);
		_g_object_unref0 (_data_->video_transport_params);
		_g_object_unref0 (_data_->video_transport);
		_g_object_unref0 (_data_->video_content_parameters);
	} else {
		_data_->_tmp68_ = xmpp_xep_jingle_session_get_we_initiated (_data_->session);
		_data_->_tmp69_ = _data_->_tmp68_;
		_data_->we_initiated = _data_->_tmp69_;
		if (_data_->we_initiated) {
			_data_->_tmp70_ = XMPP_XEP_JINGLE_SENDERS_INITIATOR;
		} else {
			_data_->_tmp70_ = XMPP_XEP_JINGLE_SENDERS_RESPONDER;
		}
		_data_->want_sender = _data_->_tmp70_;
		_data_->_tmp72_ = _data_->content;
		_data_->_tmp73_ = xmpp_xep_jingle_content_get_senders (_data_->_tmp72_);
		_data_->_tmp74_ = _data_->_tmp73_;
		if (_data_->_tmp74_ == XMPP_XEP_JINGLE_SENDERS_BOTH) {
			_data_->_tmp71_ = TRUE;
		} else {
			_data_->_tmp75_ = _data_->content;
			_data_->_tmp76_ = xmpp_xep_jingle_content_get_senders (_data_->_tmp75_);
			_data_->_tmp77_ = _data_->_tmp76_;
			_data_->_tmp71_ = _data_->_tmp77_ == _data_->want_sender;
		}
		if (_data_->_tmp71_) {
			g_warning ("jingle_rtp_module.vala:125: want to add video but senders is already b" \
"oth/target");
		} else {
			_data_->_tmp78_ = _data_->content;
			_data_->_tmp79_ = xmpp_xep_jingle_content_get_senders (_data_->_tmp78_);
			_data_->_tmp80_ = _data_->_tmp79_;
			if (_data_->_tmp80_ == XMPP_XEP_JINGLE_SENDERS_NONE) {
				_data_->_tmp81_ = _data_->content;
				xmpp_xep_jingle_content_modify (_data_->_tmp81_, _data_->want_sender);
			} else {
				_data_->_tmp82_ = _data_->content;
				xmpp_xep_jingle_content_modify (_data_->_tmp82_, XMPP_XEP_JINGLE_SENDERS_BOTH);
			}
		}
	}
	_data_->result = _data_->content;
	_xmpp_jid_unref0 (_data_->receiver_full_jid);
	_xmpp_jid_unref0 (_data_->my_jid);
	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 void
xmpp_xep_jingle_rtp_module_real_attach (XmppXmppStreamModule* base,
                                        XmppXmppStream* stream)
{
	XmppXepJingleRtpModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppXepServiceDiscoveryModule* _tmp5_;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppXepServiceDiscoveryModule* _tmp8_;
	XmppModuleIdentity* _tmp9_;
	gpointer _tmp10_;
	XmppXepJingleModule* _tmp11_;
	XmppXepJingleRtpContentType* _tmp12_;
	XmppModuleIdentity* _tmp13_;
	gpointer _tmp14_;
	XmppXepJingleModule* _tmp15_;
	XmppXepJingleRtpSessionInfoType* _tmp16_;
	self = (XmppXepJingleRtpModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppXepServiceDiscoveryModule*) _tmp1_;
	xmpp_xep_service_discovery_module_add_feature (_tmp2_, stream, XMPP_XEP_JINGLE_RTP_NS_URI);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp4_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (XmppXepServiceDiscoveryModule*) _tmp4_;
	xmpp_xep_service_discovery_module_add_feature (_tmp5_, stream, XMPP_XEP_JINGLE_RTP_NS_URI_AUDIO);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp7_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp6_);
	_tmp8_ = (XmppXepServiceDiscoveryModule*) _tmp7_;
	xmpp_xep_service_discovery_module_add_feature (_tmp8_, stream, XMPP_XEP_JINGLE_RTP_NS_URI_VIDEO);
	_g_object_unref0 (_tmp8_);
	_tmp9_ = xmpp_xep_jingle_module_IDENTITY;
	_tmp10_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_JINGLE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp9_);
	_tmp11_ = (XmppXepJingleModule*) _tmp10_;
	_tmp12_ = self->priv->content_type;
	xmpp_xep_jingle_module_register_content_type (_tmp11_, (XmppXepJingleContentType*) _tmp12_);
	_g_object_unref0 (_tmp11_);
	_tmp13_ = xmpp_xep_jingle_module_IDENTITY;
	_tmp14_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_JINGLE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp13_);
	_tmp15_ = (XmppXepJingleModule*) _tmp14_;
	_tmp16_ = self->session_info_type;
	xmpp_xep_jingle_module_register_session_info_type (_tmp15_, (XmppXepJingleSessionInfoNs*) _tmp16_);
	_g_object_unref0 (_tmp15_);
}

static void
xmpp_xep_jingle_rtp_module_real_detach (XmppXmppStreamModule* base,
                                        XmppXmppStream* stream)
{
	XmppXepJingleRtpModule * self;
	XmppModuleIdentity* _tmp0_;
	gpointer _tmp1_;
	XmppXepServiceDiscoveryModule* _tmp2_;
	XmppModuleIdentity* _tmp3_;
	gpointer _tmp4_;
	XmppXepServiceDiscoveryModule* _tmp5_;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	XmppXepServiceDiscoveryModule* _tmp8_;
	self = (XmppXepJingleRtpModule*) base;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp1_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp0_);
	_tmp2_ = (XmppXepServiceDiscoveryModule*) _tmp1_;
	xmpp_xep_service_discovery_module_remove_feature (_tmp2_, stream, XMPP_XEP_JINGLE_RTP_NS_URI);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp4_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp3_);
	_tmp5_ = (XmppXepServiceDiscoveryModule*) _tmp4_;
	xmpp_xep_service_discovery_module_remove_feature (_tmp5_, stream, XMPP_XEP_JINGLE_RTP_NS_URI_AUDIO);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = xmpp_xep_service_discovery_module_IDENTITY;
	_tmp7_ = xmpp_xmpp_stream_get_module (stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp6_);
	_tmp8_ = (XmppXepServiceDiscoveryModule*) _tmp7_;
	xmpp_xep_service_discovery_module_remove_feature (_tmp8_, stream, XMPP_XEP_JINGLE_RTP_NS_URI_VIDEO);
	_g_object_unref0 (_tmp8_);
}

static void
xmpp_xep_jingle_rtp_module_is_available_data_free (gpointer _data)
{
	XmppXepJingleRtpModuleIsAvailableData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->stream);
	_xmpp_jid_unref0 (_data_->full_jid);
	_g_object_unref0 (_data_->self);
	g_slice_free (XmppXepJingleRtpModuleIsAvailableData, _data_);
}

void
xmpp_xep_jingle_rtp_module_is_available (XmppXepJingleRtpModule* self,
                                         XmppXmppStream* stream,
                                         XmppJid* full_jid,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	XmppXepJingleRtpModuleIsAvailableData* _data_;
	XmppXepJingleRtpModule* _tmp0_;
	XmppXmppStream* _tmp1_;
	XmppJid* _tmp2_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (full_jid != NULL);
	_data_ = g_slice_new0 (XmppXepJingleRtpModuleIsAvailableData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, xmpp_xep_jingle_rtp_module_is_available_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (stream);
	_g_object_unref0 (_data_->stream);
	_data_->stream = _tmp1_;
	_tmp2_ = _xmpp_jid_ref0 (full_jid);
	_xmpp_jid_unref0 (_data_->full_jid);
	_data_->full_jid = _tmp2_;
	xmpp_xep_jingle_rtp_module_is_available_co (_data_);
}

gboolean
xmpp_xep_jingle_rtp_module_is_available_finish (XmppXepJingleRtpModule* self,
                                                GAsyncResult* _res_)
{
	gboolean result;
	XmppXepJingleRtpModuleIsAvailableData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
	result = _data_->result;
	return result;
}

static void
xmpp_xep_jingle_rtp_module_is_available_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	XmppXepJingleRtpModuleIsAvailableData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	xmpp_xep_jingle_rtp_module_is_available_co (_data_);
}

static gboolean*
_bool_dup (gboolean* self)
{
	gboolean* dup;
	dup = g_new0 (gboolean, 1);
	memcpy (dup, self, sizeof (gboolean));
	return dup;
}

static gpointer
__bool_dup0 (gpointer self)
{
	return self ? _bool_dup (self) : NULL;
}

static gboolean
xmpp_xep_jingle_rtp_module_is_available_co (XmppXepJingleRtpModuleIsAvailableData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = xmpp_xep_service_discovery_module_IDENTITY;
	_data_->_tmp1_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_SERVICE_DISCOVERY_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp0_);
	_data_->_tmp2_ = (XmppXepServiceDiscoveryModule*) _data_->_tmp1_;
	_data_->_state_ = 1;
	xmpp_xep_service_discovery_module_has_entity_feature (_data_->_tmp2_, _data_->stream, _data_->full_jid, XMPP_XEP_JINGLE_RTP_NS_URI, xmpp_xep_jingle_rtp_module_is_available_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = xmpp_xep_service_discovery_module_has_entity_feature_finish (_data_->_tmp2_, _data_->_res_);
	_data_->_tmp4_ = __bool_dup0 (&_data_->_tmp3_);
	_data_->_tmp5_ = _data_->_tmp4_;
	_g_object_unref0 (_data_->_tmp2_);
	_data_->has_feature = _data_->_tmp5_;
	_data_->_tmp7_ = _data_->has_feature;
	if (_data_->_tmp7_ == NULL) {
		_data_->_tmp6_ = TRUE;
	} else {
		_data_->_tmp8_ = _data_->has_feature;
		_data_->_tmp6_ = !((gboolean) (*_data_->_tmp8_));
	}
	if (_data_->_tmp6_) {
		_data_->result = FALSE;
		_g_free0 (_data_->has_feature);
		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_->_tmp9_ = xmpp_xep_jingle_module_IDENTITY;
	_data_->_tmp10_ = xmpp_xmpp_stream_get_module (_data_->stream, XMPP_XEP_JINGLE_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp9_);
	_data_->_tmp11_ = (XmppXepJingleModule*) _data_->_tmp10_;
	_data_->_tmp12_ = _data_->self->priv->content_type;
	_data_->_tmp13_ = xmpp_xep_jingle_content_type_get_required_transport_type ((XmppXepJingleContentType*) _data_->_tmp12_);
	_data_->_tmp14_ = _data_->_tmp13_;
	_data_->_tmp15_ = _data_->self->priv->content_type;
	_data_->_tmp16_ = xmpp_xep_jingle_content_type_get_required_components ((XmppXepJingleContentType*) _data_->_tmp15_);
	_data_->_tmp17_ = _data_->_tmp16_;
	_data_->_state_ = 2;
	xmpp_xep_jingle_module_is_available (_data_->_tmp11_, _data_->stream, _data_->_tmp14_, _data_->_tmp17_, _data_->full_jid, xmpp_xep_jingle_rtp_module_is_available_ready, _data_);
	return FALSE;
	_state_2:
	_data_->_tmp18_ = xmpp_xep_jingle_module_is_available_finish (_data_->_tmp11_, _data_->_res_);
	_g_object_unref0 (_data_->_tmp11_);
	_data_->result = _data_->_tmp18_;
	_g_free0 (_data_->has_feature);
	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 gchar*
xmpp_xep_jingle_rtp_module_real_get_ns (XmppXmppStreamModule* base)
{
	XmppXepJingleRtpModule * self;
	gchar* _tmp0_;
	gchar* result;
	self = (XmppXepJingleRtpModule*) base;
	_tmp0_ = g_strdup (XMPP_XEP_JINGLE_RTP_NS_URI);
	result = _tmp0_;
	return result;
}

static gchar*
xmpp_xep_jingle_rtp_module_real_get_id (XmppXmppStreamModule* base)
{
	XmppXepJingleRtpModule * self;
	XmppModuleIdentity* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* result;
	self = (XmppXepJingleRtpModule*) base;
	_tmp0_ = xmpp_xep_jingle_rtp_module_IDENTITY;
	_tmp1_ = xmpp_module_identity_get_id (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	result = _tmp3_;
	return result;
}

static void
xmpp_xep_jingle_rtp_module_class_init (XmppXepJingleRtpModuleClass * klass,
                                       gpointer klass_data)
{
	XmppModuleIdentity* _tmp0_;
	xmpp_xep_jingle_rtp_module_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &XmppXepJingleRtpModule_private_offset);
	((XmppXepJingleRtpModuleClass *) klass)->generate_local_crypto = (XmppXepJingleRtpCrypto* (*) (XmppXepJingleRtpModule*)) xmpp_xep_jingle_rtp_module_real_generate_local_crypto;
	((XmppXepJingleRtpModuleClass *) klass)->pick_remote_crypto = (XmppXepJingleRtpCrypto* (*) (XmppXepJingleRtpModule*, GeeList*)) xmpp_xep_jingle_rtp_module_real_pick_remote_crypto;
	((XmppXepJingleRtpModuleClass *) klass)->pick_local_crypto = (XmppXepJingleRtpCrypto* (*) (XmppXepJingleRtpModule*, XmppXepJingleRtpCrypto*)) xmpp_xep_jingle_rtp_module_real_pick_local_crypto;
	((XmppXepJingleRtpModuleClass *) klass)->create_stream = (XmppXepJingleRtpStream* (*) (XmppXepJingleRtpModule*, XmppXepJingleContent*)) xmpp_xep_jingle_rtp_module_real_create_stream;
	((XmppXepJingleRtpModuleClass *) klass)->is_header_extension_supported = (gboolean (*) (XmppXepJingleRtpModule*, const gchar*, XmppXepJingleRtpHeaderExtension*)) xmpp_xep_jingle_rtp_module_real_is_header_extension_supported;
	((XmppXepJingleRtpModuleClass *) klass)->get_suggested_header_extensions = (GeeList* (*) (XmppXepJingleRtpModule*, const gchar*)) xmpp_xep_jingle_rtp_module_real_get_suggested_header_extensions;
	((XmppXepJingleRtpModuleClass *) klass)->close_stream = (void (*) (XmppXepJingleRtpModule*, XmppXepJingleRtpStream*)) xmpp_xep_jingle_rtp_module_real_close_stream;
	((XmppXmppStreamModuleClass *) klass)->attach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_jingle_rtp_module_real_attach;
	((XmppXmppStreamModuleClass *) klass)->detach = (void (*) (XmppXmppStreamModule*, XmppXmppStream*)) xmpp_xep_jingle_rtp_module_real_detach;
	((XmppXmppStreamModuleClass *) klass)->get_ns = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_jingle_rtp_module_real_get_ns;
	((XmppXmppStreamModuleClass *) klass)->get_id = (gchar* (*) (XmppXmppStreamModule*)) xmpp_xep_jingle_rtp_module_real_get_id;
	G_OBJECT_CLASS (klass)->finalize = xmpp_xep_jingle_rtp_module_finalize;
	_tmp0_ = xmpp_module_identity_new (XMPP_XEP_JINGLE_RTP_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, XMPP_XEP_JINGLE_RTP_NS_URI, "0167_jingle_rtp");
	xmpp_xep_jingle_rtp_module_IDENTITY = _tmp0_;
}

static void
xmpp_xep_jingle_rtp_module_instance_init (XmppXepJingleRtpModule * self,
                                          gpointer klass)
{
	XmppXepJingleRtpSessionInfoType* _tmp0_;
	self->priv = xmpp_xep_jingle_rtp_module_get_instance_private (self);
	_tmp0_ = xmpp_xep_jingle_rtp_session_info_type_new ();
	self->session_info_type = _tmp0_;
}

static void
xmpp_xep_jingle_rtp_module_finalize (GObject * obj)
{
	XmppXepJingleRtpModule * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JINGLE_RTP_TYPE_MODULE, XmppXepJingleRtpModule);
	_g_object_unref0 (self->priv->content_type);
	_g_object_unref0 (self->session_info_type);
	G_OBJECT_CLASS (xmpp_xep_jingle_rtp_module_parent_class)->finalize (obj);
}

static GType
xmpp_xep_jingle_rtp_module_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJingleRtpModuleClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jingle_rtp_module_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJingleRtpModule), 0, (GInstanceInitFunc) xmpp_xep_jingle_rtp_module_instance_init, NULL };
	GType xmpp_xep_jingle_rtp_module_type_id;
	xmpp_xep_jingle_rtp_module_type_id = g_type_register_static (XMPP_TYPE_XMPP_STREAM_MODULE, "XmppXepJingleRtpModule", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	XmppXepJingleRtpModule_private_offset = g_type_add_instance_private (xmpp_xep_jingle_rtp_module_type_id, sizeof (XmppXepJingleRtpModulePrivate));
	return xmpp_xep_jingle_rtp_module_type_id;
}

GType
xmpp_xep_jingle_rtp_module_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_rtp_module_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_rtp_module_type_id__once)) {
		GType xmpp_xep_jingle_rtp_module_type_id;
		xmpp_xep_jingle_rtp_module_type_id = xmpp_xep_jingle_rtp_module_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_rtp_module_type_id__once, xmpp_xep_jingle_rtp_module_type_id);
	}
	return xmpp_xep_jingle_rtp_module_type_id__once;
}

static inline gpointer
xmpp_xep_jingle_rtp_crypto_get_instance_private (XmppXepJingleRtpCrypto* self)
{
	return G_STRUCT_MEMBER_P (self, XmppXepJingleRtpCrypto_private_offset);
}

XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_crypto_create (const gchar* crypto_suite,
                                   guint8* key_and_salt,
                                   gint key_and_salt_length1,
                                   const gchar* session_params,
                                   const gchar* tag)
{
	XmppXepJingleRtpCrypto* crypto = NULL;
	XmppXepJingleRtpCrypto* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	XmppXepJingleRtpCrypto* result;
	g_return_val_if_fail (crypto_suite != NULL, NULL);
	g_return_val_if_fail (tag != NULL, NULL);
	_tmp0_ = xmpp_xep_jingle_rtp_crypto_new ();
	crypto = _tmp0_;
	xmpp_xep_jingle_rtp_crypto_set_crypto_suite (crypto, crypto_suite);
	_tmp1_ = g_base64_encode (key_and_salt, (gint) key_and_salt_length1);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strconcat ("inline:", _tmp2_, NULL);
	_tmp4_ = _tmp3_;
	xmpp_xep_jingle_rtp_crypto_set_key_params (crypto, _tmp4_);
	_g_free0 (_tmp4_);
	_g_free0 (_tmp2_);
	xmpp_xep_jingle_rtp_crypto_set_session_params (crypto, session_params);
	xmpp_xep_jingle_rtp_crypto_set_tag (crypto, tag);
	result = crypto;
	return result;
}

XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_crypto_rekey (XmppXepJingleRtpCrypto* self,
                                  guint8* key_and_salt,
                                  gint key_and_salt_length1)
{
	XmppXepJingleRtpCrypto* crypto = NULL;
	XmppXepJingleRtpCrypto* _tmp0_;
	const gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	XmppXepJingleRtpCrypto* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = xmpp_xep_jingle_rtp_crypto_new ();
	crypto = _tmp0_;
	_tmp1_ = self->priv->_crypto_suite;
	xmpp_xep_jingle_rtp_crypto_set_crypto_suite (crypto, _tmp1_);
	_tmp2_ = g_base64_encode (key_and_salt, (gint) key_and_salt_length1);
	_tmp3_ = _tmp2_;
	_tmp4_ = g_strconcat ("inline:", _tmp3_, NULL);
	_tmp5_ = _tmp4_;
	xmpp_xep_jingle_rtp_crypto_set_key_params (crypto, _tmp5_);
	_g_free0 (_tmp5_);
	_g_free0 (_tmp3_);
	_tmp6_ = self->priv->_session_params;
	xmpp_xep_jingle_rtp_crypto_set_session_params (crypto, _tmp6_);
	_tmp7_ = self->priv->_tag;
	xmpp_xep_jingle_rtp_crypto_set_tag (crypto, _tmp7_);
	result = crypto;
	return result;
}

XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_crypto_parse (XmppStanzaNode* node)
{
	XmppXepJingleRtpCrypto* crypto = NULL;
	XmppXepJingleRtpCrypto* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	XmppXepJingleRtpCrypto* result;
	g_return_val_if_fail (node != NULL, NULL);
	_tmp0_ = xmpp_xep_jingle_rtp_crypto_new ();
	crypto = _tmp0_;
	_tmp1_ = xmpp_stanza_node_get_attribute (node, "crypto-suite", NULL);
	xmpp_xep_jingle_rtp_crypto_set_crypto_suite (crypto, _tmp1_);
	_tmp2_ = xmpp_stanza_node_get_attribute (node, "key-params", NULL);
	xmpp_xep_jingle_rtp_crypto_set_key_params (crypto, _tmp2_);
	_tmp3_ = xmpp_stanza_node_get_attribute (node, "session-params", NULL);
	xmpp_xep_jingle_rtp_crypto_set_session_params (crypto, _tmp3_);
	_tmp4_ = xmpp_stanza_node_get_attribute (node, "tag", NULL);
	xmpp_xep_jingle_rtp_crypto_set_tag (crypto, _tmp4_);
	result = crypto;
	return result;
}

XmppStanzaNode*
xmpp_xep_jingle_rtp_crypto_to_xml (XmppXepJingleRtpCrypto* self)
{
	XmppStanzaNode* node = NULL;
	XmppStanzaNode* _tmp0_;
	XmppStanzaNode* _tmp1_;
	const gchar* _tmp2_;
	XmppStanzaNode* _tmp3_;
	XmppStanzaNode* _tmp4_;
	const gchar* _tmp5_;
	XmppStanzaNode* _tmp6_;
	XmppStanzaNode* _tmp7_;
	const gchar* _tmp8_;
	XmppStanzaNode* _tmp9_;
	XmppStanzaNode* _tmp10_;
	const gchar* _tmp11_;
	XmppStanzaNode* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = xmpp_stanza_node_new_build ("crypto", XMPP_XEP_JINGLE_RTP_NS_URI, NULL, NULL);
	_tmp1_ = _tmp0_;
	_tmp2_ = self->priv->_crypto_suite;
	_tmp3_ = xmpp_stanza_node_put_attribute (_tmp1_, "crypto-suite", _tmp2_, NULL);
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->_key_params;
	_tmp6_ = xmpp_stanza_node_put_attribute (_tmp4_, "key-params", _tmp5_, NULL);
	_tmp7_ = _tmp6_;
	_tmp8_ = self->priv->_tag;
	_tmp9_ = xmpp_stanza_node_put_attribute (_tmp7_, "tag", _tmp8_, NULL);
	_tmp10_ = _tmp9_;
	_xmpp_stanza_entry_unref0 (_tmp7_);
	_xmpp_stanza_entry_unref0 (_tmp4_);
	_xmpp_stanza_entry_unref0 (_tmp1_);
	node = _tmp10_;
	_tmp11_ = self->priv->_session_params;
	if (_tmp11_ != NULL) {
		XmppStanzaNode* _tmp12_;
		const gchar* _tmp13_;
		XmppStanzaNode* _tmp14_;
		XmppStanzaNode* _tmp15_;
		_tmp12_ = node;
		_tmp13_ = self->priv->_session_params;
		_tmp14_ = xmpp_stanza_node_put_attribute (_tmp12_, "session-params", _tmp13_, NULL);
		_tmp15_ = _tmp14_;
		_xmpp_stanza_entry_unref0 (_tmp15_);
	}
	result = node;
	return result;
}

XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_crypto_construct (GType object_type)
{
	XmppXepJingleRtpCrypto* self = NULL;
	self = (XmppXepJingleRtpCrypto*) g_type_create_instance (object_type);
	return self;
}

XmppXepJingleRtpCrypto*
xmpp_xep_jingle_rtp_crypto_new (void)
{
	return xmpp_xep_jingle_rtp_crypto_construct (XMPP_XEP_JINGLE_RTP_TYPE_CRYPTO);
}

const gchar*
xmpp_xep_jingle_rtp_crypto_get_crypto_suite (XmppXepJingleRtpCrypto* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_crypto_suite;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jingle_rtp_crypto_set_crypto_suite (XmppXepJingleRtpCrypto* self,
                                             const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_crypto_suite);
	self->priv->_crypto_suite = _tmp0_;
}

const gchar*
xmpp_xep_jingle_rtp_crypto_get_key_params (XmppXepJingleRtpCrypto* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_key_params;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jingle_rtp_crypto_set_key_params (XmppXepJingleRtpCrypto* self,
                                           const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_key_params);
	self->priv->_key_params = _tmp0_;
}

const gchar*
xmpp_xep_jingle_rtp_crypto_get_session_params (XmppXepJingleRtpCrypto* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_session_params;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jingle_rtp_crypto_set_session_params (XmppXepJingleRtpCrypto* self,
                                               const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_session_params);
	self->priv->_session_params = _tmp0_;
}

const gchar*
xmpp_xep_jingle_rtp_crypto_get_tag (XmppXepJingleRtpCrypto* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_tag;
	result = _tmp0_;
	return result;
}

static void
xmpp_xep_jingle_rtp_crypto_set_tag (XmppXepJingleRtpCrypto* self,
                                    const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_tag);
	self->priv->_tag = _tmp0_;
}

static gint
string_index_of (const gchar* self,
                 const gchar* needle,
                 gint start_index)
{
	gchar* _result_ = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (needle != NULL, -1);
	_tmp0_ = strstr (((gchar*) self) + start_index, (gchar*) needle);
	_result_ = _tmp0_;
	_tmp1_ = _result_;
	if (_tmp1_ != NULL) {
		gchar* _tmp2_;
		_tmp2_ = _result_;
		result = (gint) (_tmp2_ - ((gchar*) self));
		return result;
	} else {
		result = -1;
		return result;
	}
}

static glong
string_strnlen (gchar* str,
                glong maxlen)
{
	gchar* end = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	glong result;
	_tmp0_ = memchr (str, 0, (gsize) maxlen);
	end = _tmp0_;
	_tmp1_ = end;
	if (_tmp1_ == NULL) {
		result = maxlen;
		return result;
	} else {
		gchar* _tmp2_;
		_tmp2_ = end;
		result = (glong) (_tmp2_ - str);
		return result;
	}
}

static gchar*
string_substring (const gchar* self,
                  glong offset,
                  glong len)
{
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	gchar* _tmp3_;
	gchar* result;
	g_return_val_if_fail (self != NULL, NULL);
	if (offset >= ((glong) 0)) {
		_tmp0_ = len >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		string_length = string_strnlen ((gchar*) self, offset + len);
	} else {
		gint _tmp1_;
		gint _tmp2_;
		_tmp1_ = strlen (self);
		_tmp2_ = _tmp1_;
		string_length = (glong) _tmp2_;
	}
	if (offset < ((glong) 0)) {
		offset = string_length + offset;
		g_return_val_if_fail (offset >= ((glong) 0), NULL);
	} else {
		g_return_val_if_fail (offset <= string_length, NULL);
	}
	if (len < ((glong) 0)) {
		len = string_length - offset;
	}
	g_return_val_if_fail ((offset + len) <= string_length, NULL);
	_tmp3_ = g_strndup (((gchar*) self) + offset, (gsize) len);
	result = _tmp3_;
	return result;
}

guint8*
xmpp_xep_jingle_rtp_crypto_get_key_and_salt (XmppXepJingleRtpCrypto* self,
                                             gint* result_length1)
{
	guint8* result;
	const gchar* _tmp0_;
	gint endIndex = 0;
	const gchar* _tmp2_;
	gchar* sub = NULL;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	const gchar* _tmp8_;
	gsize _tmp9_ = 0;
	guchar* _tmp10_;
	guint8* _tmp11_;
	gint _tmp11__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_key_params;
	if (!g_str_has_prefix (_tmp0_, "inline:")) {
		guint8* _tmp1_;
		gint _tmp1__length1;
		_tmp1_ = NULL;
		_tmp1__length1 = 0;
		if (result_length1) {
			*result_length1 = _tmp1__length1;
		}
		result = _tmp1_;
		return result;
	}
	_tmp2_ = self->priv->_key_params;
	endIndex = string_index_of (_tmp2_, "|", 0);
	if (endIndex < 0) {
		const gchar* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		_tmp3_ = self->priv->_key_params;
		_tmp4_ = strlen (_tmp3_);
		_tmp5_ = _tmp4_;
		endIndex = _tmp5_;
	}
	_tmp6_ = self->priv->_key_params;
	_tmp7_ = string_substring (_tmp6_, (glong) 7, (glong) (endIndex - 7));
	sub = _tmp7_;
	_tmp8_ = sub;
	_tmp10_ = g_base64_decode (_tmp8_, &_tmp9_);
	_tmp11_ = _tmp10_;
	_tmp11__length1 = _tmp9_;
	if (result_length1) {
		*result_length1 = _tmp11__length1;
	}
	result = _tmp11_;
	_g_free0 (sub);
	return result;
}

gchar*
xmpp_xep_jingle_rtp_crypto_get_lifetime (XmppXepJingleRtpCrypto* self)
{
	gchar* result;
	const gchar* _tmp0_;
	gint firstIndex = 0;
	const gchar* _tmp1_;
	gint endIndex = 0;
	const gchar* _tmp2_;
	const gchar* _tmp7_;
	gchar* _tmp8_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_key_params;
	if (!g_str_has_prefix (_tmp0_, "inline:")) {
		result = NULL;
		return result;
	}
	_tmp1_ = self->priv->_key_params;
	firstIndex = string_index_of (_tmp1_, "|", 0);
	if (firstIndex < 0) {
		result = NULL;
		return result;
	}
	_tmp2_ = self->priv->_key_params;
	endIndex = string_index_of (_tmp2_, "|", firstIndex + 1);
	if (endIndex < 0) {
		const gchar* _tmp3_;
		const gchar* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		_tmp3_ = self->priv->_key_params;
		if (string_index_of (_tmp3_, ":", firstIndex) > 0) {
			result = NULL;
			return result;
		}
		_tmp4_ = self->priv->_key_params;
		_tmp5_ = strlen (_tmp4_);
		_tmp6_ = _tmp5_;
		endIndex = _tmp6_;
	}
	_tmp7_ = self->priv->_key_params;
	_tmp8_ = string_substring (_tmp7_, (glong) (firstIndex + 1), (glong) endIndex);
	result = _tmp8_;
	return result;
}

gint
xmpp_xep_jingle_rtp_crypto_get_mki (XmppXepJingleRtpCrypto* self)
{
	gint result;
	const gchar* _tmp0_;
	gint firstIndex = 0;
	const gchar* _tmp1_;
	gint splitIndex = 0;
	const gchar* _tmp2_;
	gint secondIndex = 0;
	const gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_key_params;
	if (!g_str_has_prefix (_tmp0_, "inline:")) {
		result = -1;
		return result;
	}
	_tmp1_ = self->priv->_key_params;
	firstIndex = string_index_of (_tmp1_, "|", 0);
	if (firstIndex < 0) {
		result = -1;
		return result;
	}
	_tmp2_ = self->priv->_key_params;
	splitIndex = string_index_of (_tmp2_, ":", firstIndex);
	if (splitIndex < 0) {
		result = -1;
		return result;
	}
	_tmp3_ = self->priv->_key_params;
	secondIndex = string_index_of (_tmp3_, "|", firstIndex + 1);
	if (secondIndex < 0) {
		const gchar* _tmp4_;
		gchar* _tmp5_;
		gchar* _tmp6_;
		gint _tmp7_;
		_tmp4_ = self->priv->_key_params;
		_tmp5_ = string_substring (_tmp4_, (glong) (firstIndex + 1), (glong) splitIndex);
		_tmp6_ = _tmp5_;
		_tmp7_ = atoi (_tmp6_);
		_g_free0 (_tmp6_);
		result = _tmp7_;
		return result;
	} else {
		if (splitIndex > secondIndex) {
			const gchar* _tmp8_;
			gchar* _tmp9_;
			gchar* _tmp10_;
			gint _tmp11_;
			_tmp8_ = self->priv->_key_params;
			_tmp9_ = string_substring (_tmp8_, (glong) (secondIndex + 1), (glong) splitIndex);
			_tmp10_ = _tmp9_;
			_tmp11_ = atoi (_tmp10_);
			_g_free0 (_tmp10_);
			result = _tmp11_;
			return result;
		}
	}
	result = -1;
	return result;
}

gint
xmpp_xep_jingle_rtp_crypto_get_mki_length (XmppXepJingleRtpCrypto* self)
{
	gint result;
	const gchar* _tmp0_;
	gint firstIndex = 0;
	const gchar* _tmp1_;
	gint splitIndex = 0;
	const gchar* _tmp2_;
	gint secondIndex = 0;
	const gchar* _tmp3_;
	gboolean _tmp4_ = FALSE;
	g_return_val_if_fail (self != NULL, -1);
	_tmp0_ = self->priv->_key_params;
	if (!g_str_has_prefix (_tmp0_, "inline:")) {
		result = -1;
		return result;
	}
	_tmp1_ = self->priv->_key_params;
	firstIndex = string_index_of (_tmp1_, "|", 0);
	if (firstIndex < 0) {
		result = -1;
		return result;
	}
	_tmp2_ = self->priv->_key_params;
	splitIndex = string_index_of (_tmp2_, ":", firstIndex);
	if (splitIndex < 0) {
		result = -1;
		return result;
	}
	_tmp3_ = self->priv->_key_params;
	secondIndex = string_index_of (_tmp3_, "|", firstIndex + 1);
	if (secondIndex < 0) {
		_tmp4_ = TRUE;
	} else {
		_tmp4_ = splitIndex > secondIndex;
	}
	if (_tmp4_) {
		const gchar* _tmp5_;
		const gchar* _tmp6_;
		gint _tmp7_;
		gint _tmp8_;
		gchar* _tmp9_;
		gchar* _tmp10_;
		gint _tmp11_;
		_tmp5_ = self->priv->_key_params;
		_tmp6_ = self->priv->_key_params;
		_tmp7_ = strlen (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp9_ = string_substring (_tmp5_, (glong) (splitIndex + 1), (glong) _tmp8_);
		_tmp10_ = _tmp9_;
		_tmp11_ = atoi (_tmp10_);
		_g_free0 (_tmp10_);
		result = _tmp11_;
		return result;
	}
	result = -1;
	return result;
}

gboolean
xmpp_xep_jingle_rtp_crypto_get_is_valid (XmppXepJingleRtpCrypto* self)
{
	gboolean result;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	GQuark _tmp3_ = 0U;
	static GQuark _tmp2_label0 = 0;
	static GQuark _tmp2_label1 = 0;
	static GQuark _tmp2_label2 = 0;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_crypto_suite;
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	if (((_tmp3_ == ((0 != _tmp2_label0) ? _tmp2_label0 : (_tmp2_label0 = g_quark_from_static_string (XMPP_XEP_JINGLE_RTP_CRYPTO_AES_CM_128_HMAC_SHA1_80)))) || (_tmp3_ == ((0 != _tmp2_label1) ? _tmp2_label1 : (_tmp2_label1 = g_quark_from_static_string (XMPP_XEP_JINGLE_RTP_CRYPTO_AES_CM_128_HMAC_SHA1_32))))) || (_tmp3_ == ((0 != _tmp2_label2) ? _tmp2_label2 : (_tmp2_label2 = g_quark_from_static_string (XMPP_XEP_JINGLE_RTP_CRYPTO_F8_128_HMAC_SHA1_80))))) {
		switch (0) {
			default:
			{
				gboolean _tmp4_ = FALSE;
				guint8* _tmp5_;
				gint _tmp5__length1;
				gint _tmp6_ = 0;
				guint8* _tmp7_;
				gint _tmp7__length1;
				guint8* _tmp8_;
				gint _tmp8__length1;
				gboolean _tmp9_;
				_tmp5_ = xmpp_xep_jingle_rtp_crypto_get_key_and_salt (self, &_tmp6_);
				_tmp5__length1 = _tmp6_;
				_tmp7_ = _tmp5_;
				_tmp7__length1 = _tmp5__length1;
				_tmp8_ = _tmp7_;
				_tmp8__length1 = _tmp7__length1;
				_tmp9_ = _tmp8_ != NULL;
				_tmp8_ = (g_free (_tmp8_), NULL);
				if (_tmp9_) {
					guint8* _tmp10_;
					gint _tmp10__length1;
					gint _tmp11_ = 0;
					guint8* _tmp12_;
					gint _tmp12__length1;
					guint8* _tmp13_;
					gint _tmp13__length1;
					_tmp10_ = xmpp_xep_jingle_rtp_crypto_get_key_and_salt (self, &_tmp11_);
					_tmp10__length1 = _tmp11_;
					_tmp12_ = _tmp10_;
					_tmp12__length1 = _tmp10__length1;
					_tmp13_ = _tmp12_;
					_tmp13__length1 = _tmp12__length1;
					_tmp4_ = _tmp12__length1 == 30;
					_tmp13_ = (g_free (_tmp13_), NULL);
				} else {
					_tmp4_ = FALSE;
				}
				result = _tmp4_;
				return result;
			}
		}
	}
	result = FALSE;
	return result;
}

static guint8*
_vala_array_dup10 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

guint8*
xmpp_xep_jingle_rtp_crypto_get_key (XmppXepJingleRtpCrypto* self,
                                    gint* result_length1)
{
	guint8* result;
	guint8* key_and_salt = NULL;
	guint8* _tmp0_;
	gint _tmp0__length1;
	gint _tmp1_ = 0;
	guint8* _tmp2_;
	gint _tmp2__length1;
	gint key_and_salt_length1;
	gint _key_and_salt_size_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GQuark _tmp6_ = 0U;
	static GQuark _tmp5_label0 = 0;
	static GQuark _tmp5_label1 = 0;
	static GQuark _tmp5_label2 = 0;
	guint8* _tmp10_;
	gint _tmp10__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = xmpp_xep_jingle_rtp_crypto_get_key_and_salt (self, &_tmp1_);
	_tmp0__length1 = _tmp1_;
	_tmp2_ = _tmp0_;
	_tmp2__length1 = _tmp0__length1;
	key_and_salt = _tmp2_;
	key_and_salt_length1 = _tmp2__length1;
	_key_and_salt_size_ = key_and_salt_length1;
	_tmp3_ = self->priv->_crypto_suite;
	_tmp4_ = _tmp3_;
	_tmp6_ = (NULL == _tmp4_) ? 0 : g_quark_from_string (_tmp4_);
	if (((_tmp6_ == ((0 != _tmp5_label0) ? _tmp5_label0 : (_tmp5_label0 = g_quark_from_static_string (XMPP_XEP_JINGLE_RTP_CRYPTO_AES_CM_128_HMAC_SHA1_80)))) || (_tmp6_ == ((0 != _tmp5_label1) ? _tmp5_label1 : (_tmp5_label1 = g_quark_from_static_string (XMPP_XEP_JINGLE_RTP_CRYPTO_AES_CM_128_HMAC_SHA1_32))))) || (_tmp6_ == ((0 != _tmp5_label2) ? _tmp5_label2 : (_tmp5_label2 = g_quark_from_static_string (XMPP_XEP_JINGLE_RTP_CRYPTO_F8_128_HMAC_SHA1_80))))) {
		switch (0) {
			default:
			{
				gboolean _tmp7_ = FALSE;
				if (key_and_salt != NULL) {
					_tmp7_ = key_and_salt_length1 >= 16;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					guint8* _tmp8_;
					gint _tmp8__length1;
					guint8* _tmp9_;
					gint _tmp9__length1;
					_tmp8_ = (key_and_salt != NULL) ? _vala_array_dup10 (key_and_salt + 0, 16 - 0) : key_and_salt;
					_tmp8__length1 = 16 - 0;
					_tmp9_ = _tmp8_;
					_tmp9__length1 = _tmp8__length1;
					if (result_length1) {
						*result_length1 = _tmp9__length1;
					}
					result = _tmp9_;
					key_and_salt = (g_free (key_and_salt), NULL);
					return result;
				}
				break;
			}
		}
	}
	_tmp10_ = NULL;
	_tmp10__length1 = 0;
	if (result_length1) {
		*result_length1 = _tmp10__length1;
	}
	result = _tmp10_;
	key_and_salt = (g_free (key_and_salt), NULL);
	return result;
}

static guint8*
_vala_array_dup11 (guint8* self,
                   gssize length)
{
	if (length > 0) {
		return _vala_memdup2 (self, length * sizeof (guint8));
	}
	return NULL;
}

guint8*
xmpp_xep_jingle_rtp_crypto_get_salt (XmppXepJingleRtpCrypto* self,
                                     gint* result_length1)
{
	guint8* result;
	guint8* key_and_salt = NULL;
	guint8* _tmp0_;
	gint _tmp0__length1;
	gint _tmp1_ = 0;
	guint8* _tmp2_;
	gint _tmp2__length1;
	gint key_and_salt_length1;
	gint _key_and_salt_size_;
	const gchar* _tmp3_;
	const gchar* _tmp4_;
	GQuark _tmp6_ = 0U;
	static GQuark _tmp5_label0 = 0;
	static GQuark _tmp5_label1 = 0;
	static GQuark _tmp5_label2 = 0;
	guint8* _tmp10_;
	gint _tmp10__length1;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = xmpp_xep_jingle_rtp_crypto_get_key_and_salt (self, &_tmp1_);
	_tmp0__length1 = _tmp1_;
	_tmp2_ = _tmp0_;
	_tmp2__length1 = _tmp0__length1;
	key_and_salt = _tmp2_;
	key_and_salt_length1 = _tmp2__length1;
	_key_and_salt_size_ = key_and_salt_length1;
	_tmp3_ = self->priv->_crypto_suite;
	_tmp4_ = _tmp3_;
	_tmp6_ = (NULL == _tmp4_) ? 0 : g_quark_from_string (_tmp4_);
	if (((_tmp6_ == ((0 != _tmp5_label0) ? _tmp5_label0 : (_tmp5_label0 = g_quark_from_static_string (XMPP_XEP_JINGLE_RTP_CRYPTO_AES_CM_128_HMAC_SHA1_80)))) || (_tmp6_ == ((0 != _tmp5_label1) ? _tmp5_label1 : (_tmp5_label1 = g_quark_from_static_string (XMPP_XEP_JINGLE_RTP_CRYPTO_AES_CM_128_HMAC_SHA1_32))))) || (_tmp6_ == ((0 != _tmp5_label2) ? _tmp5_label2 : (_tmp5_label2 = g_quark_from_static_string (XMPP_XEP_JINGLE_RTP_CRYPTO_F8_128_HMAC_SHA1_80))))) {
		switch (0) {
			default:
			{
				gboolean _tmp7_ = FALSE;
				if (key_and_salt != NULL) {
					_tmp7_ = key_and_salt_length1 >= 30;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					guint8* _tmp8_;
					gint _tmp8__length1;
					guint8* _tmp9_;
					gint _tmp9__length1;
					_tmp8_ = (key_and_salt != NULL) ? _vala_array_dup11 (key_and_salt + 16, 30 - 16) : key_and_salt;
					_tmp8__length1 = 30 - 16;
					_tmp9_ = _tmp8_;
					_tmp9__length1 = _tmp8__length1;
					if (result_length1) {
						*result_length1 = _tmp9__length1;
					}
					result = _tmp9_;
					key_and_salt = (g_free (key_and_salt), NULL);
					return result;
				}
				break;
			}
		}
	}
	_tmp10_ = NULL;
	_tmp10__length1 = 0;
	if (result_length1) {
		*result_length1 = _tmp10__length1;
	}
	result = _tmp10_;
	key_and_salt = (g_free (key_and_salt), NULL);
	return result;
}

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

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

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

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

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

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

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

void
xmpp_xep_jingle_rtp_value_set_crypto (GValue* value,
                                      gpointer v_object)
{
	XmppXepJingleRtpCrypto * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, XMPP_XEP_JINGLE_RTP_TYPE_CRYPTO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, XMPP_XEP_JINGLE_RTP_TYPE_CRYPTO));
		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;
		xmpp_xep_jingle_rtp_crypto_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		xmpp_xep_jingle_rtp_crypto_unref (old);
	}
}

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

static void
xmpp_xep_jingle_rtp_crypto_class_init (XmppXepJingleRtpCryptoClass * klass,
                                       gpointer klass_data)
{
	xmpp_xep_jingle_rtp_crypto_parent_class = g_type_class_peek_parent (klass);
	((XmppXepJingleRtpCryptoClass *) klass)->finalize = xmpp_xep_jingle_rtp_crypto_finalize;
	g_type_class_adjust_private_offset (klass, &XmppXepJingleRtpCrypto_private_offset);
}

static void
xmpp_xep_jingle_rtp_crypto_instance_init (XmppXepJingleRtpCrypto * self,
                                          gpointer klass)
{
	self->priv = xmpp_xep_jingle_rtp_crypto_get_instance_private (self);
	self->ref_count = 1;
}

static void
xmpp_xep_jingle_rtp_crypto_finalize (XmppXepJingleRtpCrypto * obj)
{
	XmppXepJingleRtpCrypto * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, XMPP_XEP_JINGLE_RTP_TYPE_CRYPTO, XmppXepJingleRtpCrypto);
	g_signal_handlers_destroy (self);
	_g_free0 (self->priv->_crypto_suite);
	_g_free0 (self->priv->_key_params);
	_g_free0 (self->priv->_session_params);
	_g_free0 (self->priv->_tag);
}

static GType
xmpp_xep_jingle_rtp_crypto_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { xmpp_xep_jingle_rtp_value_crypto_init, xmpp_xep_jingle_rtp_value_crypto_free_value, xmpp_xep_jingle_rtp_value_crypto_copy_value, xmpp_xep_jingle_rtp_value_crypto_peek_pointer, "p", xmpp_xep_jingle_rtp_value_crypto_collect_value, "p", xmpp_xep_jingle_rtp_value_crypto_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (XmppXepJingleRtpCryptoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) xmpp_xep_jingle_rtp_crypto_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (XmppXepJingleRtpCrypto), 0, (GInstanceInitFunc) xmpp_xep_jingle_rtp_crypto_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 xmpp_xep_jingle_rtp_crypto_type_id;
	xmpp_xep_jingle_rtp_crypto_type_id = g_type_register_fundamental (g_type_fundamental_next (), "XmppXepJingleRtpCrypto", &g_define_type_info, &g_define_type_fundamental_info, 0);
	XmppXepJingleRtpCrypto_private_offset = g_type_add_instance_private (xmpp_xep_jingle_rtp_crypto_type_id, sizeof (XmppXepJingleRtpCryptoPrivate));
	return xmpp_xep_jingle_rtp_crypto_type_id;
}

GType
xmpp_xep_jingle_rtp_crypto_get_type (void)
{
	static volatile gsize xmpp_xep_jingle_rtp_crypto_type_id__once = 0;
	if (g_once_init_enter (&xmpp_xep_jingle_rtp_crypto_type_id__once)) {
		GType xmpp_xep_jingle_rtp_crypto_type_id;
		xmpp_xep_jingle_rtp_crypto_type_id = xmpp_xep_jingle_rtp_crypto_get_type_once ();
		g_once_init_leave (&xmpp_xep_jingle_rtp_crypto_type_id__once, xmpp_xep_jingle_rtp_crypto_type_id);
	}
	return xmpp_xep_jingle_rtp_crypto_type_id__once;
}

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

void
xmpp_xep_jingle_rtp_crypto_unref (gpointer instance)
{
	XmppXepJingleRtpCrypto * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		XMPP_XEP_JINGLE_RTP_CRYPTO_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

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;
}

