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

#include "libdino.h"
#include "xmpp-vala.h"
#include <glib.h>
#include <stdlib.h>
#include <string.h>
#include <glib-object.h>
#include <gee.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  {
	DINO_PEER_STATE_0_PROPERTY,
	DINO_PEER_STATE_GROUP_CALL_PROPERTY,
	DINO_PEER_STATE_WE_SHOULD_SEND_AUDIO_PROPERTY,
	DINO_PEER_STATE_WE_SHOULD_SEND_VIDEO_PROPERTY,
	DINO_PEER_STATE_NUM_PROPERTIES
};
static GParamSpec* dino_peer_state_properties[DINO_PEER_STATE_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_muji_group_call_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_xep_muji_group_call_unref (var), NULL)))
#define _xmpp_stanza_entry_unref0(var) ((var == NULL) ? NULL : (var = (xmpp_stanza_entry_unref (var), NULL)))
typedef struct _DinoPeerStateInitiateCallData DinoPeerStateInitiateCallData;
typedef struct _DinoPeerStateCallResourceData DinoPeerStateCallResourceData;
typedef struct _Block5Data Block5Data;
#define _dino_peer_content_info_unref0(var) ((var == NULL) ? NULL : (var = (dino_peer_content_info_unref (var), NULL)))
typedef struct _Block6Data Block6Data;
enum  {
	DINO_PEER_STATE_STREAM_CREATED_SIGNAL,
	DINO_PEER_STATE_COUNTERPART_SENDS_VIDEO_UPDATED_SIGNAL,
	DINO_PEER_STATE_INFO_RECEIVED_SIGNAL,
	DINO_PEER_STATE_CONNECTION_READY_SIGNAL,
	DINO_PEER_STATE_SESSION_TERMINATED_SIGNAL,
	DINO_PEER_STATE_ENCRYPTION_UPDATED_SIGNAL,
	DINO_PEER_STATE_NUM_SIGNALS
};
static guint dino_peer_state_signals[DINO_PEER_STATE_NUM_SIGNALS] = {0};
typedef struct _DinoParamSpecPeerContentInfo DinoParamSpecPeerContentInfo;
typedef struct _DinoParamSpecPeerInfo DinoParamSpecPeerInfo;

struct _DinoPeerStatePrivate {
	XmppXepMujiGroupCall* _group_call;
	gboolean _we_should_send_audio;
	gboolean _we_should_send_video;
};

struct _DinoPeerStateInitiateCallData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoPeerState* self;
	XmppJid* counterpart;
	GeeList* call_resources;
	DinoCalls* _tmp0_;
	DinoEntitiesCall* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	DinoEntitiesAccount* _tmp3_;
	GeeList* _tmp4_;
	gboolean do_jmi;
	XmppJid* jid_for_direct;
	DinoCalls* _tmp5_;
	DinoEntitiesCall* _tmp6_;
	DinoEntitiesAccount* _tmp7_;
	DinoEntitiesAccount* _tmp8_;
	GeeList* _tmp9_;
	GeeList* _tmp10_;
	gboolean _tmp11_;
	gboolean _tmp12_;
	GeeList* _tmp13_;
	gpointer _tmp14_;
	DinoCalls* _tmp15_;
	XmppJid* _tmp16_;
	gchar* _tmp17_;
	XmppXmppStream* stream;
	DinoStreamInteractor* _tmp18_;
	DinoEntitiesCall* _tmp19_;
	DinoEntitiesAccount* _tmp20_;
	DinoEntitiesAccount* _tmp21_;
	XmppXmppStream* _tmp22_;
	GeeArrayList* descriptions;
	GeeArrayList* _tmp23_;
	GeeArrayList* _tmp24_;
	XmppStanzaNode* _tmp25_;
	XmppStanzaNode* _tmp26_;
	XmppStanzaNode* _tmp27_;
	XmppStanzaNode* _tmp28_;
	XmppStanzaNode* _tmp29_;
	XmppStanzaNode* _tmp30_;
	gboolean _tmp31_;
	GeeArrayList* _tmp32_;
	XmppStanzaNode* _tmp33_;
	XmppStanzaNode* _tmp34_;
	XmppStanzaNode* _tmp35_;
	XmppStanzaNode* _tmp36_;
	XmppStanzaNode* _tmp37_;
	XmppStanzaNode* _tmp38_;
	XmppXmppStream* _tmp39_;
	XmppModuleIdentity* _tmp40_;
	gpointer _tmp41_;
	XmppXepJingleMessageInitiationModule* _tmp42_;
	XmppXmppStream* _tmp43_;
	XmppJid* _tmp44_;
	const gchar* _tmp45_;
	GeeArrayList* _tmp46_;
	XmppJid* _tmp47_;
	XmppJid* _tmp48_;
};

struct _DinoPeerStateCallResourceData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	DinoPeerState* self;
	XmppJid* full_jid;
	DinoCallState* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	XmppXmppStream* stream;
	DinoStreamInteractor* _tmp3_;
	DinoEntitiesCall* _tmp4_;
	DinoEntitiesAccount* _tmp5_;
	DinoEntitiesAccount* _tmp6_;
	XmppXmppStream* _tmp7_;
	XmppXmppStream* _tmp8_;
	const gchar* _tmp9_;
	gchar* _tmp10_;
	XmppJid* _tmp11_;
	XmppXepMujiGroupCall* _tmp12_;
	XmppXepMujiGroupCall* _tmp13_;
	XmppJid* _tmp14_;
	XmppXepJingleSession* session;
	XmppXmppStream* _tmp15_;
	XmppModuleIdentity* _tmp16_;
	gpointer _tmp17_;
	XmppXepJingleRtpModule* _tmp18_;
	XmppXmppStream* _tmp19_;
	gboolean _tmp20_;
	const gchar* _tmp21_;
	XmppXepJingleSession* _tmp22_;
	XmppXepJingleSession* _tmp23_;
	XmppXepJingleSession* _tmp24_;
	GError* _inner_error0_;
};

struct _Block5Data {
	int _ref_count_;
	DinoPeerState* self;
	XmppXepJingleRtpModule* rtp_module;
};

struct _Block6Data {
	int _ref_count_;
	DinoPeerState* self;
	XmppXepJingleContent* content;
	XmppXepJingleRtpParameters* rtp_content_parameter;
};

struct _DinoPeerContentInfoPrivate {
	gboolean _rtp_ready;
	gboolean _rtcp_ready;
	gulong* _bytes_sent;
	gulong* _bytes_received;
	gchar* _codec;
	guint32 _clockrate;
	guint _target_receive_bytes;
	guint _target_send_bytes;
};

struct _DinoParamSpecPeerContentInfo {
	GParamSpec parent_instance;
};

struct _DinoParamSpecPeerInfo {
	GParamSpec parent_instance;
};

static gint DinoPeerState_private_offset;
static gpointer dino_peer_state_parent_class = NULL;
static gint DinoPeerContentInfo_private_offset;
static gpointer dino_peer_content_info_parent_class = NULL;
static gpointer dino_peer_info_parent_class = NULL;

static void __lambda69_ (DinoPeerState* self,
                  XmppXepJingleSession* session,
                  gboolean mute,
                  const gchar* name);
static void dino_peer_state_on_counterpart_mute_update (DinoPeerState* self,
                                                 gboolean mute,
                                                 const gchar* media);
static void ___lambda69__xmpp_xep_jingle_rtp_session_info_type_mute_update_received (XmppXepJingleRtpSessionInfoType* _sender,
                                                                              XmppXepJingleSession* session,
                                                                              gboolean mute,
                                                                              const gchar* name,
                                                                              gpointer self);
static void __lambda70_ (DinoPeerState* self,
                  XmppXepJingleSession* session,
                  XmppXepJingleRtpCallSessionInfo session_info);
static void ___lambda70__xmpp_xep_jingle_rtp_session_info_type_info_received (XmppXepJingleRtpSessionInfoType* _sender,
                                                                       XmppXepJingleSession* session,
                                                                       XmppXepJingleRtpCallSessionInfo info,
                                                                       gpointer self);
static void dino_peer_state_initiate_call_data_free (gpointer _data);
static gboolean dino_peer_state_initiate_call_co (DinoPeerStateInitiateCallData* _data_);
static void dino_peer_state_initiate_call_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
static void dino_peer_state_call_resource_data_free (gpointer _data);
static gboolean dino_peer_state_call_resource_co (DinoPeerStateCallResourceData* _data_);
static void dino_peer_state_call_resource_ready (GObject* source_object,
                                          GAsyncResult* _res_,
                                          gpointer _user_data_);
VALA_EXTERN void dino_peer_state_set_session (DinoPeerState* self,
                                  XmppXepJingleSession* session);
VALA_EXTERN void dino_peer_state_mute_own_audio (DinoPeerState* self,
                                     gboolean mute);
VALA_EXTERN void dino_peer_state_mute_own_video (DinoPeerState* self,
                                     gboolean mute);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static void ____lambda60_ (Block5Data* _data5_,
                    GObject* _,
                    GAsyncResult* res);
static void dino_peer_state_connect_content_signals (DinoPeerState* self,
                                              XmppXepJingleContent* content,
                                              XmppXepJingleRtpParameters* rtp_content_parameter);
static void _____lambda60__gasync_ready_callback (GObject* source_object,
                                           GAsyncResult* res,
                                           gpointer self);
static void __lambda55_ (DinoPeerState* self,
                  XmppXmppStream* stream,
                  gboolean we_terminated,
                  const gchar* reason_name,
                  const gchar* reason_text);
static void ___lambda55__xmpp_xep_jingle_session_terminated (XmppXepJingleSession* _sender,
                                                      XmppXmppStream* stream,
                                                      gboolean we_terminated,
                                                      const gchar* reason_name,
                                                      const gchar* reason_text,
                                                      gpointer self);
static void __lambda56_ (DinoPeerState* self,
                  XmppXmppStream* stream,
                  XmppXepJingleContent* content);
static void dino_peer_state_on_incoming_content_add (DinoPeerState* self,
                                              XmppXmppStream* stream,
                                              XmppXepJingleSession* session,
                                              XmppXepJingleContent* content);
static void ___lambda56__xmpp_xep_jingle_session_additional_content_add_incoming (XmppXepJingleSession* _sender,
                                                                           XmppXmppStream* stream,
                                                                           XmppXepJingleContent* content,
                                                                           gpointer self);
static DinoPeerContentInfo* dino_peer_state_get_content_info (DinoPeerState* self,
                                                       XmppXepJingleContent* content,
                                                       XmppXepJingleRtpParameters* parameter);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static void __lambda57_ (Block6Data* _data6_,
                  XmppXepJingleRtpStream* stream);
static void dino_peer_state_on_stream_created (DinoPeerState* self,
                                        const gchar* media,
                                        XmppXepJingleRtpStream* stream);
static void ___lambda57__xmpp_xep_jingle_rtp_parameters_stream_created (XmppXepJingleRtpParameters* _sender,
                                                                 XmppXepJingleRtpStream* stream,
                                                                 gpointer self);
static void __lambda61_ (Block6Data* _data6_,
                  XmppXepJingleRtpParameters* status);
static gboolean __lambda62_ (Block6Data* _data6_);
static void dino_peer_state_on_connection_ready (DinoPeerState* self,
                                          XmppXepJingleContent* content,
                                          const gchar* media);
static gboolean ___lambda62__gsource_func (gpointer self);
static void ___lambda61__xmpp_xep_jingle_rtp_parameters_connection_ready (XmppXepJingleRtpParameters* _sender,
                                                                   gpointer self);
static void __lambda63_ (DinoPeerState* self,
                  XmppXepJingleContent* content,
                  XmppXepJingleSenders proposed_senders);
static void ___lambda63__xmpp_xep_jingle_content_senders_modify_incoming (XmppXepJingleContent* _sender,
                                                                   XmppXepJingleSenders proposed_senders,
                                                                   gpointer self);
static void ___lambda58_ (DinoPeerState* self,
                   XmppXepJingleRtpParameters* status);
static gboolean __lambda59_ (DinoPeerState* self);
static gboolean ___lambda59__gsource_func (gpointer self);
static void ____lambda58__xmpp_xep_jingle_rtp_parameters_connection_ready (XmppXepJingleRtpParameters* _sender,
                                                                    gpointer self);
static guint8* _vala_array_dup1 (guint8* self,
                          gssize length);
static guint8* _vala_array_dup2 (guint8* self,
                          gssize length);
static void g_cclosure_user_marshal_VOID__BOOLEAN_STRING_STRING (GClosure * closure,
                                                          GValue * return_value,
                                                          guint n_param_values,
                                                          const GValue * param_values,
                                                          gpointer invocation_hint,
                                                          gpointer marshal_data);
static void g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                                  GValue * return_value,
                                                  guint n_param_values,
                                                  const GValue * param_values,
                                                  gpointer invocation_hint,
                                                  gpointer marshal_data);
static void dino_peer_state_finalize (GObject * obj);
static GType dino_peer_state_get_type_once (void);
static void _vala_dino_peer_state_get_property (GObject * object,
                                         guint property_id,
                                         GValue * value,
                                         GParamSpec * pspec);
static void _vala_dino_peer_state_set_property (GObject * object,
                                         guint property_id,
                                         const GValue * value,
                                         GParamSpec * pspec);
static gulong* _ulong_dup (gulong* self);
static void dino_peer_content_info_finalize (DinoPeerContentInfo * obj);
static GType dino_peer_content_info_get_type_once (void);
static void dino_peer_info_finalize (DinoPeerInfo * obj);
static GType dino_peer_info_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
dino_peer_state_get_instance_private (DinoPeerState* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPeerState_private_offset);
}

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

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

static void
__lambda69_ (DinoPeerState* self,
             XmppXepJingleSession* session,
             gboolean mute,
             const gchar* name)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (session != NULL);
	g_return_if_fail (name != NULL);
	_tmp0_ = self->sid;
	_tmp1_ = xmpp_xep_jingle_session_get_sid (session);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp0_, _tmp2_) != 0) {
		return;
	}
	{
		GeeList* _content_list = NULL;
		GeeList* _tmp3_;
		gint _content_size = 0;
		GeeList* _tmp4_;
		gint _tmp5_;
		gint _tmp6_;
		gint _content_index = 0;
		_tmp3_ = session->contents;
		_content_list = _tmp3_;
		_tmp4_ = _content_list;
		_tmp5_ = gee_collection_get_size ((GeeCollection*) _tmp4_);
		_tmp6_ = _tmp5_;
		_content_size = _tmp6_;
		_content_index = -1;
		while (TRUE) {
			gint _tmp7_;
			gint _tmp8_;
			XmppXepJingleContent* content = NULL;
			GeeList* _tmp9_;
			gpointer _tmp10_;
			gboolean _tmp11_ = FALSE;
			_content_index = _content_index + 1;
			_tmp7_ = _content_index;
			_tmp8_ = _content_size;
			if (!(_tmp7_ < _tmp8_)) {
				break;
			}
			_tmp9_ = _content_list;
			_tmp10_ = gee_list_get (_tmp9_, _content_index);
			content = (XmppXepJingleContent*) _tmp10_;
			if (name == NULL) {
				_tmp11_ = TRUE;
			} else {
				XmppXepJingleContent* _tmp12_;
				const gchar* _tmp13_;
				const gchar* _tmp14_;
				_tmp12_ = content;
				_tmp13_ = xmpp_xep_jingle_content_get_content_name (_tmp12_);
				_tmp14_ = _tmp13_;
				_tmp11_ = g_strcmp0 (_tmp14_, name) == 0;
			}
			if (_tmp11_) {
				XmppXepJingleRtpParameters* rtp_content_parameter = NULL;
				XmppXepJingleContent* _tmp15_;
				XmppXepJingleContentParameters* _tmp16_;
				XmppXepJingleRtpParameters* _tmp17_;
				XmppXepJingleRtpParameters* _tmp18_;
				_tmp15_ = content;
				_tmp16_ = _tmp15_->content_params;
				_tmp17_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp16_, XMPP_XEP_JINGLE_RTP_TYPE_PARAMETERS) ? ((XmppXepJingleRtpParameters*) _tmp16_) : NULL);
				rtp_content_parameter = _tmp17_;
				_tmp18_ = rtp_content_parameter;
				if (_tmp18_ != NULL) {
					XmppXepJingleRtpParameters* _tmp19_;
					const gchar* _tmp20_;
					const gchar* _tmp21_;
					_tmp19_ = rtp_content_parameter;
					_tmp20_ = xmpp_xep_jingle_rtp_parameters_get_media (_tmp19_);
					_tmp21_ = _tmp20_;
					dino_peer_state_on_counterpart_mute_update (self, mute, _tmp21_);
				}
				_g_object_unref0 (rtp_content_parameter);
			}
			_g_object_unref0 (content);
		}
	}
}

static void
___lambda69__xmpp_xep_jingle_rtp_session_info_type_mute_update_received (XmppXepJingleRtpSessionInfoType* _sender,
                                                                         XmppXepJingleSession* session,
                                                                         gboolean mute,
                                                                         const gchar* name,
                                                                         gpointer self)
{
	__lambda69_ ((DinoPeerState*) self, session, mute, name);
}

static void
__lambda70_ (DinoPeerState* self,
             XmppXepJingleSession* session,
             XmppXepJingleRtpCallSessionInfo session_info)
{
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_if_fail (session != NULL);
	_tmp0_ = self->sid;
	_tmp1_ = xmpp_xep_jingle_session_get_sid (session);
	_tmp2_ = _tmp1_;
	if (g_strcmp0 (_tmp0_, _tmp2_) != 0) {
		return;
	}
	g_signal_emit (self, dino_peer_state_signals[DINO_PEER_STATE_INFO_RECEIVED_SIGNAL], 0, session_info);
}

static void
___lambda70__xmpp_xep_jingle_rtp_session_info_type_info_received (XmppXepJingleRtpSessionInfoType* _sender,
                                                                  XmppXepJingleSession* session,
                                                                  XmppXepJingleRtpCallSessionInfo info,
                                                                  gpointer self)
{
	__lambda70_ ((DinoPeerState*) self, session, info);
}

DinoPeerState*
dino_peer_state_construct (GType object_type,
                           XmppJid* jid,
                           DinoEntitiesCall* call,
                           DinoCallState* call_state,
                           DinoStreamInteractor* stream_interactor)
{
	DinoPeerState * self = NULL;
	XmppJid* _tmp0_;
	DinoEntitiesCall* _tmp1_;
	DinoCallState* _tmp2_;
	DinoStreamInteractor* _tmp3_;
	DinoModuleIdentity* _tmp4_;
	gpointer _tmp5_;
	XmppXepJingleRtpModule* jinglertp_module = NULL;
	DinoModuleManager* _tmp6_;
	DinoEntitiesAccount* _tmp7_;
	DinoEntitiesAccount* _tmp8_;
	XmppModuleIdentity* _tmp9_;
	gpointer _tmp10_;
	XmppXepJingleRtpModule* _tmp11_;
	XmppXepJingleRtpSessionInfoType* session_info_type = NULL;
	XmppXepJingleRtpModule* _tmp12_;
	XmppXepJingleRtpSessionInfoType* _tmp13_;
	XmppXepJingleRtpSessionInfoType* _tmp14_;
	XmppXepJingleRtpSessionInfoType* _tmp15_;
	XmppXepJingleRtpSessionInfoType* _tmp16_;
	g_return_val_if_fail (jid != NULL, NULL);
	g_return_val_if_fail (call != NULL, NULL);
	g_return_val_if_fail (call_state != NULL, NULL);
	g_return_val_if_fail (stream_interactor != NULL, NULL);
	self = (DinoPeerState*) g_object_new (object_type, NULL);
	_tmp0_ = _xmpp_jid_ref0 (jid);
	_xmpp_jid_unref0 (self->jid);
	self->jid = _tmp0_;
	_tmp1_ = _g_object_ref0 (call);
	_g_object_unref0 (self->call);
	self->call = _tmp1_;
	_tmp2_ = _g_object_ref0 (call_state);
	_g_object_unref0 (self->call_state);
	self->call_state = _tmp2_;
	_tmp3_ = _g_object_ref0 (stream_interactor);
	_g_object_unref0 (self->stream_interactor);
	self->stream_interactor = _tmp3_;
	_tmp4_ = dino_calls_IDENTITY;
	_tmp5_ = dino_stream_interactor_get_module (stream_interactor, DINO_TYPE_CALLS, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp4_);
	_g_object_unref0 (self->calls);
	self->calls = (DinoCalls*) _tmp5_;
	_tmp6_ = stream_interactor->module_manager;
	_tmp7_ = dino_entities_call_get_account (call);
	_tmp8_ = _tmp7_;
	_tmp9_ = xmpp_xep_jingle_rtp_module_IDENTITY;
	_tmp10_ = dino_module_manager_get_module (_tmp6_, XMPP_XEP_JINGLE_RTP_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp8_, _tmp9_);
	jinglertp_module = (XmppXepJingleRtpModule*) _tmp10_;
	_tmp11_ = jinglertp_module;
	if (_tmp11_ == NULL) {
		_g_object_unref0 (jinglertp_module);
		return self;
	}
	_tmp12_ = jinglertp_module;
	_tmp13_ = _tmp12_->session_info_type;
	_tmp14_ = _g_object_ref0 (_tmp13_);
	session_info_type = _tmp14_;
	_tmp15_ = session_info_type;
	g_signal_connect_object (_tmp15_, "mute-update-received", (GCallback) ___lambda69__xmpp_xep_jingle_rtp_session_info_type_mute_update_received, self, 0);
	_tmp16_ = session_info_type;
	g_signal_connect_object (_tmp16_, "info-received", (GCallback) ___lambda70__xmpp_xep_jingle_rtp_session_info_type_info_received, self, 0);
	_g_object_unref0 (session_info_type);
	_g_object_unref0 (jinglertp_module);
	return self;
}

DinoPeerState*
dino_peer_state_new (XmppJid* jid,
                     DinoEntitiesCall* call,
                     DinoCallState* call_state,
                     DinoStreamInteractor* stream_interactor)
{
	return dino_peer_state_construct (DINO_TYPE_PEER_STATE, jid, call, call_state, stream_interactor);
}

static void
dino_peer_state_initiate_call_data_free (gpointer _data)
{
	DinoPeerStateInitiateCallData* _data_;
	_data_ = _data;
	_xmpp_jid_unref0 (_data_->counterpart);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoPeerStateInitiateCallData, _data_);
}

void
dino_peer_state_initiate_call (DinoPeerState* self,
                               XmppJid* counterpart,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DinoPeerStateInitiateCallData* _data_;
	DinoPeerState* _tmp0_;
	XmppJid* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (counterpart != NULL);
	_data_ = g_slice_new0 (DinoPeerStateInitiateCallData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_peer_state_initiate_call_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _xmpp_jid_ref0 (counterpart);
	_xmpp_jid_unref0 (_data_->counterpart);
	_data_->counterpart = _tmp1_;
	dino_peer_state_initiate_call_co (_data_);
}

void
dino_peer_state_initiate_call_finish (DinoPeerState* self,
                                      GAsyncResult* _res_)
{
	DinoPeerStateInitiateCallData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dino_peer_state_initiate_call_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DinoPeerStateInitiateCallData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_peer_state_initiate_call_co (_data_);
}

static gboolean
dino_peer_state_initiate_call_co (DinoPeerStateInitiateCallData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->calls;
	_data_->_tmp1_ = _data_->self->call;
	_data_->_tmp2_ = dino_entities_call_get_account (_data_->_tmp1_);
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_state_ = 1;
	dino_calls_get_call_resources (_data_->_tmp0_, _data_->_tmp3_, _data_->counterpart, dino_peer_state_initiate_call_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp4_ = dino_calls_get_call_resources_finish (_data_->_tmp0_, _data_->_res_);
	_data_->call_resources = _data_->_tmp4_;
	_data_->do_jmi = FALSE;
	_data_->jid_for_direct = NULL;
	_data_->_tmp5_ = _data_->self->calls;
	_data_->_tmp6_ = _data_->self->call;
	_data_->_tmp7_ = dino_entities_call_get_account (_data_->_tmp6_);
	_data_->_tmp8_ = _data_->_tmp7_;
	_data_->_tmp9_ = _data_->call_resources;
	_data_->_state_ = 2;
	dino_calls_contains_jmi_resources (_data_->_tmp5_, _data_->_tmp8_, _data_->_tmp9_, dino_peer_state_initiate_call_ready, _data_);
	return FALSE;
	_state_2:
	if (dino_calls_contains_jmi_resources_finish (_data_->_tmp5_, _data_->_res_)) {
		_data_->do_jmi = TRUE;
	} else {
		_data_->_tmp10_ = _data_->call_resources;
		_data_->_tmp11_ = gee_collection_get_is_empty ((GeeCollection*) _data_->_tmp10_);
		_data_->_tmp12_ = _data_->_tmp11_;
		if (!_data_->_tmp12_) {
			_data_->_tmp13_ = _data_->call_resources;
			_data_->_tmp14_ = gee_list_get (_data_->_tmp13_, 0);
			_xmpp_jid_unref0 (_data_->jid_for_direct);
			_data_->jid_for_direct = (XmppJid*) _data_->_tmp14_;
		} else {
			_data_->_tmp15_ = _data_->self->calls;
			_data_->_tmp16_ = _data_->self->jid;
			if (dino_calls_has_jmi_resources (_data_->_tmp15_, _data_->_tmp16_)) {
				_data_->do_jmi = TRUE;
			}
		}
	}
	_data_->_tmp17_ = xmpp_random_uuid ();
	_g_free0 (_data_->self->sid);
	_data_->self->sid = _data_->_tmp17_;
	if (_data_->do_jmi) {
		_data_->_tmp18_ = _data_->self->stream_interactor;
		_data_->_tmp19_ = _data_->self->call;
		_data_->_tmp20_ = dino_entities_call_get_account (_data_->_tmp19_);
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = dino_stream_interactor_get_stream (_data_->_tmp18_, _data_->_tmp21_);
		_data_->stream = _data_->_tmp22_;
		_data_->_tmp23_ = gee_array_list_new (XMPP_TYPE_STANZA_NODE, (GBoxedCopyFunc) xmpp_stanza_entry_ref, (GDestroyNotify) xmpp_stanza_entry_unref, NULL, NULL, NULL);
		_data_->descriptions = _data_->_tmp23_;
		_data_->_tmp24_ = _data_->descriptions;
		_data_->_tmp25_ = xmpp_stanza_node_new_build ("description", XMPP_XEP_JINGLE_RTP_NS_URI, NULL, NULL);
		_data_->_tmp26_ = _data_->_tmp25_;
		_data_->_tmp27_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp26_);
		_data_->_tmp28_ = _data_->_tmp27_;
		_data_->_tmp29_ = xmpp_stanza_node_put_attribute (_data_->_tmp28_, "media", "audio", NULL);
		_data_->_tmp30_ = _data_->_tmp29_;
		gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp24_, _data_->_tmp30_);
		_xmpp_stanza_entry_unref0 (_data_->_tmp30_);
		_xmpp_stanza_entry_unref0 (_data_->_tmp28_);
		_xmpp_stanza_entry_unref0 (_data_->_tmp26_);
		_data_->_tmp31_ = _data_->self->priv->_we_should_send_video;
		if (_data_->_tmp31_) {
			_data_->_tmp32_ = _data_->descriptions;
			_data_->_tmp33_ = xmpp_stanza_node_new_build ("description", XMPP_XEP_JINGLE_RTP_NS_URI, NULL, NULL);
			_data_->_tmp34_ = _data_->_tmp33_;
			_data_->_tmp35_ = xmpp_stanza_node_add_self_xmlns (_data_->_tmp34_);
			_data_->_tmp36_ = _data_->_tmp35_;
			_data_->_tmp37_ = xmpp_stanza_node_put_attribute (_data_->_tmp36_, "media", "video", NULL);
			_data_->_tmp38_ = _data_->_tmp37_;
			gee_abstract_collection_add ((GeeAbstractCollection*) _data_->_tmp32_, _data_->_tmp38_);
			_xmpp_stanza_entry_unref0 (_data_->_tmp38_);
			_xmpp_stanza_entry_unref0 (_data_->_tmp36_);
			_xmpp_stanza_entry_unref0 (_data_->_tmp34_);
		}
		_data_->_tmp39_ = _data_->stream;
		_data_->_tmp40_ = xmpp_xep_jingle_message_initiation_module_IDENTITY;
		_data_->_tmp41_ = xmpp_xmpp_stream_get_module (_data_->_tmp39_, XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp40_);
		_data_->_tmp42_ = (XmppXepJingleMessageInitiationModule*) _data_->_tmp41_;
		_data_->_tmp43_ = _data_->stream;
		_data_->_tmp44_ = _data_->self->jid;
		_data_->_tmp45_ = _data_->self->sid;
		_data_->_tmp46_ = _data_->descriptions;
		xmpp_xep_jingle_message_initiation_module_send_session_propose_to_peer (_data_->_tmp42_, _data_->_tmp43_, _data_->_tmp44_, _data_->_tmp45_, (GeeList*) _data_->_tmp46_);
		_g_object_unref0 (_data_->_tmp42_);
		_g_object_unref0 (_data_->descriptions);
		_g_object_unref0 (_data_->stream);
	} else {
		_data_->_tmp47_ = _data_->jid_for_direct;
		if (_data_->_tmp47_ != NULL) {
			_data_->_tmp48_ = _data_->jid_for_direct;
			_data_->_state_ = 3;
			dino_peer_state_call_resource (_data_->self, _data_->_tmp48_, dino_peer_state_initiate_call_ready, _data_);
			return FALSE;
			_state_3:
			dino_peer_state_call_resource_finish (_data_->self, _data_->_res_);
		}
	}
	_xmpp_jid_unref0 (_data_->jid_for_direct);
	_g_object_unref0 (_data_->call_resources);
	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
dino_peer_state_call_resource_data_free (gpointer _data)
{
	DinoPeerStateCallResourceData* _data_;
	_data_ = _data;
	_xmpp_jid_unref0 (_data_->full_jid);
	_g_object_unref0 (_data_->self);
	g_slice_free (DinoPeerStateCallResourceData, _data_);
}

void
dino_peer_state_call_resource (DinoPeerState* self,
                               XmppJid* full_jid,
                               GAsyncReadyCallback _callback_,
                               gpointer _user_data_)
{
	DinoPeerStateCallResourceData* _data_;
	DinoPeerState* _tmp0_;
	XmppJid* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (full_jid != NULL);
	_data_ = g_slice_new0 (DinoPeerStateCallResourceData);
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, dino_peer_state_call_resource_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _xmpp_jid_ref0 (full_jid);
	_xmpp_jid_unref0 (_data_->full_jid);
	_data_->full_jid = _tmp1_;
	dino_peer_state_call_resource_co (_data_);
}

void
dino_peer_state_call_resource_finish (DinoPeerState* self,
                                      GAsyncResult* _res_)
{
	DinoPeerStateCallResourceData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), NULL);
}

static void
dino_peer_state_call_resource_ready (GObject* source_object,
                                     GAsyncResult* _res_,
                                     gpointer _user_data_)
{
	DinoPeerStateCallResourceData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	dino_peer_state_call_resource_co (_data_);
}

static gboolean
dino_peer_state_call_resource_co (DinoPeerStateCallResourceData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = _data_->self->call_state;
	_data_->_tmp1_ = dino_call_state_get_accepted (_data_->_tmp0_);
	_data_->_tmp2_ = _data_->_tmp1_;
	if (!_data_->_tmp2_) {
		g_warning ("call_peer_state.vala:107: Tried to call resource in an unaccepted call" \
"?!");
		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_->_tmp3_ = _data_->self->stream_interactor;
	_data_->_tmp4_ = _data_->self->call;
	_data_->_tmp5_ = dino_entities_call_get_account (_data_->_tmp4_);
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = dino_stream_interactor_get_stream (_data_->_tmp3_, _data_->_tmp6_);
	_data_->stream = _data_->_tmp7_;
	_data_->_tmp8_ = _data_->stream;
	if (_data_->_tmp8_ == NULL) {
		_g_object_unref0 (_data_->stream);
		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_ = _data_->self->sid;
	if (_data_->_tmp9_ == NULL) {
		_data_->_tmp10_ = xmpp_random_uuid ();
		_g_free0 (_data_->self->sid);
		_data_->self->sid = _data_->_tmp10_;
	}
	_data_->_tmp12_ = _data_->self->priv->_group_call;
	if (_data_->_tmp12_ != NULL) {
		_data_->_tmp13_ = _data_->self->priv->_group_call;
		_data_->_tmp14_ = _data_->_tmp13_->muc_jid;
		_data_->_tmp11_ = _data_->_tmp14_;
	} else {
		_data_->_tmp11_ = NULL;
	}
	_data_->_tmp15_ = _data_->stream;
	_data_->_tmp16_ = xmpp_xep_jingle_rtp_module_IDENTITY;
	_data_->_tmp17_ = xmpp_xmpp_stream_get_module (_data_->_tmp15_, XMPP_XEP_JINGLE_RTP_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _data_->_tmp16_);
	_data_->_tmp18_ = (XmppXepJingleRtpModule*) _data_->_tmp17_;
	_data_->_tmp19_ = _data_->stream;
	_data_->_tmp20_ = _data_->self->priv->_we_should_send_video;
	_data_->_tmp21_ = _data_->self->sid;
	_data_->_state_ = 1;
	xmpp_xep_jingle_rtp_module_start_call (_data_->_tmp18_, _data_->_tmp19_, _data_->full_jid, _data_->_tmp20_, _data_->_tmp21_, _data_->_tmp11_, dino_peer_state_call_resource_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp22_ = xmpp_xep_jingle_rtp_module_start_call_finish (_data_->_tmp18_, _data_->_res_, &_data_->_inner_error0_);
	_data_->_tmp23_ = _data_->_tmp22_;
	_g_object_unref0 (_data_->_tmp18_);
	_data_->session = _data_->_tmp23_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		_g_object_unref0 (_data_->stream);
		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_->_tmp24_ = _data_->session;
	dino_peer_state_set_session (_data_->self, _data_->_tmp24_);
	_g_object_unref0 (_data_->session);
	_g_object_unref0 (_data_->stream);
	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;
}

void
dino_peer_state_accept (DinoPeerState* self)
{
	DinoCallState* _tmp0_;
	gboolean _tmp1_;
	gboolean _tmp2_;
	XmppXepJingleSession* _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->call_state;
	_tmp1_ = dino_call_state_get_accepted (_tmp0_);
	_tmp2_ = _tmp1_;
	if (!_tmp2_) {
		g_critical ("call_peer_state.vala:121: Tried to accept peer in unaccepted call?! So" \
"mething's fishy. Abort.");
		return;
	}
	_tmp3_ = self->session;
	if (_tmp3_ != NULL) {
		{
			GeeList* _content_list = NULL;
			XmppXepJingleSession* _tmp4_;
			GeeList* _tmp5_;
			gint _content_size = 0;
			GeeList* _tmp6_;
			gint _tmp7_;
			gint _tmp8_;
			gint _content_index = 0;
			_tmp4_ = self->session;
			_tmp5_ = _tmp4_->contents;
			_content_list = _tmp5_;
			_tmp6_ = _content_list;
			_tmp7_ = gee_collection_get_size ((GeeCollection*) _tmp6_);
			_tmp8_ = _tmp7_;
			_content_size = _tmp8_;
			_content_index = -1;
			while (TRUE) {
				gint _tmp9_;
				gint _tmp10_;
				XmppXepJingleContent* content = NULL;
				GeeList* _tmp11_;
				gpointer _tmp12_;
				XmppXepJingleRtpParameters* rtp_content_parameter = NULL;
				XmppXepJingleContent* _tmp13_;
				XmppXepJingleContentParameters* _tmp14_;
				XmppXepJingleRtpParameters* _tmp15_;
				gboolean _tmp16_ = FALSE;
				XmppXepJingleRtpParameters* _tmp17_;
				XmppXepJingleContent* _tmp37_;
				_content_index = _content_index + 1;
				_tmp9_ = _content_index;
				_tmp10_ = _content_size;
				if (!(_tmp9_ < _tmp10_)) {
					break;
				}
				_tmp11_ = _content_list;
				_tmp12_ = gee_list_get (_tmp11_, _content_index);
				content = (XmppXepJingleContent*) _tmp12_;
				_tmp13_ = content;
				_tmp14_ = _tmp13_->content_params;
				_tmp15_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp14_, XMPP_XEP_JINGLE_RTP_TYPE_PARAMETERS) ? ((XmppXepJingleRtpParameters*) _tmp14_) : NULL);
				rtp_content_parameter = _tmp15_;
				_tmp17_ = rtp_content_parameter;
				if (_tmp17_ != NULL) {
					XmppXepJingleRtpParameters* _tmp18_;
					const gchar* _tmp19_;
					const gchar* _tmp20_;
					_tmp18_ = rtp_content_parameter;
					_tmp19_ = xmpp_xep_jingle_rtp_parameters_get_media (_tmp18_);
					_tmp20_ = _tmp19_;
					_tmp16_ = g_strcmp0 (_tmp20_, "video") == 0;
				} else {
					_tmp16_ = FALSE;
				}
				if (_tmp16_) {
					gboolean _tmp21_ = FALSE;
					gboolean _tmp22_;
					_tmp22_ = self->priv->_we_should_send_video;
					if (!_tmp22_) {
						XmppXepJingleSession* _tmp23_;
						XmppXepJingleContent* _tmp24_;
						XmppXepJingleSenders _tmp25_;
						XmppXepJingleSenders _tmp26_;
						_tmp23_ = self->session;
						_tmp24_ = content;
						_tmp25_ = xmpp_xep_jingle_content_get_senders (_tmp24_);
						_tmp26_ = _tmp25_;
						_tmp21_ = xmpp_xep_jingle_session_senders_include_us (_tmp23_, _tmp26_);
					} else {
						_tmp21_ = FALSE;
					}
					if (_tmp21_) {
						XmppXepJingleSession* _tmp27_;
						XmppXepJingleContent* _tmp28_;
						XmppXepJingleSenders _tmp29_;
						XmppXepJingleSenders _tmp30_;
						_tmp27_ = self->session;
						_tmp28_ = content;
						_tmp29_ = xmpp_xep_jingle_content_get_senders (_tmp28_);
						_tmp30_ = _tmp29_;
						if (xmpp_xep_jingle_session_senders_include_counterpart (_tmp27_, _tmp30_)) {
							XmppXepJingleSenders _tmp31_ = 0;
							XmppXepJingleSession* _tmp32_;
							gboolean _tmp33_;
							gboolean _tmp34_;
							XmppXepJingleContent* _tmp35_;
							_tmp32_ = self->session;
							_tmp33_ = xmpp_xep_jingle_session_get_we_initiated (_tmp32_);
							_tmp34_ = _tmp33_;
							if (_tmp34_) {
								_tmp31_ = XMPP_XEP_JINGLE_SENDERS_RESPONDER;
							} else {
								_tmp31_ = XMPP_XEP_JINGLE_SENDERS_INITIATOR;
							}
							_tmp35_ = content;
							xmpp_xep_jingle_content_modify (_tmp35_, _tmp31_);
						} else {
							XmppXepJingleContent* _tmp36_;
							_tmp36_ = content;
							xmpp_xep_jingle_content_reject (_tmp36_);
							_g_object_unref0 (rtp_content_parameter);
							_g_object_unref0 (content);
							continue;
						}
					}
				}
				_tmp37_ = content;
				xmpp_xep_jingle_content_accept (_tmp37_);
				_g_object_unref0 (rtp_content_parameter);
				_g_object_unref0 (content);
			}
		}
	} else {
		XmppXmppStream* stream = NULL;
		DinoStreamInteractor* _tmp38_;
		DinoEntitiesCall* _tmp39_;
		DinoEntitiesAccount* _tmp40_;
		DinoEntitiesAccount* _tmp41_;
		XmppXmppStream* _tmp42_;
		XmppXmppStream* _tmp43_;
		XmppXmppStream* _tmp44_;
		XmppModuleIdentity* _tmp45_;
		gpointer _tmp46_;
		XmppXepJingleMessageInitiationModule* _tmp47_;
		XmppXmppStream* _tmp48_;
		const gchar* _tmp49_;
		XmppXmppStream* _tmp50_;
		XmppModuleIdentity* _tmp51_;
		gpointer _tmp52_;
		XmppXepJingleMessageInitiationModule* _tmp53_;
		XmppXmppStream* _tmp54_;
		XmppJid* _tmp55_;
		const gchar* _tmp56_;
		_tmp38_ = self->stream_interactor;
		_tmp39_ = self->call;
		_tmp40_ = dino_entities_call_get_account (_tmp39_);
		_tmp41_ = _tmp40_;
		_tmp42_ = dino_stream_interactor_get_stream (_tmp38_, _tmp41_);
		stream = _tmp42_;
		_tmp43_ = stream;
		if (_tmp43_ == NULL) {
			_g_object_unref0 (stream);
			return;
		}
		_tmp44_ = stream;
		_tmp45_ = xmpp_xep_jingle_message_initiation_module_IDENTITY;
		_tmp46_ = xmpp_xmpp_stream_get_module (_tmp44_, XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp45_);
		_tmp47_ = (XmppXepJingleMessageInitiationModule*) _tmp46_;
		_tmp48_ = stream;
		_tmp49_ = self->sid;
		xmpp_xep_jingle_message_initiation_module_send_session_accept_to_self (_tmp47_, _tmp48_, _tmp49_);
		_g_object_unref0 (_tmp47_);
		_tmp50_ = stream;
		_tmp51_ = xmpp_xep_jingle_message_initiation_module_IDENTITY;
		_tmp52_ = xmpp_xmpp_stream_get_module (_tmp50_, XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp51_);
		_tmp53_ = (XmppXepJingleMessageInitiationModule*) _tmp52_;
		_tmp54_ = stream;
		_tmp55_ = self->jid;
		_tmp56_ = self->sid;
		xmpp_xep_jingle_message_initiation_module_send_session_proceed_to_peer (_tmp53_, _tmp54_, _tmp55_, _tmp56_);
		_g_object_unref0 (_tmp53_);
		_g_object_unref0 (stream);
	}
}

void
dino_peer_state_reject (DinoPeerState* self)
{
	XmppXepJingleSession* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->session;
	if (_tmp0_ != NULL) {
		{
			GeeList* _content_list = NULL;
			XmppXepJingleSession* _tmp1_;
			GeeList* _tmp2_;
			gint _content_size = 0;
			GeeList* _tmp3_;
			gint _tmp4_;
			gint _tmp5_;
			gint _content_index = 0;
			_tmp1_ = self->session;
			_tmp2_ = _tmp1_->contents;
			_content_list = _tmp2_;
			_tmp3_ = _content_list;
			_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
			_tmp5_ = _tmp4_;
			_content_size = _tmp5_;
			_content_index = -1;
			while (TRUE) {
				gint _tmp6_;
				gint _tmp7_;
				XmppXepJingleContent* content = NULL;
				GeeList* _tmp8_;
				gpointer _tmp9_;
				XmppXepJingleContent* _tmp10_;
				_content_index = _content_index + 1;
				_tmp6_ = _content_index;
				_tmp7_ = _content_size;
				if (!(_tmp6_ < _tmp7_)) {
					break;
				}
				_tmp8_ = _content_list;
				_tmp9_ = gee_list_get (_tmp8_, _content_index);
				content = (XmppXepJingleContent*) _tmp9_;
				_tmp10_ = content;
				xmpp_xep_jingle_content_reject (_tmp10_);
				_g_object_unref0 (content);
			}
		}
	} else {
		XmppXmppStream* stream = NULL;
		DinoStreamInteractor* _tmp11_;
		DinoEntitiesCall* _tmp12_;
		DinoEntitiesAccount* _tmp13_;
		DinoEntitiesAccount* _tmp14_;
		XmppXmppStream* _tmp15_;
		XmppXmppStream* _tmp16_;
		XmppXmppStream* _tmp17_;
		XmppModuleIdentity* _tmp18_;
		gpointer _tmp19_;
		XmppXepJingleMessageInitiationModule* _tmp20_;
		XmppXmppStream* _tmp21_;
		XmppJid* _tmp22_;
		const gchar* _tmp23_;
		XmppXmppStream* _tmp24_;
		XmppModuleIdentity* _tmp25_;
		gpointer _tmp26_;
		XmppXepJingleMessageInitiationModule* _tmp27_;
		XmppXmppStream* _tmp28_;
		const gchar* _tmp29_;
		_tmp11_ = self->stream_interactor;
		_tmp12_ = self->call;
		_tmp13_ = dino_entities_call_get_account (_tmp12_);
		_tmp14_ = _tmp13_;
		_tmp15_ = dino_stream_interactor_get_stream (_tmp11_, _tmp14_);
		stream = _tmp15_;
		_tmp16_ = stream;
		if (_tmp16_ == NULL) {
			_g_object_unref0 (stream);
			return;
		}
		_tmp17_ = stream;
		_tmp18_ = xmpp_xep_jingle_message_initiation_module_IDENTITY;
		_tmp19_ = xmpp_xmpp_stream_get_module (_tmp17_, XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp18_);
		_tmp20_ = (XmppXepJingleMessageInitiationModule*) _tmp19_;
		_tmp21_ = stream;
		_tmp22_ = self->jid;
		_tmp23_ = self->sid;
		xmpp_xep_jingle_message_initiation_module_send_session_reject_to_peer (_tmp20_, _tmp21_, _tmp22_, _tmp23_);
		_g_object_unref0 (_tmp20_);
		_tmp24_ = stream;
		_tmp25_ = xmpp_xep_jingle_message_initiation_module_IDENTITY;
		_tmp26_ = xmpp_xmpp_stream_get_module (_tmp24_, XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp25_);
		_tmp27_ = (XmppXepJingleMessageInitiationModule*) _tmp26_;
		_tmp28_ = stream;
		_tmp29_ = self->sid;
		xmpp_xep_jingle_message_initiation_module_send_session_reject_to_self (_tmp27_, _tmp28_, _tmp29_);
		_g_object_unref0 (_tmp27_);
		_g_object_unref0 (stream);
	}
}

void
dino_peer_state_end (DinoPeerState* self,
                     const gchar* terminate_reason,
                     const gchar* reason_text)
{
	const gchar* _tmp0_;
	GQuark _tmp2_ = 0U;
	static GQuark _tmp1_label0 = 0;
	static GQuark _tmp1_label1 = 0;
	g_return_if_fail (self != NULL);
	g_return_if_fail (terminate_reason != NULL);
	_tmp0_ = terminate_reason;
	_tmp2_ = (NULL == _tmp0_) ? 0 : g_quark_from_string (_tmp0_);
	if (_tmp2_ == ((0 != _tmp1_label0) ? _tmp1_label0 : (_tmp1_label0 = g_quark_from_static_string (XMPP_XEP_JINGLE_REASON_ELEMENT_SUCCESS)))) {
		switch (0) {
			default:
			{
				XmppXepJingleSession* _tmp3_;
				_tmp3_ = self->session;
				if (_tmp3_ != NULL) {
					XmppXepJingleSession* _tmp4_;
					_tmp4_ = self->session;
					xmpp_xep_jingle_session_terminate (_tmp4_, terminate_reason, reason_text, "success");
				}
				break;
			}
		}
	} else if (_tmp2_ == ((0 != _tmp1_label1) ? _tmp1_label1 : (_tmp1_label1 = g_quark_from_static_string (XMPP_XEP_JINGLE_REASON_ELEMENT_CANCEL)))) {
		switch (0) {
			default:
			{
				XmppXepJingleSession* _tmp5_;
				_tmp5_ = self->session;
				if (_tmp5_ != NULL) {
					XmppXepJingleSession* _tmp6_;
					_tmp6_ = self->session;
					xmpp_xep_jingle_session_terminate (_tmp6_, terminate_reason, reason_text, "cancel");
				} else {
					XmppXepMujiGroupCall* _tmp7_;
					_tmp7_ = self->priv->_group_call;
					if (_tmp7_ != NULL) {
					} else {
						XmppXmppStream* stream = NULL;
						DinoStreamInteractor* _tmp8_;
						DinoEntitiesCall* _tmp9_;
						DinoEntitiesAccount* _tmp10_;
						DinoEntitiesAccount* _tmp11_;
						XmppXmppStream* _tmp12_;
						XmppXmppStream* _tmp13_;
						XmppXmppStream* _tmp14_;
						XmppModuleIdentity* _tmp15_;
						gpointer _tmp16_;
						XmppXepJingleMessageInitiationModule* _tmp17_;
						XmppXmppStream* _tmp18_;
						XmppJid* _tmp19_;
						const gchar* _tmp20_;
						_tmp8_ = self->stream_interactor;
						_tmp9_ = self->call;
						_tmp10_ = dino_entities_call_get_account (_tmp9_);
						_tmp11_ = _tmp10_;
						_tmp12_ = dino_stream_interactor_get_stream (_tmp8_, _tmp11_);
						stream = _tmp12_;
						_tmp13_ = stream;
						if (_tmp13_ == NULL) {
							_g_object_unref0 (stream);
							return;
						}
						_tmp14_ = stream;
						_tmp15_ = xmpp_xep_jingle_message_initiation_module_IDENTITY;
						_tmp16_ = xmpp_xmpp_stream_get_module (_tmp14_, XMPP_XEP_JINGLE_MESSAGE_INITIATION_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp15_);
						_tmp17_ = (XmppXepJingleMessageInitiationModule*) _tmp16_;
						_tmp18_ = stream;
						_tmp19_ = self->jid;
						_tmp20_ = self->sid;
						xmpp_xep_jingle_message_initiation_module_send_session_retract_to_peer (_tmp17_, _tmp18_, _tmp19_, _tmp20_);
						_g_object_unref0 (_tmp17_);
						_g_object_unref0 (stream);
					}
				}
				break;
			}
		}
	}
}

void
dino_peer_state_mute_own_audio (DinoPeerState* self,
                                gboolean mute)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	XmppXepJingleSession* _tmp2_;
	XmppXepJingleRtpStream* stream = NULL;
	XmppXepJingleRtpParameters* _tmp7_;
	XmppXepJingleRtpStream* _tmp8_;
	XmppXepJingleRtpStream* _tmp9_;
	XmppXepJingleRtpStream* _tmp10_;
	DinoStreamInteractor* _tmp11_;
	DinoModuleManager* _tmp12_;
	DinoEntitiesCall* _tmp13_;
	DinoEntitiesAccount* _tmp14_;
	DinoEntitiesAccount* _tmp15_;
	XmppModuleIdentity* _tmp16_;
	gpointer _tmp17_;
	XmppXepJingleRtpModule* _tmp18_;
	XmppXepJingleRtpSessionInfoType* _tmp19_;
	XmppXepJingleSession* _tmp20_;
	DinoApplication* _tmp21_;
	DinoPluginsRegistry* _tmp22_;
	DinoPluginsRegistry* _tmp23_;
	DinoPluginsVideoCallPlugin* _tmp24_;
	XmppXepJingleRtpStream* _tmp25_;
	g_return_if_fail (self != NULL);
	_tmp2_ = self->session;
	if (_tmp2_ == NULL) {
		_tmp1_ = TRUE;
	} else {
		XmppXepJingleRtpParameters* _tmp3_;
		_tmp3_ = self->audio_content_parameter;
		_tmp1_ = _tmp3_ == NULL;
	}
	if (_tmp1_) {
		_tmp0_ = TRUE;
	} else {
		XmppXepJingleRtpParameters* _tmp4_;
		XmppXepJingleRtpStream* _tmp5_;
		XmppXepJingleRtpStream* _tmp6_;
		_tmp4_ = self->audio_content_parameter;
		_tmp5_ = xmpp_xep_jingle_rtp_parameters_get_stream (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp0_ = _tmp6_ == NULL;
	}
	if (_tmp0_) {
		return;
	}
	_tmp7_ = self->audio_content_parameter;
	_tmp8_ = xmpp_xep_jingle_rtp_parameters_get_stream (_tmp7_);
	_tmp9_ = _tmp8_;
	_tmp10_ = _g_object_ref0 (_tmp9_);
	stream = _tmp10_;
	_tmp11_ = self->stream_interactor;
	_tmp12_ = _tmp11_->module_manager;
	_tmp13_ = self->call;
	_tmp14_ = dino_entities_call_get_account (_tmp13_);
	_tmp15_ = _tmp14_;
	_tmp16_ = xmpp_xep_jingle_rtp_module_IDENTITY;
	_tmp17_ = dino_module_manager_get_module (_tmp12_, XMPP_XEP_JINGLE_RTP_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp15_, _tmp16_);
	_tmp18_ = (XmppXepJingleRtpModule*) _tmp17_;
	_tmp19_ = _tmp18_->session_info_type;
	_tmp20_ = self->session;
	xmpp_xep_jingle_rtp_session_info_type_send_mute (_tmp19_, _tmp20_, mute, "audio");
	_g_object_unref0 (_tmp18_);
	_tmp21_ = dino_application_get_default ();
	_tmp22_ = dino_application_get_plugin_registry (_tmp21_);
	_tmp23_ = _tmp22_;
	_tmp24_ = _tmp23_->video_call_plugin;
	_tmp25_ = stream;
	dino_plugins_video_call_plugin_set_pause (_tmp24_, _tmp25_, mute);
	_g_object_unref0 (stream);
}

static Block5Data*
block5_data_ref (Block5Data* _data5_)
{
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}

static void
block5_data_unref (void * _userdata_)
{
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		DinoPeerState* self;
		self = _data5_->self;
		_g_object_unref0 (_data5_->rtp_module);
		_g_object_unref0 (self);
		g_slice_free (Block5Data, _data5_);
	}
}

static void
____lambda60_ (Block5Data* _data5_,
               GObject* _,
               GAsyncResult* res)
{
	DinoPeerState* self;
	XmppXepJingleRtpParameters* _tmp0_;
	GError* _inner_error0_ = NULL;
	self = _data5_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = self->video_content_parameter;
	if (_tmp0_ == NULL) {
		XmppXepJingleContent* content = NULL;
		XmppXepJingleRtpModule* _tmp1_;
		XmppXepJingleContent* _tmp2_;
		XmppXepJingleRtpParameters* rtp_content_parameter = NULL;
		XmppXepJingleContent* _tmp3_;
		XmppXepJingleContentParameters* _tmp4_;
		XmppXepJingleRtpParameters* _tmp5_;
		XmppXepJingleRtpParameters* _tmp6_;
		_tmp1_ = _data5_->rtp_module;
		_tmp2_ = xmpp_xep_jingle_rtp_module_add_outgoing_video_content_finish (_tmp1_, res, &_inner_error0_);
		content = _tmp2_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
		_tmp3_ = content;
		_tmp4_ = _tmp3_->content_params;
		_tmp5_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, XMPP_XEP_JINGLE_RTP_TYPE_PARAMETERS) ? ((XmppXepJingleRtpParameters*) _tmp4_) : NULL);
		rtp_content_parameter = _tmp5_;
		_tmp6_ = rtp_content_parameter;
		if (_tmp6_ != NULL) {
			XmppXepJingleContent* _tmp7_;
			XmppXepJingleRtpParameters* _tmp8_;
			_tmp7_ = content;
			_tmp8_ = rtp_content_parameter;
			dino_peer_state_connect_content_signals (self, _tmp7_, _tmp8_);
		}
		_g_object_unref0 (rtp_content_parameter);
		_g_object_unref0 (content);
	}
}

static void
_____lambda60__gasync_ready_callback (GObject* source_object,
                                      GAsyncResult* res,
                                      gpointer self)
{
	____lambda60_ (self, source_object, res);
	block5_data_unref (self);
}

void
dino_peer_state_mute_own_video (DinoPeerState* self,
                                gboolean mute)
{
	Block5Data* _data5_;
	XmppXepJingleSession* _tmp0_;
	DinoStreamInteractor* _tmp1_;
	DinoModuleManager* _tmp2_;
	DinoEntitiesCall* _tmp3_;
	DinoEntitiesAccount* _tmp4_;
	DinoEntitiesAccount* _tmp5_;
	XmppModuleIdentity* _tmp6_;
	gpointer _tmp7_;
	gboolean _tmp8_ = FALSE;
	gboolean _tmp9_ = FALSE;
	XmppXepJingleRtpParameters* _tmp10_;
	g_return_if_fail (self != NULL);
	_data5_ = g_slice_new0 (Block5Data);
	_data5_->_ref_count_ = 1;
	_data5_->self = g_object_ref (self);
	_tmp0_ = self->session;
	if (_tmp0_ == NULL) {
		block5_data_unref (_data5_);
		_data5_ = NULL;
		return;
	}
	_tmp1_ = self->stream_interactor;
	_tmp2_ = _tmp1_->module_manager;
	_tmp3_ = self->call;
	_tmp4_ = dino_entities_call_get_account (_tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_xep_jingle_rtp_module_IDENTITY;
	_tmp7_ = dino_module_manager_get_module (_tmp2_, XMPP_XEP_JINGLE_RTP_TYPE_MODULE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, _tmp5_, _tmp6_);
	_data5_->rtp_module = (XmppXepJingleRtpModule*) _tmp7_;
	_tmp10_ = self->video_content_parameter;
	if (_tmp10_ != NULL) {
		XmppXepJingleRtpParameters* _tmp11_;
		XmppXepJingleRtpStream* _tmp12_;
		XmppXepJingleRtpStream* _tmp13_;
		_tmp11_ = self->video_content_parameter;
		_tmp12_ = xmpp_xep_jingle_rtp_parameters_get_stream (_tmp11_);
		_tmp13_ = _tmp12_;
		_tmp9_ = _tmp13_ != NULL;
	} else {
		_tmp9_ = FALSE;
	}
	if (_tmp9_) {
		XmppXepJingleSession* _tmp14_;
		XmppXepJingleContent* _tmp15_;
		XmppXepJingleSenders _tmp16_;
		XmppXepJingleSenders _tmp17_;
		_tmp14_ = self->session;
		_tmp15_ = self->video_content;
		_tmp16_ = xmpp_xep_jingle_content_get_senders (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp8_ = xmpp_xep_jingle_session_senders_include_us (_tmp14_, _tmp17_);
	} else {
		_tmp8_ = FALSE;
	}
	if (_tmp8_) {
		XmppXepJingleRtpStream* stream = NULL;
		XmppXepJingleRtpParameters* _tmp18_;
		XmppXepJingleRtpStream* _tmp19_;
		XmppXepJingleRtpStream* _tmp20_;
		XmppXepJingleRtpStream* _tmp21_;
		XmppXepJingleRtpStream* _tmp22_;
		XmppXepJingleRtpModule* _tmp28_;
		XmppXepJingleRtpSessionInfoType* _tmp29_;
		XmppXepJingleSession* _tmp30_;
		_tmp18_ = self->video_content_parameter;
		_tmp19_ = xmpp_xep_jingle_rtp_parameters_get_stream (_tmp18_);
		_tmp20_ = _tmp19_;
		_tmp21_ = _g_object_ref0 (_tmp20_);
		stream = _tmp21_;
		_tmp22_ = stream;
		if (_tmp22_ != NULL) {
			DinoApplication* _tmp23_;
			DinoPluginsRegistry* _tmp24_;
			DinoPluginsRegistry* _tmp25_;
			DinoPluginsVideoCallPlugin* _tmp26_;
			XmppXepJingleRtpStream* _tmp27_;
			_tmp23_ = dino_application_get_default ();
			_tmp24_ = dino_application_get_plugin_registry (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp26_ = _tmp25_->video_call_plugin;
			_tmp27_ = stream;
			dino_plugins_video_call_plugin_set_pause (_tmp26_, _tmp27_, mute);
		}
		_tmp28_ = _data5_->rtp_module;
		_tmp29_ = _tmp28_->session_info_type;
		_tmp30_ = self->session;
		xmpp_xep_jingle_rtp_session_info_type_send_mute (_tmp29_, _tmp30_, mute, "video");
		_g_object_unref0 (stream);
	} else {
		if (!mute) {
			XmppXmppStream* stream = NULL;
			DinoStreamInteractor* _tmp31_;
			DinoEntitiesCall* _tmp32_;
			DinoEntitiesAccount* _tmp33_;
			DinoEntitiesAccount* _tmp34_;
			XmppXmppStream* _tmp35_;
			XmppJid* _tmp36_ = NULL;
			XmppXepMujiGroupCall* _tmp37_;
			XmppXepJingleRtpModule* _tmp40_;
			XmppXmppStream* _tmp41_;
			XmppXepJingleSession* _tmp42_;
			_tmp31_ = self->stream_interactor;
			_tmp32_ = self->call;
			_tmp33_ = dino_entities_call_get_account (_tmp32_);
			_tmp34_ = _tmp33_;
			_tmp35_ = dino_stream_interactor_get_stream (_tmp31_, _tmp34_);
			stream = _tmp35_;
			_tmp37_ = self->priv->_group_call;
			if (_tmp37_ != NULL) {
				XmppXepMujiGroupCall* _tmp38_;
				XmppJid* _tmp39_;
				_tmp38_ = self->priv->_group_call;
				_tmp39_ = _tmp38_->muc_jid;
				_tmp36_ = _tmp39_;
			} else {
				_tmp36_ = NULL;
			}
			_tmp40_ = _data5_->rtp_module;
			_tmp41_ = stream;
			_tmp42_ = self->session;
			xmpp_xep_jingle_rtp_module_add_outgoing_video_content (_tmp40_, _tmp41_, _tmp42_, _tmp36_, _____lambda60__gasync_ready_callback, block5_data_ref (_data5_));
			_g_object_unref0 (stream);
		}
	}
	block5_data_unref (_data5_);
	_data5_ = NULL;
}

XmppXepJingleRtpStream*
dino_peer_state_get_video_stream (DinoPeerState* self)
{
	XmppXepJingleRtpParameters* _tmp0_;
	XmppXepJingleRtpStream* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->video_content_parameter;
	if (_tmp0_ != NULL) {
		XmppXepJingleRtpParameters* _tmp1_;
		XmppXepJingleRtpStream* _tmp2_;
		XmppXepJingleRtpStream* _tmp3_;
		XmppXepJingleRtpStream* _tmp4_;
		_tmp1_ = self->video_content_parameter;
		_tmp2_ = xmpp_xep_jingle_rtp_parameters_get_stream (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _g_object_ref0 (_tmp3_);
		result = _tmp4_;
		return result;
	}
	result = NULL;
	return result;
}

XmppXepJingleRtpStream*
dino_peer_state_get_audio_stream (DinoPeerState* self)
{
	XmppXepJingleRtpParameters* _tmp0_;
	XmppXepJingleRtpStream* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->audio_content_parameter;
	if (_tmp0_ != NULL) {
		XmppXepJingleRtpParameters* _tmp1_;
		XmppXepJingleRtpStream* _tmp2_;
		XmppXepJingleRtpStream* _tmp3_;
		XmppXepJingleRtpStream* _tmp4_;
		_tmp1_ = self->audio_content_parameter;
		_tmp2_ = xmpp_xep_jingle_rtp_parameters_get_stream (_tmp1_);
		_tmp3_ = _tmp2_;
		_tmp4_ = _g_object_ref0 (_tmp3_);
		result = _tmp4_;
		return result;
	}
	result = NULL;
	return result;
}

static void
__lambda55_ (DinoPeerState* self,
             XmppXmppStream* stream,
             gboolean we_terminated,
             const gchar* reason_name,
             const gchar* reason_text)
{
	g_return_if_fail (stream != NULL);
	g_signal_emit (self, dino_peer_state_signals[DINO_PEER_STATE_SESSION_TERMINATED_SIGNAL], 0, we_terminated, reason_name, reason_text);
}

static void
___lambda55__xmpp_xep_jingle_session_terminated (XmppXepJingleSession* _sender,
                                                 XmppXmppStream* stream,
                                                 gboolean we_terminated,
                                                 const gchar* reason_name,
                                                 const gchar* reason_text,
                                                 gpointer self)
{
	__lambda55_ ((DinoPeerState*) self, stream, we_terminated, reason_name, reason_text);
}

static void
__lambda56_ (DinoPeerState* self,
             XmppXmppStream* stream,
             XmppXepJingleContent* content)
{
	XmppXepJingleSession* _tmp0_;
	g_return_if_fail (stream != NULL);
	g_return_if_fail (content != NULL);
	_tmp0_ = content->session;
	dino_peer_state_on_incoming_content_add (self, stream, _tmp0_, content);
}

static void
___lambda56__xmpp_xep_jingle_session_additional_content_add_incoming (XmppXepJingleSession* _sender,
                                                                      XmppXmppStream* stream,
                                                                      XmppXepJingleContent* content,
                                                                      gpointer self)
{
	__lambda56_ ((DinoPeerState*) self, stream, content);
}

void
dino_peer_state_set_session (DinoPeerState* self,
                             XmppXepJingleSession* session)
{
	XmppXepJingleSession* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (session != NULL);
	_tmp0_ = _g_object_ref0 (session);
	_g_object_unref0 (self->session);
	self->session = _tmp0_;
	_tmp1_ = xmpp_xep_jingle_session_get_sid (session);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_strdup (_tmp2_);
	_g_free0 (self->sid);
	self->sid = _tmp3_;
	g_signal_connect_object (session, "terminated", (GCallback) ___lambda55__xmpp_xep_jingle_session_terminated, self, 0);
	g_signal_connect_object (session, "additional-content-add-incoming", (GCallback) ___lambda56__xmpp_xep_jingle_session_additional_content_add_incoming, self, 0);
	{
		GeeList* _content_list = NULL;
		GeeList* _tmp4_;
		gint _content_size = 0;
		GeeList* _tmp5_;
		gint _tmp6_;
		gint _tmp7_;
		gint _content_index = 0;
		_tmp4_ = session->contents;
		_content_list = _tmp4_;
		_tmp5_ = _content_list;
		_tmp6_ = gee_collection_get_size ((GeeCollection*) _tmp5_);
		_tmp7_ = _tmp6_;
		_content_size = _tmp7_;
		_content_index = -1;
		while (TRUE) {
			gint _tmp8_;
			gint _tmp9_;
			XmppXepJingleContent* content = NULL;
			GeeList* _tmp10_;
			gpointer _tmp11_;
			XmppXepJingleRtpParameters* rtp_content_parameter = NULL;
			XmppXepJingleContent* _tmp12_;
			XmppXepJingleContentParameters* _tmp13_;
			XmppXepJingleRtpParameters* _tmp14_;
			XmppXepJingleRtpParameters* _tmp15_;
			XmppXepJingleContent* _tmp16_;
			XmppXepJingleRtpParameters* _tmp17_;
			_content_index = _content_index + 1;
			_tmp8_ = _content_index;
			_tmp9_ = _content_size;
			if (!(_tmp8_ < _tmp9_)) {
				break;
			}
			_tmp10_ = _content_list;
			_tmp11_ = gee_list_get (_tmp10_, _content_index);
			content = (XmppXepJingleContent*) _tmp11_;
			_tmp12_ = content;
			_tmp13_ = _tmp12_->content_params;
			_tmp14_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp13_, XMPP_XEP_JINGLE_RTP_TYPE_PARAMETERS) ? ((XmppXepJingleRtpParameters*) _tmp13_) : NULL);
			rtp_content_parameter = _tmp14_;
			_tmp15_ = rtp_content_parameter;
			if (_tmp15_ == NULL) {
				_g_object_unref0 (rtp_content_parameter);
				_g_object_unref0 (content);
				continue;
			}
			_tmp16_ = content;
			_tmp17_ = rtp_content_parameter;
			dino_peer_state_connect_content_signals (self, _tmp16_, _tmp17_);
			_g_object_unref0 (rtp_content_parameter);
			_g_object_unref0 (content);
		}
	}
}

DinoPeerInfo*
dino_peer_state_get_info (DinoPeerState* self)
{
	DinoPeerInfo* ret = NULL;
	DinoPeerInfo* _tmp0_;
	gboolean _tmp1_ = FALSE;
	XmppXepJingleContent* _tmp2_;
	gboolean _tmp8_ = FALSE;
	XmppXepJingleContent* _tmp9_;
	DinoPeerInfo* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = dino_peer_info_new ();
	ret = _tmp0_;
	_tmp2_ = self->audio_content;
	if (_tmp2_ != NULL) {
		_tmp1_ = TRUE;
	} else {
		XmppXepJingleRtpParameters* _tmp3_;
		_tmp3_ = self->audio_content_parameter;
		_tmp1_ = _tmp3_ != NULL;
	}
	if (_tmp1_) {
		DinoPeerInfo* _tmp4_;
		XmppXepJingleContent* _tmp5_;
		XmppXepJingleRtpParameters* _tmp6_;
		DinoPeerContentInfo* _tmp7_;
		_tmp4_ = ret;
		_tmp5_ = self->audio_content;
		_tmp6_ = self->audio_content_parameter;
		_tmp7_ = dino_peer_state_get_content_info (self, _tmp5_, _tmp6_);
		_dino_peer_content_info_unref0 (_tmp4_->audio);
		_tmp4_->audio = _tmp7_;
	}
	_tmp9_ = self->video_content;
	if (_tmp9_ != NULL) {
		_tmp8_ = TRUE;
	} else {
		XmppXepJingleRtpParameters* _tmp10_;
		_tmp10_ = self->video_content_parameter;
		_tmp8_ = _tmp10_ != NULL;
	}
	if (_tmp8_) {
		DinoPeerInfo* _tmp11_;
		XmppXepJingleContent* _tmp12_;
		XmppXepJingleRtpParameters* _tmp13_;
		DinoPeerContentInfo* _tmp14_;
		_tmp11_ = ret;
		_tmp12_ = self->video_content;
		_tmp13_ = self->video_content_parameter;
		_tmp14_ = dino_peer_state_get_content_info (self, _tmp12_, _tmp13_);
		_dino_peer_content_info_unref0 (_tmp11_->video);
		_tmp11_->video = _tmp14_;
	}
	result = ret;
	return result;
}

static DinoPeerContentInfo*
dino_peer_state_get_content_info (DinoPeerState* self,
                                  XmppXepJingleContent* content,
                                  XmppXepJingleRtpParameters* parameter)
{
	DinoPeerContentInfo* ret = NULL;
	DinoPeerContentInfo* _tmp0_;
	DinoPeerContentInfo* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = dino_peer_content_info_new ();
	ret = _tmp0_;
	if (parameter != NULL) {
		DinoPeerContentInfo* _tmp1_;
		gboolean _tmp2_;
		gboolean _tmp3_;
		DinoPeerContentInfo* _tmp4_;
		gboolean _tmp5_;
		gboolean _tmp6_;
		XmppXepJingleRtpPayloadType* _tmp7_;
		XmppXepJingleRtpPayloadType* _tmp8_;
		gboolean _tmp19_ = FALSE;
		XmppXepJingleRtpStream* _tmp20_;
		XmppXepJingleRtpStream* _tmp21_;
		_tmp1_ = ret;
		_tmp2_ = xmpp_xep_jingle_rtp_parameters_get_rtcp_ready (parameter);
		_tmp3_ = _tmp2_;
		dino_peer_content_info_set_rtcp_ready (_tmp1_, _tmp3_);
		_tmp4_ = ret;
		_tmp5_ = xmpp_xep_jingle_rtp_parameters_get_rtp_ready (parameter);
		_tmp6_ = _tmp5_;
		dino_peer_content_info_set_rtp_ready (_tmp4_, _tmp6_);
		_tmp7_ = xmpp_xep_jingle_rtp_parameters_get_agreed_payload_type (parameter);
		_tmp8_ = _tmp7_;
		if (_tmp8_ != NULL) {
			DinoPeerContentInfo* _tmp9_;
			XmppXepJingleRtpPayloadType* _tmp10_;
			XmppXepJingleRtpPayloadType* _tmp11_;
			const gchar* _tmp12_;
			const gchar* _tmp13_;
			DinoPeerContentInfo* _tmp14_;
			XmppXepJingleRtpPayloadType* _tmp15_;
			XmppXepJingleRtpPayloadType* _tmp16_;
			guint32 _tmp17_;
			guint32 _tmp18_;
			_tmp9_ = ret;
			_tmp10_ = xmpp_xep_jingle_rtp_parameters_get_agreed_payload_type (parameter);
			_tmp11_ = _tmp10_;
			_tmp12_ = xmpp_xep_jingle_rtp_payload_type_get_name (_tmp11_);
			_tmp13_ = _tmp12_;
			dino_peer_content_info_set_codec (_tmp9_, _tmp13_);
			_tmp14_ = ret;
			_tmp15_ = xmpp_xep_jingle_rtp_parameters_get_agreed_payload_type (parameter);
			_tmp16_ = _tmp15_;
			_tmp17_ = xmpp_xep_jingle_rtp_payload_type_get_clockrate (_tmp16_);
			_tmp18_ = _tmp17_;
			dino_peer_content_info_set_clockrate (_tmp14_, _tmp18_);
		}
		_tmp20_ = xmpp_xep_jingle_rtp_parameters_get_stream (parameter);
		_tmp21_ = _tmp20_;
		if (_tmp21_ != NULL) {
			XmppXepJingleRtpStream* _tmp22_;
			XmppXepJingleRtpStream* _tmp23_;
			gboolean _tmp24_;
			gboolean _tmp25_;
			_tmp22_ = xmpp_xep_jingle_rtp_parameters_get_stream (parameter);
			_tmp23_ = _tmp22_;
			_tmp24_ = xmpp_xep_jingle_rtp_stream_get_remb_enabled (_tmp23_);
			_tmp25_ = _tmp24_;
			_tmp19_ = _tmp25_;
		} else {
			_tmp19_ = FALSE;
		}
		if (_tmp19_) {
			DinoPeerContentInfo* _tmp26_;
			XmppXepJingleRtpStream* _tmp27_;
			XmppXepJingleRtpStream* _tmp28_;
			guint _tmp29_;
			guint _tmp30_;
			DinoPeerContentInfo* _tmp31_;
			XmppXepJingleRtpStream* _tmp32_;
			XmppXepJingleRtpStream* _tmp33_;
			guint _tmp34_;
			guint _tmp35_;
			_tmp26_ = ret;
			_tmp27_ = xmpp_xep_jingle_rtp_parameters_get_stream (parameter);
			_tmp28_ = _tmp27_;
			_tmp29_ = xmpp_xep_jingle_rtp_stream_get_target_receive_bitrate (_tmp28_);
			_tmp30_ = _tmp29_;
			dino_peer_content_info_set_target_receive_bytes (_tmp26_, _tmp30_);
			_tmp31_ = ret;
			_tmp32_ = xmpp_xep_jingle_rtp_parameters_get_stream (parameter);
			_tmp33_ = _tmp32_;
			_tmp34_ = xmpp_xep_jingle_rtp_stream_get_target_send_bitrate (_tmp33_);
			_tmp35_ = _tmp34_;
			dino_peer_content_info_set_target_send_bytes (_tmp31_, _tmp35_);
		}
	}
	if (content != NULL) {
		XmppXepJingleComponentConnection* component0 = NULL;
		XmppXepJingleComponentConnection* _tmp36_;
		XmppXepJingleComponentConnection* _tmp37_;
		_tmp36_ = xmpp_xep_jingle_content_get_transport_connection (content, (guint8) 1);
		component0 = _tmp36_;
		_tmp37_ = component0;
		if (_tmp37_ != NULL) {
			DinoPeerContentInfo* _tmp38_;
			XmppXepJingleComponentConnection* _tmp39_;
			gulong _tmp40_;
			gulong _tmp41_;
			DinoPeerContentInfo* _tmp42_;
			XmppXepJingleComponentConnection* _tmp43_;
			gulong _tmp44_;
			gulong _tmp45_;
			_tmp38_ = ret;
			_tmp39_ = component0;
			_tmp40_ = xmpp_xep_jingle_component_connection_get_bytes_received (_tmp39_);
			_tmp41_ = _tmp40_;
			dino_peer_content_info_set_bytes_received (_tmp38_, &_tmp41_);
			_tmp42_ = ret;
			_tmp43_ = component0;
			_tmp44_ = xmpp_xep_jingle_component_connection_get_bytes_sent (_tmp43_);
			_tmp45_ = _tmp44_;
			dino_peer_content_info_set_bytes_sent (_tmp42_, &_tmp45_);
		}
		_g_object_unref0 (component0);
	}
	result = ret;
	return result;
}

static Block6Data*
block6_data_ref (Block6Data* _data6_)
{
	g_atomic_int_inc (&_data6_->_ref_count_);
	return _data6_;
}

static void
block6_data_unref (void * _userdata_)
{
	Block6Data* _data6_;
	_data6_ = (Block6Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data6_->_ref_count_)) {
		DinoPeerState* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->content);
		_g_object_unref0 (_data6_->rtp_content_parameter);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static void
__lambda57_ (Block6Data* _data6_,
             XmppXepJingleRtpStream* stream)
{
	DinoPeerState* self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	self = _data6_->self;
	g_return_if_fail (stream != NULL);
	_tmp0_ = xmpp_xep_jingle_rtp_parameters_get_media (_data6_->rtp_content_parameter);
	_tmp1_ = _tmp0_;
	dino_peer_state_on_stream_created (self, _tmp1_, stream);
}

static void
___lambda57__xmpp_xep_jingle_rtp_parameters_stream_created (XmppXepJingleRtpParameters* _sender,
                                                            XmppXepJingleRtpStream* stream,
                                                            gpointer self)
{
	__lambda57_ (self, stream);
}

static gboolean
__lambda62_ (Block6Data* _data6_)
{
	DinoPeerState* self;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gboolean result;
	self = _data6_->self;
	_tmp0_ = xmpp_xep_jingle_rtp_parameters_get_media (_data6_->rtp_content_parameter);
	_tmp1_ = _tmp0_;
	dino_peer_state_on_connection_ready (self, _data6_->content, _tmp1_);
	result = FALSE;
	return result;
}

static gboolean
___lambda62__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda62_ (self);
	return result;
}

static void
__lambda61_ (Block6Data* _data6_,
             XmppXepJingleRtpParameters* status)
{
	DinoPeerState* self;
	self = _data6_->self;
	g_return_if_fail (status != NULL);
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda62__gsource_func, block6_data_ref (_data6_), block6_data_unref);
}

static void
___lambda61__xmpp_xep_jingle_rtp_parameters_connection_ready (XmppXepJingleRtpParameters* _sender,
                                                              gpointer self)
{
	__lambda61_ (self, _sender);
}

static void
__lambda63_ (DinoPeerState* self,
             XmppXepJingleContent* content,
             XmppXepJingleSenders proposed_senders)
{
	XmppXepJingleSession* _tmp0_;
	XmppXepJingleSenders _tmp1_;
	XmppXepJingleSenders _tmp2_;
	XmppXepJingleSession* _tmp3_;
	gboolean _tmp6_ = FALSE;
	XmppXepJingleSession* _tmp7_;
	XmppXepJingleSenders _tmp8_;
	XmppXepJingleSenders _tmp9_;
	g_return_if_fail (content != NULL);
	_tmp0_ = content->session;
	_tmp1_ = xmpp_xep_jingle_content_get_senders (content);
	_tmp2_ = _tmp1_;
	_tmp3_ = content->session;
	if (xmpp_xep_jingle_session_senders_include_us (_tmp0_, _tmp2_) != xmpp_xep_jingle_session_senders_include_us (_tmp3_, proposed_senders)) {
		const gchar* _tmp4_;
		const gchar* _tmp5_;
		_tmp4_ = xmpp_xep_jingle_content_get_content_name (content);
		_tmp5_ = _tmp4_;
		g_warning ("call_peer_state.vala:333: counterpart set us to (not)sending %s. ignor" \
"ing", _tmp5_);
		return;
	}
	_tmp7_ = content->session;
	_tmp8_ = xmpp_xep_jingle_content_get_senders (content);
	_tmp9_ = _tmp8_;
	if (!xmpp_xep_jingle_session_senders_include_counterpart (_tmp7_, _tmp9_)) {
		XmppXepJingleSession* _tmp10_;
		_tmp10_ = content->session;
		_tmp6_ = xmpp_xep_jingle_session_senders_include_counterpart (_tmp10_, proposed_senders);
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		xmpp_xep_jingle_content_accept_content_modify (content, proposed_senders);
		dino_peer_state_on_counterpart_mute_update (self, FALSE, "video");
	}
}

static void
___lambda63__xmpp_xep_jingle_content_senders_modify_incoming (XmppXepJingleContent* _sender,
                                                              XmppXepJingleSenders proposed_senders,
                                                              gpointer self)
{
	__lambda63_ ((DinoPeerState*) self, _sender, proposed_senders);
}

static void
dino_peer_state_connect_content_signals (DinoPeerState* self,
                                         XmppXepJingleContent* content,
                                         XmppXepJingleRtpParameters* rtp_content_parameter)
{
	Block6Data* _data6_;
	XmppXepJingleContent* _tmp0_;
	XmppXepJingleRtpParameters* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	DinoEntitiesCall* _tmp10_;
	DinoEntitiesAccount* _tmp11_;
	DinoEntitiesAccount* _tmp12_;
	XmppJid* _tmp13_;
	XmppJid* _tmp14_;
	XmppJid* _tmp15_;
	gchar* _tmp16_;
	gchar* _tmp17_;
	XmppJid* _tmp18_;
	gchar* _tmp19_;
	gchar* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content != NULL);
	g_return_if_fail (rtp_content_parameter != NULL);
	_data6_ = g_slice_new0 (Block6Data);
	_data6_->_ref_count_ = 1;
	_data6_->self = g_object_ref (self);
	_tmp0_ = _g_object_ref0 (content);
	_g_object_unref0 (_data6_->content);
	_data6_->content = _tmp0_;
	_tmp1_ = _g_object_ref0 (rtp_content_parameter);
	_g_object_unref0 (_data6_->rtp_content_parameter);
	_data6_->rtp_content_parameter = _tmp1_;
	_tmp2_ = xmpp_xep_jingle_rtp_parameters_get_media (_data6_->rtp_content_parameter);
	_tmp3_ = _tmp2_;
	if (g_strcmp0 (_tmp3_, "audio") == 0) {
		XmppXepJingleContent* _tmp4_;
		XmppXepJingleRtpParameters* _tmp5_;
		_tmp4_ = _g_object_ref0 (_data6_->content);
		_g_object_unref0 (self->audio_content);
		self->audio_content = _tmp4_;
		_tmp5_ = _g_object_ref0 (_data6_->rtp_content_parameter);
		_g_object_unref0 (self->audio_content_parameter);
		self->audio_content_parameter = _tmp5_;
	} else {
		const gchar* _tmp6_;
		const gchar* _tmp7_;
		_tmp6_ = xmpp_xep_jingle_rtp_parameters_get_media (_data6_->rtp_content_parameter);
		_tmp7_ = _tmp6_;
		if (g_strcmp0 (_tmp7_, "video") == 0) {
			XmppXepJingleContent* _tmp8_;
			XmppXepJingleRtpParameters* _tmp9_;
			_tmp8_ = _g_object_ref0 (_data6_->content);
			_g_object_unref0 (self->video_content);
			self->video_content = _tmp8_;
			_tmp9_ = _g_object_ref0 (_data6_->rtp_content_parameter);
			_g_object_unref0 (self->video_content_parameter);
			self->video_content_parameter = _tmp9_;
		}
	}
	_tmp10_ = self->call;
	_tmp11_ = dino_entities_call_get_account (_tmp10_);
	_tmp12_ = _tmp11_;
	_tmp13_ = dino_entities_account_get_bare_jid (_tmp12_);
	_tmp14_ = _tmp13_;
	_tmp15_ = _tmp14_;
	_tmp16_ = xmpp_jid_to_string (_tmp15_);
	_tmp17_ = _tmp16_;
	_tmp18_ = self->jid;
	_tmp19_ = xmpp_jid_to_string (_tmp18_);
	_tmp20_ = _tmp19_;
	_tmp21_ = xmpp_xep_jingle_rtp_parameters_get_media (_data6_->rtp_content_parameter);
	_tmp22_ = _tmp21_;
	g_debug ("call_peer_state.vala:322: [%s] %s connecting content signals %s", _tmp17_, _tmp20_, _tmp22_);
	_g_free0 (_tmp20_);
	_g_free0 (_tmp17_);
	_xmpp_jid_unref0 (_tmp15_);
	g_signal_connect_data (_data6_->rtp_content_parameter, "stream-created", (GCallback) ___lambda57__xmpp_xep_jingle_rtp_parameters_stream_created, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	g_signal_connect_data (_data6_->rtp_content_parameter, "connection-ready", (GCallback) ___lambda61__xmpp_xep_jingle_rtp_parameters_connection_ready, block6_data_ref (_data6_), (GClosureNotify) block6_data_unref, 0);
	g_signal_connect_object (_data6_->content, "senders-modify-incoming", (GCallback) ___lambda63__xmpp_xep_jingle_content_senders_modify_incoming, self, 0);
	block6_data_unref (_data6_);
	_data6_ = NULL;
}

static void
dino_peer_state_on_incoming_content_add (DinoPeerState* self,
                                         XmppXmppStream* stream,
                                         XmppXepJingleSession* session,
                                         XmppXepJingleContent* content)
{
	XmppXepJingleRtpParameters* rtp_content_parameter = NULL;
	XmppXepJingleContentParameters* _tmp0_;
	XmppXepJingleRtpParameters* _tmp1_;
	XmppXepJingleRtpParameters* _tmp2_;
	XmppXepJingleSenders _tmp3_;
	XmppXepJingleSenders _tmp4_;
	XmppXepJingleRtpParameters* _tmp10_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	g_return_if_fail (session != NULL);
	g_return_if_fail (content != NULL);
	_tmp0_ = content->content_params;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, XMPP_XEP_JINGLE_RTP_TYPE_PARAMETERS) ? ((XmppXepJingleRtpParameters*) _tmp0_) : NULL);
	rtp_content_parameter = _tmp1_;
	_tmp2_ = rtp_content_parameter;
	if (_tmp2_ == NULL) {
		xmpp_xep_jingle_content_reject (content);
		_g_object_unref0 (rtp_content_parameter);
		return;
	}
	_tmp3_ = xmpp_xep_jingle_content_get_senders (content);
	_tmp4_ = _tmp3_;
	if (xmpp_xep_jingle_session_senders_include_us (session, _tmp4_)) {
		XmppXepJingleSenders _tmp5_;
		XmppXepJingleSenders _tmp6_;
		_tmp5_ = xmpp_xep_jingle_content_get_senders (content);
		_tmp6_ = _tmp5_;
		if (xmpp_xep_jingle_session_senders_include_counterpart (session, _tmp6_)) {
			XmppXepJingleSenders _tmp7_ = 0;
			gboolean _tmp8_;
			gboolean _tmp9_;
			_tmp8_ = xmpp_xep_jingle_session_get_we_initiated (session);
			_tmp9_ = _tmp8_;
			if (_tmp9_) {
				_tmp7_ = XMPP_XEP_JINGLE_SENDERS_RESPONDER;
			} else {
				_tmp7_ = XMPP_XEP_JINGLE_SENDERS_INITIATOR;
			}
			xmpp_xep_jingle_content_modify (content, _tmp7_);
		} else {
			xmpp_xep_jingle_content_reject (content);
		}
	}
	_tmp10_ = rtp_content_parameter;
	dino_peer_state_connect_content_signals (self, content, _tmp10_);
	xmpp_xep_jingle_content_accept (content);
	_g_object_unref0 (rtp_content_parameter);
}

static gboolean
__lambda59_ (DinoPeerState* self)
{
	gboolean result;
	g_signal_emit (self, dino_peer_state_signals[DINO_PEER_STATE_COUNTERPART_SENDS_VIDEO_UPDATED_SIGNAL], 0, FALSE);
	result = FALSE;
	return result;
}

static gboolean
___lambda59__gsource_func (gpointer self)
{
	gboolean result;
	result = __lambda59_ ((DinoPeerState*) self);
	return result;
}

static void
___lambda58_ (DinoPeerState* self,
              XmppXepJingleRtpParameters* status)
{
	g_return_if_fail (status != NULL);
	g_idle_add_full (G_PRIORITY_DEFAULT_IDLE, ___lambda59__gsource_func, g_object_ref (self), g_object_unref);
}

static void
____lambda58__xmpp_xep_jingle_rtp_parameters_connection_ready (XmppXepJingleRtpParameters* _sender,
                                                               gpointer self)
{
	___lambda58_ ((DinoPeerState*) self, _sender);
}

static void
dino_peer_state_on_stream_created (DinoPeerState* self,
                                   const gchar* media,
                                   XmppXepJingleRtpStream* stream)
{
	gboolean _tmp0_ = FALSE;
	gboolean _tmp4_ = FALSE;
	g_return_if_fail (self != NULL);
	g_return_if_fail (media != NULL);
	g_return_if_fail (stream != NULL);
	if (g_strcmp0 (media, "video") == 0) {
		gboolean _tmp1_;
		gboolean _tmp2_;
		_tmp1_ = xmpp_xep_jingle_rtp_stream_get_receiving (stream);
		_tmp2_ = _tmp1_;
		_tmp0_ = _tmp2_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		XmppXepJingleRtpParameters* _tmp3_;
		self->counterpart_sends_video = TRUE;
		_tmp3_ = self->video_content_parameter;
		g_signal_connect_object (_tmp3_, "connection-ready", (GCallback) ____lambda58__xmpp_xep_jingle_rtp_parameters_connection_ready, self, 0);
	}
	if (g_strcmp0 (media, "video") == 0) {
		gboolean _tmp5_;
		_tmp5_ = self->priv->_we_should_send_video;
		_tmp4_ = !_tmp5_;
	} else {
		_tmp4_ = FALSE;
	}
	if (_tmp4_) {
		dino_peer_state_mute_own_video (self, TRUE);
	} else {
		gboolean _tmp6_ = FALSE;
		if (g_strcmp0 (media, "audio") == 0) {
			gboolean _tmp7_;
			_tmp7_ = self->priv->_we_should_send_audio;
			_tmp6_ = !_tmp7_;
		} else {
			_tmp6_ = FALSE;
		}
		if (_tmp6_) {
			dino_peer_state_mute_own_audio (self, TRUE);
		}
	}
	g_signal_emit (self, dino_peer_state_signals[DINO_PEER_STATE_STREAM_CREATED_SIGNAL], 0, media);
}

static gchar*
bool_to_string (gboolean self)
{
	gchar* result;
	if (self) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup ("true");
		result = _tmp0_;
		return result;
	} else {
		gchar* _tmp1_;
		_tmp1_ = g_strdup ("false");
		result = _tmp1_;
		return result;
	}
}

static void
dino_peer_state_on_counterpart_mute_update (DinoPeerState* self,
                                            gboolean mute,
                                            const gchar* media)
{
	DinoEntitiesCall* _tmp0_;
	DinoEntitiesCall* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->call;
	_tmp1_ = self->call;
	if (!dino_entities_call_equals (_tmp0_, _tmp1_)) {
		return;
	}
	if (g_strcmp0 (media, "video") == 0) {
		DinoEntitiesCall* _tmp2_;
		DinoEntitiesAccount* _tmp3_;
		DinoEntitiesAccount* _tmp4_;
		XmppJid* _tmp5_;
		XmppJid* _tmp6_;
		XmppJid* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		XmppJid* _tmp10_;
		gchar* _tmp11_;
		gchar* _tmp12_;
		gchar* _tmp13_;
		gchar* _tmp14_;
		self->counterpart_sends_video = !mute;
		_tmp2_ = self->call;
		_tmp3_ = dino_entities_call_get_account (_tmp2_);
		_tmp4_ = _tmp3_;
		_tmp5_ = dino_entities_account_get_bare_jid (_tmp4_);
		_tmp6_ = _tmp5_;
		_tmp7_ = _tmp6_;
		_tmp8_ = xmpp_jid_to_string (_tmp7_);
		_tmp9_ = _tmp8_;
		_tmp10_ = self->jid;
		_tmp11_ = xmpp_jid_to_string (_tmp10_);
		_tmp12_ = _tmp11_;
		_tmp13_ = bool_to_string (mute);
		_tmp14_ = _tmp13_;
		g_debug ("call_peer_state.vala:394: [%s] %s video muted %s", _tmp9_, _tmp12_, _tmp14_);
		_g_free0 (_tmp14_);
		_g_free0 (_tmp12_);
		_g_free0 (_tmp9_);
		_xmpp_jid_unref0 (_tmp7_);
		g_signal_emit (self, dino_peer_state_signals[DINO_PEER_STATE_COUNTERPART_SENDS_VIDEO_UPDATED_SIGNAL], 0, mute);
	}
}

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

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

static void
dino_peer_state_on_connection_ready (DinoPeerState* self,
                                     XmppXepJingleContent* content,
                                     const gchar* media)
{
	DinoEntitiesCall* _tmp0_;
	DinoEntitiesAccount* _tmp1_;
	DinoEntitiesAccount* _tmp2_;
	XmppJid* _tmp3_;
	XmppJid* _tmp4_;
	XmppJid* _tmp5_;
	gchar* _tmp6_;
	gchar* _tmp7_;
	XmppJid* _tmp8_;
	gchar* _tmp9_;
	gchar* _tmp10_;
	gboolean _tmp11_ = FALSE;
	DinoEntitiesCall* _tmp12_;
	DinoEntitiesCallState _tmp13_;
	DinoEntitiesCallState _tmp14_;
	gboolean _tmp23_ = FALSE;
	gboolean _tmp24_ = FALSE;
	GeeHashMap* _tmp25_;
	GeeHashMap* _tmp35_ = NULL;
	GeeHashMap* _tmp36_;
	GeeHashMap* encryptions = NULL;
	GeeHashMap* _tmp38_;
	XmppXepJingleContentEncryption* omemo_encryption = NULL;
	XmppXepJingleContentEncryption* dtls_encryption = NULL;
	XmppXepJingleContentEncryption* srtp_encryption = NULL;
	gboolean _tmp67_ = FALSE;
	XmppXepJingleContentEncryption* _tmp68_;
	XmppXepJingleContentEncryption* _tmp121_;
	XmppXepJingleContentEncryption* _tmp122_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (content != NULL);
	g_return_if_fail (media != NULL);
	_tmp0_ = self->call;
	_tmp1_ = dino_entities_call_get_account (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = dino_entities_account_get_bare_jid (_tmp2_);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp6_ = xmpp_jid_to_string (_tmp5_);
	_tmp7_ = _tmp6_;
	_tmp8_ = self->jid;
	_tmp9_ = xmpp_jid_to_string (_tmp8_);
	_tmp10_ = _tmp9_;
	g_debug ("call_peer_state.vala:400: [%s] %s on_connection_ready", _tmp7_, _tmp10_);
	_g_free0 (_tmp10_);
	_g_free0 (_tmp7_);
	_xmpp_jid_unref0 (_tmp5_);
	g_signal_emit (self, dino_peer_state_signals[DINO_PEER_STATE_CONNECTION_READY_SIGNAL], 0);
	_tmp12_ = self->call;
	_tmp13_ = dino_entities_call_get_state (_tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_ == DINO_ENTITIES_CALL_STATE_RINGING) {
		_tmp11_ = TRUE;
	} else {
		DinoEntitiesCall* _tmp15_;
		DinoEntitiesCallState _tmp16_;
		DinoEntitiesCallState _tmp17_;
		_tmp15_ = self->call;
		_tmp16_ = dino_entities_call_get_state (_tmp15_);
		_tmp17_ = _tmp16_;
		_tmp11_ = _tmp17_ == DINO_ENTITIES_CALL_STATE_ESTABLISHING;
	}
	if (_tmp11_) {
		DinoEntitiesCall* _tmp18_;
		_tmp18_ = self->call;
		dino_entities_call_set_state (_tmp18_, DINO_ENTITIES_CALL_STATE_IN_PROGRESS);
	}
	if (g_strcmp0 (media, "audio") == 0) {
		GeeHashMap* _tmp19_;
		GeeHashMap* _tmp20_;
		_tmp19_ = content->encryptions;
		_tmp20_ = _g_object_ref0 (_tmp19_);
		_g_object_unref0 (self->audio_encryptions);
		self->audio_encryptions = _tmp20_;
	} else {
		if (g_strcmp0 (media, "video") == 0) {
			GeeHashMap* _tmp21_;
			GeeHashMap* _tmp22_;
			_tmp21_ = content->encryptions;
			_tmp22_ = _g_object_ref0 (_tmp21_);
			_g_object_unref0 (self->video_encryptions);
			self->video_encryptions = _tmp22_;
		}
	}
	_tmp25_ = self->audio_encryptions;
	if (_tmp25_ != NULL) {
		GeeHashMap* _tmp26_;
		gboolean _tmp27_;
		gboolean _tmp28_;
		_tmp26_ = self->audio_encryptions;
		_tmp27_ = gee_map_get_is_empty ((GeeMap*) _tmp26_);
		_tmp28_ = _tmp27_;
		_tmp24_ = _tmp28_;
	} else {
		_tmp24_ = FALSE;
	}
	if (_tmp24_) {
		_tmp23_ = TRUE;
	} else {
		gboolean _tmp29_ = FALSE;
		GeeHashMap* _tmp30_;
		_tmp30_ = self->video_encryptions;
		if (_tmp30_ != NULL) {
			GeeHashMap* _tmp31_;
			gboolean _tmp32_;
			gboolean _tmp33_;
			_tmp31_ = self->video_encryptions;
			_tmp32_ = gee_map_get_is_empty ((GeeMap*) _tmp31_);
			_tmp33_ = _tmp32_;
			_tmp29_ = _tmp33_;
		} else {
			_tmp29_ = FALSE;
		}
		_tmp23_ = _tmp29_;
	}
	if (_tmp23_) {
		DinoEntitiesCall* _tmp34_;
		_tmp34_ = self->call;
		dino_entities_call_set_encryption (_tmp34_, DINO_ENTITIES_ENCRYPTION_NONE);
		g_signal_emit (self, dino_peer_state_signals[DINO_PEER_STATE_ENCRYPTION_UPDATED_SIGNAL], 0, NULL, NULL);
		return;
	}
	_tmp36_ = self->audio_encryptions;
	_tmp35_ = _tmp36_;
	if (_tmp35_ == NULL) {
		GeeHashMap* _tmp37_;
		_tmp37_ = self->video_encryptions;
		_tmp35_ = _tmp37_;
	}
	_tmp38_ = _g_object_ref0 (_tmp35_);
	encryptions = _tmp38_;
	omemo_encryption = NULL;
	dtls_encryption = NULL;
	srtp_encryption = NULL;
	{
		GeeIterator* _encr_name_it = NULL;
		GeeHashMap* _tmp39_;
		GeeSet* _tmp40_;
		GeeSet* _tmp41_;
		GeeSet* _tmp42_;
		GeeIterator* _tmp43_;
		GeeIterator* _tmp44_;
		_tmp39_ = encryptions;
		_tmp40_ = gee_abstract_map_get_keys ((GeeAbstractMap*) _tmp39_);
		_tmp41_ = _tmp40_;
		_tmp42_ = _tmp41_;
		_tmp43_ = gee_iterable_iterator ((GeeIterable*) _tmp42_);
		_tmp44_ = _tmp43_;
		_g_object_unref0 (_tmp42_);
		_encr_name_it = _tmp44_;
		while (TRUE) {
			GeeIterator* _tmp45_;
			gchar* encr_name = NULL;
			GeeIterator* _tmp46_;
			gpointer _tmp47_;
			gboolean _tmp48_ = FALSE;
			GeeHashMap* _tmp49_;
			XmppXepJingleContentEncryption* encryption = NULL;
			GeeHashMap* _tmp52_;
			const gchar* _tmp53_;
			gpointer _tmp54_;
			XmppXepJingleContentEncryption* _tmp55_;
			const gchar* _tmp56_;
			_tmp45_ = _encr_name_it;
			if (!gee_iterator_next (_tmp45_)) {
				break;
			}
			_tmp46_ = _encr_name_it;
			_tmp47_ = gee_iterator_get (_tmp46_);
			encr_name = (gchar*) _tmp47_;
			_tmp49_ = self->video_encryptions;
			if (_tmp49_ != NULL) {
				GeeHashMap* _tmp50_;
				const gchar* _tmp51_;
				_tmp50_ = self->video_encryptions;
				_tmp51_ = encr_name;
				_tmp48_ = !gee_abstract_map_has_key ((GeeAbstractMap*) _tmp50_, _tmp51_);
			} else {
				_tmp48_ = FALSE;
			}
			if (_tmp48_) {
				_g_free0 (encr_name);
				continue;
			}
			_tmp52_ = encryptions;
			_tmp53_ = encr_name;
			_tmp54_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp52_, _tmp53_);
			encryption = (XmppXepJingleContentEncryption*) _tmp54_;
			_tmp55_ = encryption;
			_tmp56_ = _tmp55_->encryption_ns;
			if (g_strcmp0 (_tmp56_, "http://gultsch.de/xmpp/drafts/omemo/dlts-srtp-verification") == 0) {
				XmppXepJingleContentEncryption* _tmp57_;
				XmppXepJingleContentEncryption* _tmp58_;
				_tmp57_ = encryption;
				_tmp58_ = _g_object_ref0 (_tmp57_);
				_g_object_unref0 (omemo_encryption);
				omemo_encryption = _tmp58_;
			} else {
				XmppXepJingleContentEncryption* _tmp59_;
				const gchar* _tmp60_;
				_tmp59_ = encryption;
				_tmp60_ = _tmp59_->encryption_ns;
				if (g_strcmp0 (_tmp60_, XMPP_XEP_JINGLE_ICE_UDP_DTLS_NS_URI) == 0) {
					XmppXepJingleContentEncryption* _tmp61_;
					XmppXepJingleContentEncryption* _tmp62_;
					_tmp61_ = encryption;
					_tmp62_ = _g_object_ref0 (_tmp61_);
					_g_object_unref0 (dtls_encryption);
					dtls_encryption = _tmp62_;
				} else {
					XmppXepJingleContentEncryption* _tmp63_;
					const gchar* _tmp64_;
					_tmp63_ = encryption;
					_tmp64_ = _tmp63_->encryption_name;
					if (g_strcmp0 (_tmp64_, "SRTP") == 0) {
						XmppXepJingleContentEncryption* _tmp65_;
						XmppXepJingleContentEncryption* _tmp66_;
						_tmp65_ = encryption;
						_tmp66_ = _g_object_ref0 (_tmp65_);
						_g_object_unref0 (srtp_encryption);
						srtp_encryption = _tmp66_;
					}
				}
			}
			_g_object_unref0 (encryption);
			_g_free0 (encr_name);
		}
		_g_object_unref0 (_encr_name_it);
	}
	_tmp68_ = omemo_encryption;
	if (_tmp68_ != NULL) {
		XmppXepJingleContentEncryption* _tmp69_;
		_tmp69_ = dtls_encryption;
		_tmp67_ = _tmp69_ != NULL;
	} else {
		_tmp67_ = FALSE;
	}
	if (_tmp67_) {
		DinoEntitiesCall* _tmp70_;
		XmppXepJingleContentEncryption* _tmp71_;
		XmppXepJingleContentEncryption* _tmp72_;
		guint8* _tmp73_;
		gint _tmp73__length1;
		guint8* _tmp74_;
		gint _tmp74__length1;
		XmppXepJingleContentEncryption* _tmp75_;
		XmppXepJingleContentEncryption* _tmp76_;
		guint8* _tmp77_;
		gint _tmp77__length1;
		guint8* _tmp78_;
		gint _tmp78__length1;
		XmppXepJingleContentEncryption* _tmp79_;
		XmppXepJingleContentEncryption* _tmp80_;
		XmppXepJingleContentEncryption* _tmp81_ = NULL;
		GeeHashMap* _tmp82_;
		XmppXepJingleContentEncryption* _tmp85_;
		_tmp70_ = self->call;
		dino_entities_call_set_encryption (_tmp70_, DINO_ENTITIES_ENCRYPTION_OMEMO);
		_tmp71_ = omemo_encryption;
		_tmp72_ = dtls_encryption;
		_tmp73_ = _tmp72_->peer_key;
		_tmp73__length1 = _tmp72_->peer_key_length1;
		_tmp74_ = (_tmp73_ != NULL) ? _vala_array_dup1 (_tmp73_, _tmp73__length1) : _tmp73_;
		_tmp74__length1 = _tmp73__length1;
		_tmp71_->peer_key = (g_free (_tmp71_->peer_key), NULL);
		_tmp71_->peer_key = _tmp74_;
		_tmp71_->peer_key_length1 = _tmp74__length1;
		_tmp75_ = omemo_encryption;
		_tmp76_ = dtls_encryption;
		_tmp77_ = _tmp76_->our_key;
		_tmp77__length1 = _tmp76_->our_key_length1;
		_tmp78_ = (_tmp77_ != NULL) ? _vala_array_dup2 (_tmp77_, _tmp77__length1) : _tmp77_;
		_tmp78__length1 = _tmp77__length1;
		_tmp75_->our_key = (g_free (_tmp75_->our_key), NULL);
		_tmp75_->our_key = _tmp78_;
		_tmp75_->our_key_length1 = _tmp78__length1;
		_tmp79_ = omemo_encryption;
		_tmp80_ = _g_object_ref0 (_tmp79_);
		_g_object_unref0 (self->audio_encryption);
		self->audio_encryption = _tmp80_;
		self->encryption_keys_same = TRUE;
		_tmp82_ = self->video_encryptions;
		if (_tmp82_ != NULL) {
			GeeHashMap* _tmp83_;
			gpointer _tmp84_;
			_tmp83_ = self->video_encryptions;
			_tmp84_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp83_, "http://gultsch.de/xmpp/drafts/omemo/dlts-srtp-verification");
			_g_object_unref0 (_tmp81_);
			_tmp81_ = (XmppXepJingleContentEncryption*) _tmp84_;
		} else {
			_g_object_unref0 (_tmp81_);
			_tmp81_ = NULL;
		}
		_tmp85_ = _tmp81_;
		_tmp81_ = NULL;
		_g_object_unref0 (self->video_encryption);
		self->video_encryption = _tmp85_;
		_g_object_unref0 (_tmp81_);
	} else {
		XmppXepJingleContentEncryption* _tmp86_;
		_tmp86_ = dtls_encryption;
		if (_tmp86_ != NULL) {
			DinoEntitiesCall* _tmp87_;
			XmppXepJingleContentEncryption* _tmp88_;
			XmppXepJingleContentEncryption* _tmp89_;
			XmppXepJingleContentEncryption* _tmp90_ = NULL;
			GeeHashMap* _tmp91_;
			XmppXepJingleContentEncryption* _tmp94_;
			gboolean _tmp95_ = FALSE;
			XmppXepJingleContentEncryption* _tmp96_;
			_tmp87_ = self->call;
			dino_entities_call_set_encryption (_tmp87_, DINO_ENTITIES_ENCRYPTION_DTLS_SRTP);
			_tmp88_ = dtls_encryption;
			_tmp89_ = _g_object_ref0 (_tmp88_);
			_g_object_unref0 (self->audio_encryption);
			self->audio_encryption = _tmp89_;
			_tmp91_ = self->video_encryptions;
			if (_tmp91_ != NULL) {
				GeeHashMap* _tmp92_;
				gpointer _tmp93_;
				_tmp92_ = self->video_encryptions;
				_tmp93_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp92_, XMPP_XEP_JINGLE_ICE_UDP_DTLS_NS_URI);
				_g_object_unref0 (_tmp90_);
				_tmp90_ = (XmppXepJingleContentEncryption*) _tmp93_;
			} else {
				_g_object_unref0 (_tmp90_);
				_tmp90_ = NULL;
			}
			_tmp94_ = _tmp90_;
			_tmp90_ = NULL;
			_g_object_unref0 (self->video_encryption);
			self->video_encryption = _tmp94_;
			self->encryption_keys_same = TRUE;
			_tmp96_ = self->video_encryption;
			if (_tmp96_ != NULL) {
				XmppXepJingleContentEncryption* _tmp97_;
				guint8* _tmp98_;
				gint _tmp98__length1;
				XmppXepJingleContentEncryption* _tmp99_;
				guint8* _tmp100_;
				gint _tmp100__length1;
				_tmp97_ = dtls_encryption;
				_tmp98_ = _tmp97_->peer_key;
				_tmp98__length1 = _tmp97_->peer_key_length1;
				_tmp99_ = self->video_encryption;
				_tmp100_ = _tmp99_->peer_key;
				_tmp100__length1 = _tmp99_->peer_key_length1;
				_tmp95_ = _tmp98__length1 == _tmp100__length1;
			} else {
				_tmp95_ = FALSE;
			}
			if (_tmp95_) {
				{
					gint i = 0;
					i = 0;
					{
						gboolean _tmp101_ = FALSE;
						_tmp101_ = TRUE;
						while (TRUE) {
							XmppXepJingleContentEncryption* _tmp103_;
							guint8* _tmp104_;
							gint _tmp104__length1;
							XmppXepJingleContentEncryption* _tmp105_;
							guint8* _tmp106_;
							gint _tmp106__length1;
							guint8 _tmp107_;
							XmppXepJingleContentEncryption* _tmp108_;
							guint8* _tmp109_;
							gint _tmp109__length1;
							guint8 _tmp110_;
							if (!_tmp101_) {
								gint _tmp102_;
								_tmp102_ = i;
								i = _tmp102_ + 1;
							}
							_tmp101_ = FALSE;
							_tmp103_ = dtls_encryption;
							_tmp104_ = _tmp103_->peer_key;
							_tmp104__length1 = _tmp103_->peer_key_length1;
							if (!(i < _tmp104__length1)) {
								break;
							}
							_tmp105_ = dtls_encryption;
							_tmp106_ = _tmp105_->peer_key;
							_tmp106__length1 = _tmp105_->peer_key_length1;
							_tmp107_ = _tmp106_[i];
							_tmp108_ = self->video_encryption;
							_tmp109_ = _tmp108_->peer_key;
							_tmp109__length1 = _tmp108_->peer_key_length1;
							_tmp110_ = _tmp109_[i];
							if (_tmp107_ != _tmp110_) {
								self->encryption_keys_same = FALSE;
								break;
							}
						}
					}
				}
			}
			_g_object_unref0 (_tmp90_);
		} else {
			XmppXepJingleContentEncryption* _tmp111_;
			_tmp111_ = srtp_encryption;
			if (_tmp111_ != NULL) {
				DinoEntitiesCall* _tmp112_;
				XmppXepJingleContentEncryption* _tmp113_;
				XmppXepJingleContentEncryption* _tmp114_;
				XmppXepJingleContentEncryption* _tmp115_ = NULL;
				GeeHashMap* _tmp116_;
				XmppXepJingleContentEncryption* _tmp119_;
				_tmp112_ = self->call;
				dino_entities_call_set_encryption (_tmp112_, DINO_ENTITIES_ENCRYPTION_SRTP);
				_tmp113_ = srtp_encryption;
				_tmp114_ = _g_object_ref0 (_tmp113_);
				_g_object_unref0 (self->audio_encryption);
				self->audio_encryption = _tmp114_;
				_tmp116_ = self->video_encryptions;
				if (_tmp116_ != NULL) {
					GeeHashMap* _tmp117_;
					gpointer _tmp118_;
					_tmp117_ = self->video_encryptions;
					_tmp118_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp117_, "SRTP");
					_g_object_unref0 (_tmp115_);
					_tmp115_ = (XmppXepJingleContentEncryption*) _tmp118_;
				} else {
					_g_object_unref0 (_tmp115_);
					_tmp115_ = NULL;
				}
				_tmp119_ = _tmp115_;
				_tmp115_ = NULL;
				_g_object_unref0 (self->video_encryption);
				self->video_encryption = _tmp119_;
				self->encryption_keys_same = FALSE;
				_g_object_unref0 (_tmp115_);
			} else {
				DinoEntitiesCall* _tmp120_;
				_tmp120_ = self->call;
				dino_entities_call_set_encryption (_tmp120_, DINO_ENTITIES_ENCRYPTION_NONE);
				self->encryption_keys_same = TRUE;
			}
		}
	}
	_tmp121_ = self->audio_encryption;
	_tmp122_ = self->video_encryption;
	g_signal_emit (self, dino_peer_state_signals[DINO_PEER_STATE_ENCRYPTION_UPDATED_SIGNAL], 0, _tmp121_, _tmp122_);
	_g_object_unref0 (srtp_encryption);
	_g_object_unref0 (dtls_encryption);
	_g_object_unref0 (omemo_encryption);
	_g_object_unref0 (encryptions);
}

XmppXepMujiGroupCall*
dino_peer_state_get_group_call (DinoPeerState* self)
{
	XmppXepMujiGroupCall* result;
	XmppXepMujiGroupCall* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_group_call;
	result = _tmp0_;
	return result;
}

static gpointer
_xmpp_xep_muji_group_call_ref0 (gpointer self)
{
	return self ? xmpp_xep_muji_group_call_ref (self) : NULL;
}

void
dino_peer_state_set_group_call (DinoPeerState* self,
                                XmppXepMujiGroupCall* value)
{
	XmppXepMujiGroupCall* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_peer_state_get_group_call (self);
	if (old_value != value) {
		XmppXepMujiGroupCall* _tmp0_;
		_tmp0_ = _xmpp_xep_muji_group_call_ref0 (value);
		_xmpp_xep_muji_group_call_unref0 (self->priv->_group_call);
		self->priv->_group_call = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_peer_state_properties[DINO_PEER_STATE_GROUP_CALL_PROPERTY]);
	}
}

gboolean
dino_peer_state_get_we_should_send_audio (DinoPeerState* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_we_should_send_audio;
	return result;
}

void
dino_peer_state_set_we_should_send_audio (DinoPeerState* self,
                                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_peer_state_get_we_should_send_audio (self);
	if (old_value != value) {
		self->priv->_we_should_send_audio = value;
		g_object_notify_by_pspec ((GObject *) self, dino_peer_state_properties[DINO_PEER_STATE_WE_SHOULD_SEND_AUDIO_PROPERTY]);
	}
}

gboolean
dino_peer_state_get_we_should_send_video (DinoPeerState* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_we_should_send_video;
	return result;
}

void
dino_peer_state_set_we_should_send_video (DinoPeerState* self,
                                          gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_peer_state_get_we_should_send_video (self);
	if (old_value != value) {
		self->priv->_we_should_send_video = value;
		g_object_notify_by_pspec ((GObject *) self, dino_peer_state_properties[DINO_PEER_STATE_WE_SHOULD_SEND_VIDEO_PROPERTY]);
	}
}

static void
g_cclosure_user_marshal_VOID__BOOLEAN_STRING_STRING (GClosure * closure,
                                                     GValue * return_value,
                                                     guint n_param_values,
                                                     const GValue * param_values,
                                                     gpointer invocation_hint,
                                                     gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__BOOLEAN_STRING_STRING) (gpointer data1, gboolean arg_1, const char* arg_2, const char* arg_3, gpointer data2);
	register GMarshalFunc_VOID__BOOLEAN_STRING_STRING callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 4);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__BOOLEAN_STRING_STRING) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_boolean (param_values + 1), g_value_get_string (param_values + 2), g_value_get_string (param_values + 3), data2);
}

static void
g_cclosure_user_marshal_VOID__OBJECT_OBJECT (GClosure * closure,
                                             GValue * return_value,
                                             guint n_param_values,
                                             const GValue * param_values,
                                             gpointer invocation_hint,
                                             gpointer marshal_data)
{
	typedef void (*GMarshalFunc_VOID__OBJECT_OBJECT) (gpointer data1, gpointer arg_1, gpointer arg_2, gpointer data2);
	register GMarshalFunc_VOID__OBJECT_OBJECT callback;
	register GCClosure * cc;
	register gpointer data1;
	register gpointer data2;
	cc = (GCClosure *) closure;
	g_return_if_fail (n_param_values == 3);
	if (G_CCLOSURE_SWAP_DATA (closure)) {
		data1 = closure->data;
		data2 = param_values->data[0].v_pointer;
	} else {
		data1 = param_values->data[0].v_pointer;
		data2 = closure->data;
	}
	callback = (GMarshalFunc_VOID__OBJECT_OBJECT) (marshal_data ? marshal_data : cc->callback);
	callback (data1, g_value_get_object (param_values + 1), g_value_get_object (param_values + 2), data2);
}

static void
dino_peer_state_class_init (DinoPeerStateClass * klass,
                            gpointer klass_data)
{
	dino_peer_state_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPeerState_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_peer_state_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_peer_state_set_property;
	G_OBJECT_CLASS (klass)->finalize = dino_peer_state_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PEER_STATE_GROUP_CALL_PROPERTY, dino_peer_state_properties[DINO_PEER_STATE_GROUP_CALL_PROPERTY] = xmpp_xep_muji_param_spec_group_call ("group-call", "group-call", "group-call", XMPP_XEP_MUJI_TYPE_GROUP_CALL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PEER_STATE_WE_SHOULD_SEND_AUDIO_PROPERTY, dino_peer_state_properties[DINO_PEER_STATE_WE_SHOULD_SEND_AUDIO_PROPERTY] = g_param_spec_boolean ("we-should-send-audio", "we-should-send-audio", "we-should-send-audio", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PEER_STATE_WE_SHOULD_SEND_VIDEO_PROPERTY, dino_peer_state_properties[DINO_PEER_STATE_WE_SHOULD_SEND_VIDEO_PROPERTY] = g_param_spec_boolean ("we-should-send-video", "we-should-send-video", "we-should-send-video", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	dino_peer_state_signals[DINO_PEER_STATE_STREAM_CREATED_SIGNAL] = g_signal_new ("stream-created", DINO_TYPE_PEER_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__STRING, G_TYPE_NONE, 1, G_TYPE_STRING);
	dino_peer_state_signals[DINO_PEER_STATE_COUNTERPART_SENDS_VIDEO_UPDATED_SIGNAL] = g_signal_new ("counterpart-sends-video-updated", DINO_TYPE_PEER_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__BOOLEAN, G_TYPE_NONE, 1, G_TYPE_BOOLEAN);
	dino_peer_state_signals[DINO_PEER_STATE_INFO_RECEIVED_SIGNAL] = g_signal_new ("info-received", DINO_TYPE_PEER_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__ENUM, G_TYPE_NONE, 1, XMPP_XEP_JINGLE_RTP_TYPE_CALL_SESSION_INFO);
	dino_peer_state_signals[DINO_PEER_STATE_CONNECTION_READY_SIGNAL] = g_signal_new ("connection-ready", DINO_TYPE_PEER_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_marshal_VOID__VOID, G_TYPE_NONE, 0);
	dino_peer_state_signals[DINO_PEER_STATE_SESSION_TERMINATED_SIGNAL] = g_signal_new ("session-terminated", DINO_TYPE_PEER_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__BOOLEAN_STRING_STRING, G_TYPE_NONE, 3, G_TYPE_BOOLEAN, G_TYPE_STRING, G_TYPE_STRING);
	dino_peer_state_signals[DINO_PEER_STATE_ENCRYPTION_UPDATED_SIGNAL] = g_signal_new ("encryption-updated", DINO_TYPE_PEER_STATE, G_SIGNAL_RUN_LAST, 0, NULL, NULL, g_cclosure_user_marshal_VOID__OBJECT_OBJECT, G_TYPE_NONE, 2, XMPP_XEP_JINGLE_TYPE_CONTENT_ENCRYPTION, XMPP_XEP_JINGLE_TYPE_CONTENT_ENCRYPTION);
}

static void
dino_peer_state_instance_init (DinoPeerState * self,
                               gpointer klass)
{
	gchar* _tmp0_;
	self->priv = dino_peer_state_get_instance_private (self);
	_tmp0_ = xmpp_random_uuid ();
	self->internal_id = _tmp0_;
	self->audio_content_parameter = NULL;
	self->video_content_parameter = NULL;
	self->audio_content = NULL;
	self->video_content = NULL;
	self->video_encryption = NULL;
	self->audio_encryption = NULL;
	self->encryption_keys_same = FALSE;
	self->video_encryptions = NULL;
	self->audio_encryptions = NULL;
	self->first_peer = FALSE;
	self->waiting_for_inbound_muji_connection = FALSE;
	self->counterpart_sends_video = FALSE;
	self->priv->_we_should_send_audio = FALSE;
	self->priv->_we_should_send_video = FALSE;
}

static void
dino_peer_state_finalize (GObject * obj)
{
	DinoPeerState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_PEER_STATE, DinoPeerState);
	_g_object_unref0 (self->stream_interactor);
	_g_object_unref0 (self->call_state);
	_g_object_unref0 (self->calls);
	_g_object_unref0 (self->call);
	_xmpp_jid_unref0 (self->jid);
	_g_object_unref0 (self->session);
	_g_free0 (self->sid);
	_g_free0 (self->internal_id);
	_g_object_unref0 (self->audio_content_parameter);
	_g_object_unref0 (self->video_content_parameter);
	_g_object_unref0 (self->audio_content);
	_g_object_unref0 (self->video_content);
	_g_object_unref0 (self->video_encryption);
	_g_object_unref0 (self->audio_encryption);
	_g_object_unref0 (self->video_encryptions);
	_g_object_unref0 (self->audio_encryptions);
	_xmpp_xep_muji_group_call_unref0 (self->priv->_group_call);
	G_OBJECT_CLASS (dino_peer_state_parent_class)->finalize (obj);
}

static GType
dino_peer_state_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPeerStateClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_peer_state_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPeerState), 0, (GInstanceInitFunc) dino_peer_state_instance_init, NULL };
	GType dino_peer_state_type_id;
	dino_peer_state_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoPeerState", &g_define_type_info, 0);
	DinoPeerState_private_offset = g_type_add_instance_private (dino_peer_state_type_id, sizeof (DinoPeerStatePrivate));
	return dino_peer_state_type_id;
}

GType
dino_peer_state_get_type (void)
{
	static volatile gsize dino_peer_state_type_id__once = 0;
	if (g_once_init_enter (&dino_peer_state_type_id__once)) {
		GType dino_peer_state_type_id;
		dino_peer_state_type_id = dino_peer_state_get_type_once ();
		g_once_init_leave (&dino_peer_state_type_id__once, dino_peer_state_type_id);
	}
	return dino_peer_state_type_id__once;
}

static void
_vala_dino_peer_state_get_property (GObject * object,
                                    guint property_id,
                                    GValue * value,
                                    GParamSpec * pspec)
{
	DinoPeerState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_TYPE_PEER_STATE, DinoPeerState);
	switch (property_id) {
		case DINO_PEER_STATE_GROUP_CALL_PROPERTY:
		xmpp_xep_muji_value_set_group_call (value, dino_peer_state_get_group_call (self));
		break;
		case DINO_PEER_STATE_WE_SHOULD_SEND_AUDIO_PROPERTY:
		g_value_set_boolean (value, dino_peer_state_get_we_should_send_audio (self));
		break;
		case DINO_PEER_STATE_WE_SHOULD_SEND_VIDEO_PROPERTY:
		g_value_set_boolean (value, dino_peer_state_get_we_should_send_video (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_peer_state_set_property (GObject * object,
                                    guint property_id,
                                    const GValue * value,
                                    GParamSpec * pspec)
{
	DinoPeerState * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_TYPE_PEER_STATE, DinoPeerState);
	switch (property_id) {
		case DINO_PEER_STATE_GROUP_CALL_PROPERTY:
		dino_peer_state_set_group_call (self, xmpp_xep_muji_value_get_group_call (value));
		break;
		case DINO_PEER_STATE_WE_SHOULD_SEND_AUDIO_PROPERTY:
		dino_peer_state_set_we_should_send_audio (self, g_value_get_boolean (value));
		break;
		case DINO_PEER_STATE_WE_SHOULD_SEND_VIDEO_PROPERTY:
		dino_peer_state_set_we_should_send_video (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static inline gpointer
dino_peer_content_info_get_instance_private (DinoPeerContentInfo* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPeerContentInfo_private_offset);
}

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

static gpointer
__ulong_dup0 (gpointer self)
{
	return self ? _ulong_dup (self) : NULL;
}

DinoPeerContentInfo*
dino_peer_content_info_construct (GType object_type)
{
	DinoPeerContentInfo* self = NULL;
	self = (DinoPeerContentInfo*) g_type_create_instance (object_type);
	return self;
}

DinoPeerContentInfo*
dino_peer_content_info_new (void)
{
	return dino_peer_content_info_construct (DINO_TYPE_PEER_CONTENT_INFO);
}

gboolean
dino_peer_content_info_get_rtp_ready (DinoPeerContentInfo* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_rtp_ready;
	return result;
}

void
dino_peer_content_info_set_rtp_ready (DinoPeerContentInfo* self,
                                      gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_rtp_ready = value;
}

gboolean
dino_peer_content_info_get_rtcp_ready (DinoPeerContentInfo* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_rtcp_ready;
	return result;
}

void
dino_peer_content_info_set_rtcp_ready (DinoPeerContentInfo* self,
                                       gboolean value)
{
	g_return_if_fail (self != NULL);
	self->priv->_rtcp_ready = value;
}

gulong*
dino_peer_content_info_get_bytes_sent (DinoPeerContentInfo* self)
{
	gulong* result;
	gulong* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_bytes_sent;
	result = _tmp0_;
	return result;
}

void
dino_peer_content_info_set_bytes_sent (DinoPeerContentInfo* self,
                                       gulong* value)
{
	gulong* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = __ulong_dup0 (value);
	_g_free0 (self->priv->_bytes_sent);
	self->priv->_bytes_sent = _tmp0_;
}

gulong*
dino_peer_content_info_get_bytes_received (DinoPeerContentInfo* self)
{
	gulong* result;
	gulong* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_bytes_received;
	result = _tmp0_;
	return result;
}

void
dino_peer_content_info_set_bytes_received (DinoPeerContentInfo* self,
                                           gulong* value)
{
	gulong* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = __ulong_dup0 (value);
	_g_free0 (self->priv->_bytes_received);
	self->priv->_bytes_received = _tmp0_;
}

const gchar*
dino_peer_content_info_get_codec (DinoPeerContentInfo* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_codec;
	result = _tmp0_;
	return result;
}

void
dino_peer_content_info_set_codec (DinoPeerContentInfo* self,
                                  const gchar* value)
{
	gchar* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = g_strdup (value);
	_g_free0 (self->priv->_codec);
	self->priv->_codec = _tmp0_;
}

guint32
dino_peer_content_info_get_clockrate (DinoPeerContentInfo* self)
{
	guint32 result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_clockrate;
	return result;
}

void
dino_peer_content_info_set_clockrate (DinoPeerContentInfo* self,
                                      guint32 value)
{
	g_return_if_fail (self != NULL);
	self->priv->_clockrate = value;
}

guint
dino_peer_content_info_get_target_receive_bytes (DinoPeerContentInfo* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_target_receive_bytes;
	return result;
}

void
dino_peer_content_info_set_target_receive_bytes (DinoPeerContentInfo* self,
                                                 guint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_target_receive_bytes = value;
}

guint
dino_peer_content_info_get_target_send_bytes (DinoPeerContentInfo* self)
{
	guint result;
	g_return_val_if_fail (self != NULL, 0U);
	result = self->priv->_target_send_bytes;
	return result;
}

void
dino_peer_content_info_set_target_send_bytes (DinoPeerContentInfo* self,
                                              guint value)
{
	g_return_if_fail (self != NULL);
	self->priv->_target_send_bytes = value;
}

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

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

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

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

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

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

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

void
dino_value_set_peer_content_info (GValue* value,
                                  gpointer v_object)
{
	DinoPeerContentInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_PEER_CONTENT_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_TYPE_PEER_CONTENT_INFO));
		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;
		dino_peer_content_info_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dino_peer_content_info_unref (old);
	}
}

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

static void
dino_peer_content_info_class_init (DinoPeerContentInfoClass * klass,
                                   gpointer klass_data)
{
	dino_peer_content_info_parent_class = g_type_class_peek_parent (klass);
	((DinoPeerContentInfoClass *) klass)->finalize = dino_peer_content_info_finalize;
	g_type_class_adjust_private_offset (klass, &DinoPeerContentInfo_private_offset);
}

static void
dino_peer_content_info_instance_init (DinoPeerContentInfo * self,
                                      gpointer klass)
{
	gulong _tmp0_;
	gulong* _tmp1_;
	gulong _tmp2_;
	gulong* _tmp3_;
	self->priv = dino_peer_content_info_get_instance_private (self);
	_tmp0_ = (gulong) 0;
	_tmp1_ = __ulong_dup0 (&_tmp0_);
	self->priv->_bytes_sent = _tmp1_;
	_tmp2_ = (gulong) 0;
	_tmp3_ = __ulong_dup0 (&_tmp2_);
	self->priv->_bytes_received = _tmp3_;
	self->priv->_target_receive_bytes = (guint) -1;
	self->priv->_target_send_bytes = (guint) -1;
	self->ref_count = 1;
}

static void
dino_peer_content_info_finalize (DinoPeerContentInfo * obj)
{
	DinoPeerContentInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_PEER_CONTENT_INFO, DinoPeerContentInfo);
	g_signal_handlers_destroy (self);
	_g_free0 (self->priv->_bytes_sent);
	_g_free0 (self->priv->_bytes_received);
	_g_free0 (self->priv->_codec);
}

static GType
dino_peer_content_info_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { dino_value_peer_content_info_init, dino_value_peer_content_info_free_value, dino_value_peer_content_info_copy_value, dino_value_peer_content_info_peek_pointer, "p", dino_value_peer_content_info_collect_value, "p", dino_value_peer_content_info_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (DinoPeerContentInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_peer_content_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPeerContentInfo), 0, (GInstanceInitFunc) dino_peer_content_info_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 dino_peer_content_info_type_id;
	dino_peer_content_info_type_id = g_type_register_fundamental (g_type_fundamental_next (), "DinoPeerContentInfo", &g_define_type_info, &g_define_type_fundamental_info, 0);
	DinoPeerContentInfo_private_offset = g_type_add_instance_private (dino_peer_content_info_type_id, sizeof (DinoPeerContentInfoPrivate));
	return dino_peer_content_info_type_id;
}

GType
dino_peer_content_info_get_type (void)
{
	static volatile gsize dino_peer_content_info_type_id__once = 0;
	if (g_once_init_enter (&dino_peer_content_info_type_id__once)) {
		GType dino_peer_content_info_type_id;
		dino_peer_content_info_type_id = dino_peer_content_info_get_type_once ();
		g_once_init_leave (&dino_peer_content_info_type_id__once, dino_peer_content_info_type_id);
	}
	return dino_peer_content_info_type_id__once;
}

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

void
dino_peer_content_info_unref (gpointer instance)
{
	DinoPeerContentInfo * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		DINO_PEER_CONTENT_INFO_GET_CLASS (self)->finalize (self);
		g_type_free_instance ((GTypeInstance *) self);
	}
}

DinoPeerInfo*
dino_peer_info_construct (GType object_type)
{
	DinoPeerInfo* self = NULL;
	self = (DinoPeerInfo*) g_type_create_instance (object_type);
	return self;
}

DinoPeerInfo*
dino_peer_info_new (void)
{
	return dino_peer_info_construct (DINO_TYPE_PEER_INFO);
}

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

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

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

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

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

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

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

void
dino_value_set_peer_info (GValue* value,
                          gpointer v_object)
{
	DinoPeerInfo * old;
	g_return_if_fail (G_TYPE_CHECK_VALUE_TYPE (value, DINO_TYPE_PEER_INFO));
	old = value->data[0].v_pointer;
	if (v_object) {
		g_return_if_fail (G_TYPE_CHECK_INSTANCE_TYPE (v_object, DINO_TYPE_PEER_INFO));
		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;
		dino_peer_info_ref (value->data[0].v_pointer);
	} else {
		value->data[0].v_pointer = NULL;
	}
	if (old) {
		dino_peer_info_unref (old);
	}
}

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

static void
dino_peer_info_class_init (DinoPeerInfoClass * klass,
                           gpointer klass_data)
{
	dino_peer_info_parent_class = g_type_class_peek_parent (klass);
	((DinoPeerInfoClass *) klass)->finalize = dino_peer_info_finalize;
}

static void
dino_peer_info_instance_init (DinoPeerInfo * self,
                              gpointer klass)
{
	self->audio = NULL;
	self->video = NULL;
	self->ref_count = 1;
}

static void
dino_peer_info_finalize (DinoPeerInfo * obj)
{
	DinoPeerInfo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_TYPE_PEER_INFO, DinoPeerInfo);
	g_signal_handlers_destroy (self);
	_dino_peer_content_info_unref0 (self->audio);
	_dino_peer_content_info_unref0 (self->video);
}

static GType
dino_peer_info_get_type_once (void)
{
	static const GTypeValueTable g_define_type_value_table = { dino_value_peer_info_init, dino_value_peer_info_free_value, dino_value_peer_info_copy_value, dino_value_peer_info_peek_pointer, "p", dino_value_peer_info_collect_value, "p", dino_value_peer_info_lcopy_value };
	static const GTypeInfo g_define_type_info = { sizeof (DinoPeerInfoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_peer_info_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPeerInfo), 0, (GInstanceInitFunc) dino_peer_info_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 dino_peer_info_type_id;
	dino_peer_info_type_id = g_type_register_fundamental (g_type_fundamental_next (), "DinoPeerInfo", &g_define_type_info, &g_define_type_fundamental_info, 0);
	return dino_peer_info_type_id;
}

GType
dino_peer_info_get_type (void)
{
	static volatile gsize dino_peer_info_type_id__once = 0;
	if (g_once_init_enter (&dino_peer_info_type_id__once)) {
		GType dino_peer_info_type_id;
		dino_peer_info_type_id = dino_peer_info_get_type_once ();
		g_once_init_leave (&dino_peer_info_type_id__once, dino_peer_info_type_id);
	}
	return dino_peer_info_type_id__once;
}

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

void
dino_peer_info_unref (gpointer instance)
{
	DinoPeerInfo * self;
	self = instance;
	if (g_atomic_int_dec_and_test (&self->ref_count)) {
		DINO_PEER_INFO_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;
}

