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

#include "rtp.h"
#include "libdino.h"
#include <gst/gst.h>
#include <gee.h>
#include <glib-object.h>
#include <glib.h>
#include <gio/gio.h>
#include "xmpp-vala.h"
#include <stdlib.h>
#include <string.h>

#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

enum  {
	DINO_PLUGINS_RTP_PLUGIN_0_PROPERTY,
	DINO_PLUGINS_RTP_PLUGIN_APP_PROPERTY,
	DINO_PLUGINS_RTP_PLUGIN_CODEC_UTIL_PROPERTY,
	DINO_PLUGINS_RTP_PLUGIN_DEVICE_MONITOR_PROPERTY,
	DINO_PLUGINS_RTP_PLUGIN_PIPE_PROPERTY,
	DINO_PLUGINS_RTP_PLUGIN_RTPBIN_PROPERTY,
	DINO_PLUGINS_RTP_PLUGIN_ECHOPROBE_PROPERTY,
	DINO_PLUGINS_RTP_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _dino_plugins_rtp_codec_util_unref0(var) ((var == NULL) ? NULL : (var = (dino_plugins_rtp_codec_util_unref (var), NULL)))
typedef struct _Block6Data Block6Data;
#define _gst_structure_free0(var) ((var == NULL) ? NULL : (var = (gst_structure_free (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
#define _gst_query_unref0(var) ((var == NULL) ? NULL : (var = (gst_query_unref (var), NULL)))
typedef struct _Block7Data Block7Data;
typedef struct _Block8Data Block8Data;
typedef struct _Block9Data Block9Data;
#define _gst_caps_unref0(var) ((var == NULL) ? NULL : (var = (gst_caps_unref (var), NULL)))

struct _DinoPluginsRtpPluginPrivate {
	DinoApplication* _app;
	DinoPluginsRtpCodecUtil* _codec_util;
	GstDeviceMonitor* _device_monitor;
	GstPipeline* _pipe;
	GstBin* _rtpbin;
	GstElement* _echoprobe;
	GeeList* streams;
	GeeList* devices;
	gint64 last_devices_refresh;
	gint pause_count;
};

struct _Block6Data {
	int _ref_count_;
	DinoPluginsRtpPlugin* self;
	GstDevice* device;
};

struct _Block7Data {
	int _ref_count_;
	DinoPluginsRtpPlugin* self;
	GstDevice* old_gst_device;
	GstDevice* gst_device;
};

struct _Block8Data {
	int _ref_count_;
	DinoPluginsRtpPlugin* self;
	guint8 rtpid;
};

struct _Block9Data {
	int _ref_count_;
	DinoPluginsRtpPlugin* self;
	gchar* media;
	gboolean incoming;
};

static gint DinoPluginsRtpPlugin_private_offset;
static gpointer dino_plugins_rtp_plugin_parent_class = NULL;
static DinoPluginsRootInterfaceIface * dino_plugins_rtp_plugin_dino_plugins_root_interface_parent_iface = NULL;
static DinoPluginsVideoCallPluginIface * dino_plugins_rtp_plugin_dino_plugins_video_call_plugin_parent_iface = NULL;

static void dino_plugins_rtp_plugin_real_registered (DinoPluginsRootInterface* base,
                                              DinoApplication* app);
static void dino_plugins_rtp_plugin_set_app (DinoPluginsRtpPlugin* self,
                                      DinoApplication* value);
static void dino_plugins_rtp_plugin_set_codec_util (DinoPluginsRtpPlugin* self,
                                             DinoPluginsRtpCodecUtil* value);
static void __lambda15_ (DinoPluginsRtpPlugin* self,
                  DinoEntitiesAccount* account,
                  GeeArrayList* list);
static void ___lambda15__dino_module_manager_initialize_account_modules (DinoModuleManager* _sender,
                                                                  DinoEntitiesAccount* account,
                                                                  GeeArrayList* modules,
                                                                  gpointer self);
static void dino_plugins_rtp_plugin_handle_existing_devices (DinoPluginsRtpPlugin* self,
                                                      GstDeviceMonitor* device_monitor);
static Block6Data* block6_data_ref (Block6Data* _data6_);
static void block6_data_unref (void * _userdata_);
static gboolean ____lambda23_ (Block6Data* _data6_,
                        DinoPluginsRtpDevice* it);
static gboolean _____lambda23__gee_predicate (gconstpointer g,
                                       gpointer self);
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
static void dino_plugins_rtp_plugin_refresh_devices (DinoPluginsRtpPlugin* self);
static void dino_plugins_rtp_plugin_start_device_monitor (DinoPluginsRtpPlugin* self);
static void dino_plugins_rtp_plugin_set_device_monitor (DinoPluginsRtpPlugin* self,
                                                 GstDeviceMonitor* value);
static gboolean dino_plugins_rtp_plugin_on_device_monitor_message (DinoPluginsRtpPlugin* self,
                                                            GstBus* bus,
                                                            GstMessage* message);
static gboolean _dino_plugins_rtp_plugin_on_device_monitor_message_gst_bus_func (GstBus* bus,
                                                                          GstMessage* message,
                                                                          gpointer self);
static void dino_plugins_rtp_plugin_stop_device_monitor (DinoPluginsRtpPlugin* self);
static void dino_plugins_rtp_plugin_init_call_pipe (DinoPluginsRtpPlugin* self);
static void dino_plugins_rtp_plugin_set_pipe (DinoPluginsRtpPlugin* self,
                                       GstPipeline* value);
static void dino_plugins_rtp_plugin_set_rtpbin (DinoPluginsRtpPlugin* self,
                                         GstBin* value);
static void dino_plugins_rtp_plugin_on_rtp_pad_added (DinoPluginsRtpPlugin* self,
                                               GstPad* pad);
static void _dino_plugins_rtp_plugin_on_rtp_pad_added_gst_element_pad_added (GstElement* _sender,
                                                                      GstPad* pad,
                                                                      gpointer self);
static GstCaps* dino_plugins_rtp_plugin_request_pt_map (GstElement* rtpbin,
                                                 guint session,
                                                 guint pt,
                                                 DinoPluginsRtpPlugin* plugin);
static void dino_plugins_rtp_plugin_set_echoprobe (DinoPluginsRtpPlugin* self,
                                            GstElement* value);
static gboolean __lambda24_ (DinoPluginsRtpPlugin* self,
                      GstBus* _,
                      GstMessage* message);
static void dino_plugins_rtp_plugin_on_pipe_bus_message (DinoPluginsRtpPlugin* self,
                                                  GstMessage* message);
static gboolean ___lambda24__gst_bus_func (GstBus* bus,
                                    GstMessage* message,
                                    gpointer self);
static void dino_plugins_rtp_plugin_destroy_call_pipe (DinoPluginsRtpPlugin* self);
static Block7Data* block7_data_ref (Block7Data* _data7_);
static void block7_data_unref (void * _userdata_);
static gboolean ___lambda20_ (Block7Data* _data7_,
                       DinoPluginsRtpDevice* it);
static gboolean ____lambda20__gee_predicate (gconstpointer g,
                                      gpointer self);
static gboolean ___lambda21_ (Block7Data* _data7_,
                       DinoPluginsRtpDevice* it);
static gboolean ____lambda21__gee_predicate (gconstpointer g,
                                      gpointer self);
static gboolean ___lambda22_ (Block7Data* _data7_,
                       DinoPluginsRtpDevice* it);
static gboolean ____lambda22__gee_predicate (gconstpointer g,
                                      gpointer self);
static Block8Data* block8_data_ref (Block8Data* _data8_);
static void block8_data_unref (void * _userdata_);
static gboolean ____lambda4_ (Block8Data* _data8_,
                       DinoPluginsRtpStream* stream);
static gboolean _____lambda4__gee_predicate (gconstpointer g,
                                      gpointer self);
static void dino_plugins_rtp_plugin_real_shutdown (DinoPluginsRootInterface* base);
static gboolean dino_plugins_rtp_plugin_real_supported (DinoPluginsVideoCallPlugin* base);
static DinoPluginsVideoCallWidget* dino_plugins_rtp_plugin_real_create_widget (DinoPluginsVideoCallPlugin* base,
                                                                        DinoPluginsWidgetType type);
static GeeList* dino_plugins_rtp_plugin_real_get_devices (DinoPluginsVideoCallPlugin* base,
                                                   const gchar* media,
                                                   gboolean incoming);
static Block9Data* block9_data_ref (Block9Data* _data9_);
static void block9_data_unref (void * _userdata_);
static gboolean ____lambda27_ (Block9Data* _data9_,
                        DinoPluginsRtpDevice* it);
static gboolean _____lambda27__gee_predicate (gconstpointer g,
                                       gpointer self);
static gint __lambda28_ (DinoPluginsRtpPlugin* self,
                  DinoPluginsMediaDevice* media_left,
                  DinoPluginsMediaDevice* media_right);
static gint ___lambda28__gcompare_data_func (gconstpointer a,
                                      gconstpointer b,
                                      gpointer self);
static gint dino_plugins_rtp_plugin_get_max_fps (DinoPluginsRtpPlugin* self,
                                          DinoPluginsRtpDevice* device);
static DinoPluginsMediaDevice* dino_plugins_rtp_plugin_real_get_preferred_device (DinoPluginsVideoCallPlugin* base,
                                                                           const gchar* media,
                                                                           gboolean incoming);
static DinoPluginsMediaDevice* dino_plugins_rtp_plugin_real_get_device (DinoPluginsVideoCallPlugin* base,
                                                                 XmppXepJingleRtpStream* stream,
                                                                 gboolean incoming);
static void dino_plugins_rtp_plugin_real_dump_dot (DinoPluginsVideoCallPlugin* base);
static void dino_plugins_rtp_plugin_real_set_pause (DinoPluginsVideoCallPlugin* base,
                                             XmppXepJingleRtpStream* stream,
                                             gboolean pause);
static void dino_plugins_rtp_plugin_real_set_device (DinoPluginsVideoCallPlugin* base,
                                              XmppXepJingleRtpStream* stream,
                                              DinoPluginsMediaDevice* device);
static void dino_plugins_rtp_plugin_finalize (GObject * obj);
static GType dino_plugins_rtp_plugin_get_type_once (void);
static void _vala_dino_plugins_rtp_plugin_get_property (GObject * object,
                                                 guint property_id,
                                                 GValue * value,
                                                 GParamSpec * pspec);
static void _vala_dino_plugins_rtp_plugin_set_property (GObject * object,
                                                 guint property_id,
                                                 const GValue * value,
                                                 GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gssize array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gssize array_length,
                       GDestroyNotify destroy_func);
static gssize _vala_array_length (gpointer array);

static inline gpointer
dino_plugins_rtp_plugin_get_instance_private (DinoPluginsRtpPlugin* self)
{
	return G_STRUCT_MEMBER_P (self, DinoPluginsRtpPlugin_private_offset);
}

static void
__lambda15_ (DinoPluginsRtpPlugin* self,
             DinoEntitiesAccount* account,
             GeeArrayList* list)
{
	DinoPluginsRtpModule* _tmp0_;
	DinoPluginsRtpModule* _tmp1_;
	g_return_if_fail (account != NULL);
	g_return_if_fail (list != NULL);
	_tmp0_ = dino_plugins_rtp_module_new (self);
	_tmp1_ = _tmp0_;
	gee_abstract_collection_add ((GeeAbstractCollection*) list, (XmppXmppStreamModule*) _tmp1_);
	_g_object_unref0 (_tmp1_);
}

static void
___lambda15__dino_module_manager_initialize_account_modules (DinoModuleManager* _sender,
                                                             DinoEntitiesAccount* account,
                                                             GeeArrayList* modules,
                                                             gpointer self)
{
	__lambda15_ ((DinoPluginsRtpPlugin*) self, account, modules);
}

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

static void
dino_plugins_rtp_plugin_real_registered (DinoPluginsRootInterface* base,
                                         DinoApplication* app)
{
	DinoPluginsRtpPlugin * self;
	DinoPluginsRtpCodecUtil* _tmp0_;
	DinoPluginsRtpCodecUtil* _tmp1_;
	GOptionGroup* _tmp2_;
	DinoStreamInteractor* _tmp3_;
	DinoStreamInteractor* _tmp4_;
	DinoModuleManager* _tmp5_;
	DinoPluginsRegistry* _tmp6_;
	DinoPluginsRegistry* _tmp7_;
	DinoPluginsVideoCallPlugin* _tmp8_;
	self = (DinoPluginsRtpPlugin*) base;
	g_return_if_fail (app != NULL);
	dino_plugins_rtp_plugin_set_app (self, app);
	_tmp0_ = dino_plugins_rtp_codec_util_new ();
	_tmp1_ = _tmp0_;
	dino_plugins_rtp_plugin_set_codec_util (self, _tmp1_);
	_dino_plugins_rtp_codec_util_unref0 (_tmp1_);
	_tmp2_ = gst_init_get_option_group ();
	g_application_add_option_group ((GApplication*) app, _tmp2_);
	_tmp3_ = dino_application_get_stream_interactor (app);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_->module_manager;
	g_signal_connect_object (_tmp5_, "initialize-account-modules", (GCallback) ___lambda15__dino_module_manager_initialize_account_modules, self, 0);
	_tmp6_ = dino_application_get_plugin_registry (app);
	_tmp7_ = _tmp6_;
	_tmp8_ = _g_object_ref0 ((DinoPluginsVideoCallPlugin*) self);
	_g_object_unref0 (_tmp7_->video_call_plugin);
	_tmp7_->video_call_plugin = _tmp8_;
}

void
dino_plugins_rtp_plugin_pause (DinoPluginsRtpPlugin* self)
{
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->pause_count;
	self->priv->pause_count = _tmp0_ + 1;
}

void
dino_plugins_rtp_plugin_unpause (DinoPluginsRtpPlugin* self)
{
	gint _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->pause_count;
	self->priv->pause_count = _tmp0_ - 1;
	if (self->priv->pause_count == 0) {
		GstPipeline* _tmp1_;
		g_debug ("plugin.vala:39: Continue pipe after modifications");
		_tmp1_ = self->priv->_pipe;
		gst_element_set_state ((GstElement*) _tmp1_, GST_STATE_PLAYING);
	}
	if (self->priv->pause_count < 0) {
		g_warning ("plugin.vala:42: Pause count below zero!");
	}
}

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_)) {
		DinoPluginsRtpPlugin* self;
		self = _data6_->self;
		_g_object_unref0 (_data6_->device);
		_g_object_unref0 (self);
		g_slice_free (Block6Data, _data6_);
	}
}

static gboolean
____lambda23_ (Block6Data* _data6_,
               DinoPluginsRtpDevice* it)
{
	DinoPluginsRtpPlugin* self;
	GstDevice* _tmp0_;
	gboolean result;
	self = _data6_->self;
	g_return_val_if_fail (it != NULL, FALSE);
	_tmp0_ = _data6_->device;
	result = dino_plugins_rtp_device_matches (it, _tmp0_);
	return result;
}

static gboolean
_____lambda23__gee_predicate (gconstpointer g,
                              gpointer self)
{
	gboolean result;
	result = ____lambda23_ (self, (DinoPluginsRtpDevice*) g);
	return result;
}

static void
_g_object_unref0_ (gpointer var)
{
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}

static inline void
_g_list_free__g_object_unref0_ (GList* self)
{
	g_list_free_full (self, (GDestroyNotify) _g_object_unref0_);
}

static void
dino_plugins_rtp_plugin_handle_existing_devices (DinoPluginsRtpPlugin* self,
                                                 GstDeviceMonitor* device_monitor)
{
	GeeArrayList* new_devices = NULL;
	GeeArrayList* _tmp0_;
	GList* _tmp1_;
	GeeList* _tmp34_;
	GeeArrayList* _tmp35_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (device_monitor != NULL);
	_tmp0_ = gee_array_list_new (DINO_PLUGINS_RTP_TYPE_DEVICE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	new_devices = _tmp0_;
	_tmp1_ = gst_device_monitor_get_devices (device_monitor);
	{
		GList* device_collection = NULL;
		GList* device_it = NULL;
		device_collection = _tmp1_;
		for (device_it = device_collection; device_it != NULL; device_it = device_it->next) {
			GstDevice* _tmp2_;
			GstDevice* device = NULL;
			_tmp2_ = _g_object_ref0 ((GstDevice*) device_it->data);
			device = _tmp2_;
			{
				Block6Data* _data6_;
				GstDevice* _tmp3_;
				GstStructure* _tmp4_;
				GstStructure* _tmp5_;
				GstStructure* _tmp6_;
				gboolean _tmp7_;
				gboolean _tmp8_ = FALSE;
				GstDevice* _tmp9_;
				GstStructure* _tmp10_;
				GstStructure* _tmp11_;
				GstStructure* _tmp12_;
				gboolean _tmp13_;
				GstDevice* _tmp15_;
				GstStructure* _tmp16_;
				GstStructure* _tmp17_;
				GstStructure* _tmp18_;
				const gchar* _tmp19_;
				gboolean _tmp20_;
				DinoPluginsRtpDevice* pre_device = NULL;
				GeeList* _tmp21_;
				gpointer _tmp22_;
				DinoPluginsRtpDevice* _tmp23_;
				DinoPluginsRtpDevice* new_device = NULL;
				GstDevice* _tmp28_;
				DinoPluginsRtpDevice* _tmp29_;
				GeeList* _tmp30_;
				DinoPluginsRtpDevice* _tmp31_;
				GeeArrayList* _tmp32_;
				DinoPluginsRtpDevice* _tmp33_;
				_data6_ = g_slice_new0 (Block6Data);
				_data6_->_ref_count_ = 1;
				_data6_->self = g_object_ref (self);
				_data6_->device = device;
				_tmp3_ = _data6_->device;
				_tmp4_ = gst_device_get_properties (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = _tmp5_;
				_tmp7_ = _tmp6_ == NULL;
				_gst_structure_free0 (_tmp6_);
				if (_tmp7_) {
					block6_data_unref (_data6_);
					_data6_ = NULL;
					continue;
				}
				_tmp9_ = _data6_->device;
				_tmp10_ = gst_device_get_properties (_tmp9_);
				_tmp11_ = _tmp10_;
				_tmp12_ = _tmp11_;
				_tmp13_ = gst_structure_has_name (_tmp12_, "pipewire-proplist");
				_gst_structure_free0 (_tmp12_);
				if (_tmp13_) {
					GstDevice* _tmp14_;
					_tmp14_ = _data6_->device;
					_tmp8_ = gst_device_has_classes (_tmp14_, "Audio");
				} else {
					_tmp8_ = FALSE;
				}
				if (_tmp8_) {
					block6_data_unref (_data6_);
					_data6_ = NULL;
					continue;
				}
				_tmp15_ = _data6_->device;
				_tmp16_ = gst_device_get_properties (_tmp15_);
				_tmp17_ = _tmp16_;
				_tmp18_ = _tmp17_;
				_tmp19_ = gst_structure_get_string (_tmp18_, "device.class");
				_tmp20_ = g_strcmp0 (_tmp19_, "monitor") == 0;
				_gst_structure_free0 (_tmp18_);
				if (_tmp20_) {
					block6_data_unref (_data6_);
					_data6_ = NULL;
					continue;
				}
				_tmp21_ = self->priv->devices;
				_tmp22_ = gee_traversable_first_match ((GeeTraversable*) _tmp21_, _____lambda23__gee_predicate, block6_data_ref (_data6_), block6_data_unref);
				pre_device = (DinoPluginsRtpDevice*) _tmp22_;
				_tmp23_ = pre_device;
				if (_tmp23_ != NULL) {
					GeeArrayList* _tmp24_;
					DinoPluginsRtpDevice* _tmp25_;
					_tmp24_ = new_devices;
					_tmp25_ = pre_device;
					if (!gee_abstract_collection_contains ((GeeAbstractCollection*) _tmp24_, _tmp25_)) {
						GeeArrayList* _tmp26_;
						DinoPluginsRtpDevice* _tmp27_;
						_tmp26_ = new_devices;
						_tmp27_ = pre_device;
						gee_abstract_collection_add ((GeeAbstractCollection*) _tmp26_, _tmp27_);
					}
					_g_object_unref0 (pre_device);
					block6_data_unref (_data6_);
					_data6_ = NULL;
					continue;
				}
				_tmp28_ = _data6_->device;
				_tmp29_ = dino_plugins_rtp_device_new (self, _tmp28_);
				new_device = _tmp29_;
				_tmp30_ = self->priv->devices;
				_tmp31_ = new_device;
				gee_collection_add ((GeeCollection*) _tmp30_, _tmp31_);
				_tmp32_ = new_devices;
				_tmp33_ = new_device;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp32_, _tmp33_);
				_g_object_unref0 (new_device);
				_g_object_unref0 (pre_device);
				block6_data_unref (_data6_);
				_data6_ = NULL;
			}
		}
		(device_collection == NULL) ? NULL : (device_collection = (_g_list_free__g_object_unref0_ (device_collection), NULL));
	}
	_tmp34_ = self->priv->devices;
	_tmp35_ = new_devices;
	gee_collection_retain_all ((GeeCollection*) _tmp34_, (GeeCollection*) _tmp35_);
	_g_object_unref0 (new_devices);
}

static void
dino_plugins_rtp_plugin_refresh_devices (DinoPluginsRtpPlugin* self)
{
	GstDeviceMonitor* _tmp0_;
	gboolean _tmp1_ = FALSE;
	GstDeviceMonitor* device_monitor = NULL;
	GstDeviceMonitor* _tmp2_;
	GstDeviceMonitor* _tmp3_;
	GstDeviceMonitor* _tmp4_;
	GstDeviceMonitor* _tmp5_;
	GstDeviceMonitor* _tmp6_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_device_monitor;
	if (_tmp0_ != NULL) {
		return;
	}
	if (self->priv->last_devices_refresh > ((gint64) 0)) {
		_tmp1_ = (self->priv->last_devices_refresh + 5000000) > g_get_monotonic_time ();
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		return;
	}
	_tmp2_ = gst_device_monitor_new ();
	g_object_ref_sink (_tmp2_);
	device_monitor = _tmp2_;
	_tmp3_ = device_monitor;
	g_object_set (_tmp3_, "show-all", TRUE, NULL);
	_tmp4_ = device_monitor;
	gst_device_monitor_start (_tmp4_);
	_tmp5_ = device_monitor;
	dino_plugins_rtp_plugin_handle_existing_devices (self, _tmp5_);
	_tmp6_ = device_monitor;
	gst_device_monitor_stop (_tmp6_);
	self->priv->last_devices_refresh = g_get_monotonic_time ();
	_g_object_unref0 (device_monitor);
}

static gboolean
_dino_plugins_rtp_plugin_on_device_monitor_message_gst_bus_func (GstBus* bus,
                                                                 GstMessage* message,
                                                                 gpointer self)
{
	gboolean result;
	result = dino_plugins_rtp_plugin_on_device_monitor_message ((DinoPluginsRtpPlugin*) self, bus, message);
	return result;
}

static void
dino_plugins_rtp_plugin_start_device_monitor (DinoPluginsRtpPlugin* self)
{
	GstDeviceMonitor* _tmp0_;
	GstDeviceMonitor* _tmp1_;
	GstDeviceMonitor* _tmp2_;
	GstDeviceMonitor* _tmp3_;
	GstDeviceMonitor* _tmp4_;
	GstBus* _tmp5_;
	GstBus* _tmp6_;
	GstDeviceMonitor* _tmp7_;
	GstDeviceMonitor* _tmp8_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_device_monitor;
	if (_tmp0_ != NULL) {
		return;
	}
	_tmp1_ = gst_device_monitor_new ();
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	dino_plugins_rtp_plugin_set_device_monitor (self, _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = self->priv->_device_monitor;
	g_object_set (_tmp3_, "show-all", TRUE, NULL);
	_tmp4_ = self->priv->_device_monitor;
	_tmp5_ = gst_device_monitor_get_bus (_tmp4_);
	_tmp6_ = _tmp5_;
	gst_bus_add_watch_full (_tmp6_, (gint) DINO_PLUGINS_PRIORITY_DEFAULT, _dino_plugins_rtp_plugin_on_device_monitor_message_gst_bus_func, g_object_ref (self), g_object_unref);
	_g_object_unref0 (_tmp6_);
	_tmp7_ = self->priv->_device_monitor;
	gst_device_monitor_start (_tmp7_);
	_tmp8_ = self->priv->_device_monitor;
	dino_plugins_rtp_plugin_handle_existing_devices (self, _tmp8_);
}

static void
dino_plugins_rtp_plugin_stop_device_monitor (DinoPluginsRtpPlugin* self)
{
	GstDeviceMonitor* _tmp0_;
	GstDeviceMonitor* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_device_monitor;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->_device_monitor;
	gst_device_monitor_stop (_tmp1_);
	dino_plugins_rtp_plugin_set_device_monitor (self, NULL);
}

static void
_dino_plugins_rtp_plugin_on_rtp_pad_added_gst_element_pad_added (GstElement* _sender,
                                                                 GstPad* pad,
                                                                 gpointer self)
{
	dino_plugins_rtp_plugin_on_rtp_pad_added ((DinoPluginsRtpPlugin*) self, pad);
}

static gboolean
__lambda24_ (DinoPluginsRtpPlugin* self,
             GstBus* _,
             GstMessage* message)
{
	gboolean result;
	g_return_val_if_fail (_ != NULL, FALSE);
	g_return_val_if_fail (message != NULL, FALSE);
	dino_plugins_rtp_plugin_on_pipe_bus_message (self, message);
	result = TRUE;
	return result;
}

static gboolean
___lambda24__gst_bus_func (GstBus* bus,
                           GstMessage* message,
                           gpointer self)
{
	gboolean result;
	result = __lambda24_ ((DinoPluginsRtpPlugin*) self, bus, message);
	return result;
}

static void
dino_plugins_rtp_plugin_init_call_pipe (DinoPluginsRtpPlugin* self)
{
	GstPipeline* _tmp0_;
	GstPipeline* _tmp1_;
	GstPipeline* _tmp2_;
	GstElement* _tmp3_;
	GstBin* _tmp4_;
	GstBin* _tmp5_;
	GstBin* _tmp6_;
	GstBin* _tmp7_;
	GstBin* _tmp8_;
	GstBin* _tmp9_;
	GstBin* _tmp10_;
	GstBin* _tmp11_;
	GstPipeline* _tmp12_;
	GstBin* _tmp13_;
	DinoPluginsRtpEchoProbe* _tmp14_;
	DinoPluginsRtpEchoProbe* _tmp15_;
	GstElement* _tmp16_;
	GstPipeline* _tmp19_;
	GstPipeline* _tmp20_;
	GstBus* _tmp21_;
	GstPipeline* _tmp22_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_pipe;
	if (_tmp0_ != NULL) {
		return;
	}
	g_debug ("plugin.vala:91: Creating call pipe.");
	dino_plugins_rtp_plugin_start_device_monitor (self);
	_tmp1_ = (GstPipeline*) gst_pipeline_new (NULL);
	g_object_ref_sink (_tmp1_);
	_tmp2_ = _tmp1_;
	dino_plugins_rtp_plugin_set_pipe (self, _tmp2_);
	_g_object_unref0 (_tmp2_);
	_tmp3_ = gst_element_factory_make ("rtpbin", NULL);
	_tmp4_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp3_, gst_bin_get_type ()) ? ((GstBin*) _tmp3_) : NULL;
	if (_tmp4_ == NULL) {
		_g_object_unref0 (_tmp3_);
	}
	if (_tmp4_ != NULL) {
		g_object_ref_sink (_tmp4_);
	}
	_tmp5_ = _tmp4_;
	dino_plugins_rtp_plugin_set_rtpbin (self, _tmp5_);
	_g_object_unref0 (_tmp5_);
	_tmp6_ = self->priv->_rtpbin;
	if (_tmp6_ == NULL) {
		g_warning ("plugin.vala:98: RTP not supported");
		dino_plugins_rtp_plugin_set_pipe (self, NULL);
		return;
	}
	_tmp7_ = self->priv->_rtpbin;
	g_signal_connect_object ((GstElement*) _tmp7_, "pad-added", (GCallback) _dino_plugins_rtp_plugin_on_rtp_pad_added_gst_element_pad_added, self, 0);
	_tmp8_ = self->priv->_rtpbin;
	gst_child_proxy_set ((GstChildProxy*) _tmp8_, "latency", 100, NULL);
	_tmp9_ = self->priv->_rtpbin;
	gst_child_proxy_set ((GstChildProxy*) _tmp9_, "do-lost", TRUE, NULL);
	_tmp10_ = self->priv->_rtpbin;
	gst_child_proxy_set ((GstChildProxy*) _tmp10_, "drop-on-latency", TRUE, NULL);
	_tmp11_ = self->priv->_rtpbin;
	g_object_connect ((GObject*) _tmp11_, "signal::request-pt-map", dino_plugins_rtp_plugin_request_pt_map, self, NULL);
	_tmp12_ = self->priv->_pipe;
	_tmp13_ = self->priv->_rtpbin;
	gst_bin_add ((GstBin*) _tmp12_, (GstElement*) _tmp13_);
	_tmp14_ = dino_plugins_rtp_echo_probe_new ();
	g_object_ref_sink (_tmp14_);
	_tmp15_ = _tmp14_;
	dino_plugins_rtp_plugin_set_echoprobe (self, (GstElement*) _tmp15_);
	_g_object_unref0 (_tmp15_);
	_tmp16_ = self->priv->_echoprobe;
	if (_tmp16_ != NULL) {
		GstPipeline* _tmp17_;
		GstElement* _tmp18_;
		_tmp17_ = self->priv->_pipe;
		_tmp18_ = self->priv->_echoprobe;
		gst_bin_add ((GstBin*) _tmp17_, _tmp18_);
	}
	_tmp19_ = self->priv->_pipe;
	gst_pipeline_set_auto_flush_bus (_tmp19_, TRUE);
	_tmp20_ = self->priv->_pipe;
	_tmp21_ = ((GstElement*) _tmp20_)->bus;
	gst_bus_add_watch_full (_tmp21_, G_PRIORITY_DEFAULT, ___lambda24__gst_bus_func, g_object_ref (self), g_object_unref);
	_tmp22_ = self->priv->_pipe;
	gst_element_set_state ((GstElement*) _tmp22_, GST_STATE_PLAYING);
}

void
dino_plugins_rtp_plugin_destroy_call_pipe_if_unused (DinoPluginsRtpPlugin* self)
{
	gboolean _tmp0_ = FALSE;
	GeeList* _tmp1_;
	gboolean _tmp2_;
	gboolean _tmp3_;
	g_return_if_fail (self != NULL);
	_tmp1_ = self->priv->streams;
	_tmp2_ = gee_collection_get_is_empty ((GeeCollection*) _tmp1_);
	_tmp3_ = _tmp2_;
	if (_tmp3_) {
		_tmp0_ = !dino_plugins_rtp_video_widget_has_instances ();
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		dino_plugins_rtp_plugin_destroy_call_pipe (self);
	}
}

static void
dino_plugins_rtp_plugin_destroy_call_pipe (DinoPluginsRtpPlugin* self)
{
	GstPipeline* _tmp0_;
	GstPipeline* _tmp1_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->_pipe;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->_pipe;
	gst_element_set_state ((GstElement*) _tmp1_, GST_STATE_NULL);
	dino_plugins_rtp_plugin_set_rtpbin (self, NULL);
	dino_plugins_rtp_plugin_set_echoprobe (self, NULL);
	dino_plugins_rtp_plugin_set_pipe (self, NULL);
	dino_plugins_rtp_plugin_stop_device_monitor (self);
	g_debug ("plugin.vala:140: Call pipe destroyed");
}

static GstCaps*
dino_plugins_rtp_plugin_request_pt_map (GstElement* rtpbin,
                                        guint session,
                                        guint pt,
                                        DinoPluginsRtpPlugin* plugin)
{
	GstCaps* result;
	g_return_val_if_fail (rtpbin != NULL, NULL);
	g_return_val_if_fail (plugin != NULL, NULL);
	g_debug ("plugin.vala:144: request-pt-map");
	result = NULL;
	return result;
}

static void
dino_plugins_rtp_plugin_on_rtp_pad_added (DinoPluginsRtpPlugin* self,
                                          GstPad* pad)
{
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_;
	gchar* _tmp29_;
	gchar* _tmp30_;
	gchar* _tmp31_;
	gboolean _tmp32_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (pad != NULL);
	_tmp0_ = gst_object_get_name ((GstObject*) pad);
	_tmp1_ = _tmp0_;
	_tmp2_ = _tmp1_;
	g_debug ("plugin.vala:149: pad added: %s", _tmp2_);
	_g_free0 (_tmp2_);
	_tmp3_ = gst_object_get_name ((GstObject*) pad);
	_tmp4_ = _tmp3_;
	_tmp5_ = _tmp4_;
	_tmp6_ = g_str_has_prefix (_tmp5_, "recv_rtp_src_");
	_g_free0 (_tmp5_);
	if (_tmp6_) {
		gchar** split = NULL;
		gchar* _tmp7_;
		gchar* _tmp8_;
		gchar* _tmp9_;
		gchar** _tmp10_;
		gchar** _tmp11_;
		gchar** _tmp12_;
		gint _tmp12__length1;
		gint split_length1;
		gint _split_size_;
		guint8 rtpid = 0U;
		gchar** _tmp13_;
		gint _tmp13__length1;
		const gchar* _tmp14_;
		_tmp7_ = gst_object_get_name ((GstObject*) pad);
		_tmp8_ = _tmp7_;
		_tmp9_ = _tmp8_;
		_tmp11_ = _tmp10_ = g_strsplit (_tmp9_, "_", 0);
		_tmp12_ = _tmp11_;
		_tmp12__length1 = _vala_array_length (_tmp10_);
		_g_free0 (_tmp9_);
		split = _tmp12_;
		split_length1 = _tmp12__length1;
		_split_size_ = split_length1;
		_tmp13_ = split;
		_tmp13__length1 = split_length1;
		_tmp14_ = _tmp13_[3];
		rtpid = (guint8) atoi (_tmp14_);
		{
			GeeList* _stream_list = NULL;
			GeeList* _tmp15_;
			gint _stream_size = 0;
			GeeList* _tmp16_;
			gint _tmp17_;
			gint _tmp18_;
			gint _stream_index = 0;
			_tmp15_ = self->priv->streams;
			_stream_list = _tmp15_;
			_tmp16_ = _stream_list;
			_tmp17_ = gee_collection_get_size ((GeeCollection*) _tmp16_);
			_tmp18_ = _tmp17_;
			_stream_size = _tmp18_;
			_stream_index = -1;
			while (TRUE) {
				gint _tmp19_;
				gint _tmp20_;
				DinoPluginsRtpStream* stream = NULL;
				GeeList* _tmp21_;
				gpointer _tmp22_;
				DinoPluginsRtpStream* _tmp23_;
				guint8 _tmp24_;
				guint8 _tmp25_;
				_stream_index = _stream_index + 1;
				_tmp19_ = _stream_index;
				_tmp20_ = _stream_size;
				if (!(_tmp19_ < _tmp20_)) {
					break;
				}
				_tmp21_ = _stream_list;
				_tmp22_ = gee_list_get (_tmp21_, _stream_index);
				stream = (DinoPluginsRtpStream*) _tmp22_;
				_tmp23_ = stream;
				_tmp24_ = dino_plugins_rtp_stream_get_rtpid (_tmp23_);
				_tmp25_ = _tmp24_;
				if (_tmp25_ == rtpid) {
					DinoPluginsRtpStream* _tmp26_;
					gchar** _tmp27_;
					gint _tmp27__length1;
					const gchar* _tmp28_;
					_tmp26_ = stream;
					_tmp27_ = split;
					_tmp27__length1 = split_length1;
					_tmp28_ = _tmp27_[4];
					dino_plugins_rtp_stream_on_ssrc_pad_added (_tmp26_, (guint32) g_ascii_strtoull (_tmp28_, NULL, 0), pad);
				}
				_g_object_unref0 (stream);
			}
		}
		split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL);
	}
	_tmp29_ = gst_object_get_name ((GstObject*) pad);
	_tmp30_ = _tmp29_;
	_tmp31_ = _tmp30_;
	_tmp32_ = g_str_has_prefix (_tmp31_, "send_rtp_src_");
	_g_free0 (_tmp31_);
	if (_tmp32_) {
		gchar** split = NULL;
		gchar* _tmp33_;
		gchar* _tmp34_;
		gchar* _tmp35_;
		gchar** _tmp36_;
		gchar** _tmp37_;
		gchar** _tmp38_;
		gint _tmp38__length1;
		gint split_length1;
		gint _split_size_;
		guint8 rtpid = 0U;
		gchar** _tmp39_;
		gint _tmp39__length1;
		const gchar* _tmp40_;
		gchar* _tmp41_;
		gchar* _tmp42_;
		gchar* _tmp43_;
		_tmp33_ = gst_object_get_name ((GstObject*) pad);
		_tmp34_ = _tmp33_;
		_tmp35_ = _tmp34_;
		_tmp37_ = _tmp36_ = g_strsplit (_tmp35_, "_", 0);
		_tmp38_ = _tmp37_;
		_tmp38__length1 = _vala_array_length (_tmp36_);
		_g_free0 (_tmp35_);
		split = _tmp38_;
		split_length1 = _tmp38__length1;
		_split_size_ = split_length1;
		_tmp39_ = split;
		_tmp39__length1 = split_length1;
		_tmp40_ = _tmp39_[3];
		rtpid = (guint8) atoi (_tmp40_);
		_tmp41_ = gst_object_get_name ((GstObject*) pad);
		_tmp42_ = _tmp41_;
		_tmp43_ = _tmp42_;
		g_debug ("plugin.vala:162: pad %s for stream %hhu", _tmp43_, (guchar) rtpid);
		_g_free0 (_tmp43_);
		{
			GeeList* _stream_list = NULL;
			GeeList* _tmp44_;
			gint _stream_size = 0;
			GeeList* _tmp45_;
			gint _tmp46_;
			gint _tmp47_;
			gint _stream_index = 0;
			_tmp44_ = self->priv->streams;
			_stream_list = _tmp44_;
			_tmp45_ = _stream_list;
			_tmp46_ = gee_collection_get_size ((GeeCollection*) _tmp45_);
			_tmp47_ = _tmp46_;
			_stream_size = _tmp47_;
			_stream_index = -1;
			while (TRUE) {
				gint _tmp48_;
				gint _tmp49_;
				DinoPluginsRtpStream* stream = NULL;
				GeeList* _tmp50_;
				gpointer _tmp51_;
				DinoPluginsRtpStream* _tmp52_;
				guint8 _tmp53_;
				guint8 _tmp54_;
				_stream_index = _stream_index + 1;
				_tmp48_ = _stream_index;
				_tmp49_ = _stream_size;
				if (!(_tmp48_ < _tmp49_)) {
					break;
				}
				_tmp50_ = _stream_list;
				_tmp51_ = gee_list_get (_tmp50_, _stream_index);
				stream = (DinoPluginsRtpStream*) _tmp51_;
				_tmp52_ = stream;
				_tmp53_ = dino_plugins_rtp_stream_get_rtpid (_tmp52_);
				_tmp54_ = _tmp53_;
				if (_tmp54_ == rtpid) {
					DinoPluginsRtpStream* _tmp55_;
					_tmp55_ = stream;
					dino_plugins_rtp_stream_on_send_rtp_src_added (_tmp55_, pad);
				}
				_g_object_unref0 (stream);
			}
		}
		split = (_vala_array_free (split, split_length1, (GDestroyNotify) g_free), NULL);
	}
}

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_plugins_rtp_plugin_on_pipe_bus_message (DinoPluginsRtpPlugin* self,
                                             GstMessage* message)
{
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	switch (message->type) {
		case GST_MESSAGE_ERROR:
		{
			GError* _error_ = NULL;
			gchar* str = NULL;
			GError* _tmp0_ = NULL;
			gchar* _tmp1_ = NULL;
			GError* _tmp2_;
			const gchar* _tmp3_;
			const gchar* _tmp4_;
			gst_message_parse_error (message, &_tmp0_, &_tmp1_);
			_g_error_free0 (_error_);
			_error_ = _tmp0_;
			_g_free0 (str);
			str = _tmp1_;
			_tmp2_ = _error_;
			_tmp3_ = _tmp2_->message;
			g_warning ("plugin.vala:177: Error in pipeline: %s", _tmp3_);
			_tmp4_ = str;
			g_debug ("plugin.vala:178: %s", _tmp4_);
			_g_free0 (str);
			_g_error_free0 (_error_);
			break;
		}
		case GST_MESSAGE_WARNING:
		{
			GError* _error_ = NULL;
			gchar* str = NULL;
			GError* _tmp5_ = NULL;
			gchar* _tmp6_ = NULL;
			GError* _tmp7_;
			const gchar* _tmp8_;
			const gchar* _tmp9_;
			gst_message_parse_warning (message, &_tmp5_, &_tmp6_);
			_g_error_free0 (_error_);
			_error_ = _tmp5_;
			_g_free0 (str);
			str = _tmp6_;
			_tmp7_ = _error_;
			_tmp8_ = _tmp7_->message;
			g_warning ("plugin.vala:184: Warning in pipeline: %s", _tmp8_);
			_tmp9_ = str;
			g_debug ("plugin.vala:185: %s", _tmp9_);
			_g_free0 (str);
			_g_error_free0 (_error_);
			break;
		}
		case GST_MESSAGE_CLOCK_LOST:
		{
			GstPipeline* _tmp10_;
			GstPipeline* _tmp11_;
			g_debug ("plugin.vala:188: Clock lost. Restarting");
			_tmp10_ = self->priv->_pipe;
			gst_element_set_state ((GstElement*) _tmp10_, GST_STATE_READY);
			_tmp11_ = self->priv->_pipe;
			gst_element_set_state ((GstElement*) _tmp11_, GST_STATE_PLAYING);
			break;
		}
		case GST_MESSAGE_STATE_CHANGED:
		{
			break;
		}
		case GST_MESSAGE_STREAM_STATUS:
		{
			GstStreamStatusType status = 0;
			GstElement* owner = NULL;
			GstStreamStatusType _tmp12_ = 0;
			GstElement* _tmp13_ = NULL;
			GstElement* _tmp14_;
			GstElement* _tmp15_;
			gst_message_parse_stream_status (message, &_tmp12_, &_tmp13_);
			status = _tmp12_;
			_g_object_unref0 (owner);
			_tmp14_ = _g_object_ref0 (_tmp13_);
			owner = _tmp14_;
			_tmp15_ = owner;
			if (_tmp15_ != NULL) {
				GstElement* _tmp16_;
				gchar* _tmp17_;
				gchar* _tmp18_;
				gchar* _tmp19_;
				GEnumValue* _tmp20_;
				_tmp16_ = owner;
				_tmp17_ = gst_object_get_name ((GstObject*) _tmp16_);
				_tmp18_ = _tmp17_;
				_tmp19_ = _tmp18_;
				_tmp20_ = g_enum_get_value (g_type_class_ref (gst_stream_status_type_get_type ()), status);
				g_debug ("plugin.vala:200: %s stream changed status to %s", _tmp19_, (_tmp20_ != NULL) ? _tmp20_->value_name : NULL);
				_g_free0 (_tmp19_);
			}
			_g_object_unref0 (owner);
			break;
		}
		case GST_MESSAGE_ELEMENT:
		{
			GstStructure* struc = NULL;
			GstStructure* _tmp21_;
			gboolean _tmp22_ = FALSE;
			GstStructure* _tmp23_;
			_tmp21_ = gst_message_get_structure (message);
			struc = _tmp21_;
			_tmp23_ = struc;
			if (_tmp23_ != NULL) {
				GstObject* _tmp24_;
				_tmp24_ = message->src;
				_tmp22_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp24_, gst_element_get_type ());
			} else {
				_tmp22_ = FALSE;
			}
			if (_tmp22_) {
				GstObject* _tmp25_;
				gchar* _tmp26_;
				gchar* _tmp27_;
				gchar* _tmp28_;
				GstStructure* _tmp29_;
				gchar* _tmp30_;
				gchar* _tmp31_;
				_tmp25_ = message->src;
				_tmp26_ = gst_object_get_name ((GstObject*) G_TYPE_CHECK_INSTANCE_CAST (_tmp25_, gst_element_get_type (), GstElement));
				_tmp27_ = _tmp26_;
				_tmp28_ = _tmp27_;
				_tmp29_ = struc;
				_tmp30_ = gst_structure_to_string (_tmp29_);
				_tmp31_ = _tmp30_;
				g_debug ("plugin.vala:206: Message from %s in pipeline: %s", _tmp28_, _tmp31_);
				_g_free0 (_tmp31_);
				_g_free0 (_tmp28_);
			}
			break;
		}
		case GST_MESSAGE_NEW_CLOCK:
		{
			g_debug ("plugin.vala:210: New clock.");
			break;
		}
		case GST_MESSAGE_TAG:
		{
			break;
		}
		case GST_MESSAGE_QOS:
		{
			break;
		}
		case GST_MESSAGE_LATENCY:
		{
			gboolean _tmp32_ = FALSE;
			gboolean _tmp33_ = FALSE;
			GstObject* _tmp34_;
			_tmp34_ = message->src;
			if (_tmp34_ != NULL) {
				GstObject* _tmp35_;
				gchar* _tmp36_;
				gchar* _tmp37_;
				gchar* _tmp38_;
				_tmp35_ = message->src;
				_tmp36_ = gst_object_get_name (_tmp35_);
				_tmp37_ = _tmp36_;
				_tmp38_ = _tmp37_;
				_tmp33_ = _tmp38_ != NULL;
				_g_free0 (_tmp38_);
			} else {
				_tmp33_ = FALSE;
			}
			if (_tmp33_) {
				GstObject* _tmp39_;
				_tmp39_ = message->src;
				_tmp32_ = G_TYPE_CHECK_INSTANCE_TYPE (_tmp39_, gst_element_get_type ());
			} else {
				_tmp32_ = FALSE;
			}
			if (_tmp32_) {
				GstQuery* latency_query = NULL;
				GstQuery* _tmp40_;
				GstObject* _tmp41_;
				GstQuery* _tmp42_;
				_tmp40_ = gst_query_new_latency ();
				latency_query = _tmp40_;
				_tmp41_ = message->src;
				_tmp42_ = latency_query;
				if (gst_element_query (G_TYPE_CHECK_INSTANCE_CAST (_tmp41_, gst_element_get_type (), GstElement), _tmp42_)) {
					gboolean live = FALSE;
					GstClockTime min_latency = 0ULL;
					GstClockTime max_latency = 0ULL;
					GstQuery* _tmp43_;
					gboolean _tmp44_ = FALSE;
					GstClockTime _tmp45_ = 0ULL;
					GstClockTime _tmp46_ = 0ULL;
					GstObject* _tmp47_;
					gchar* _tmp48_;
					gchar* _tmp49_;
					gchar* _tmp50_;
					gchar* _tmp51_;
					gchar* _tmp52_;
					gchar* _tmp53_;
					gchar* _tmp54_;
					gchar* _tmp55_;
					gchar* _tmp56_;
					_tmp43_ = latency_query;
					gst_query_parse_latency (_tmp43_, &_tmp44_, &_tmp45_, &_tmp46_);
					live = _tmp44_;
					min_latency = _tmp45_;
					max_latency = _tmp46_;
					_tmp47_ = message->src;
					_tmp48_ = gst_object_get_name (_tmp47_);
					_tmp49_ = _tmp48_;
					_tmp50_ = _tmp49_;
					_tmp51_ = bool_to_string (live);
					_tmp52_ = _tmp51_;
					_tmp53_ = g_strdup_printf ("%" G_GUINT64_FORMAT, (guint64) min_latency);
					_tmp54_ = _tmp53_;
					_tmp55_ = g_strdup_printf ("%" G_GUINT64_FORMAT, (guint64) max_latency);
					_tmp56_ = _tmp55_;
					g_debug ("plugin.vala:225: Latency message from %s: live=%s, min_latency=%s, max" \
"_latency=%s", _tmp50_, _tmp52_, _tmp54_, _tmp56_);
					_g_free0 (_tmp56_);
					_g_free0 (_tmp54_);
					_g_free0 (_tmp52_);
					_g_free0 (_tmp50_);
				}
				_gst_query_unref0 (latency_query);
			}
			break;
		}
		default:
		{
			GFlagsValue* _tmp57_;
			_tmp57_ = g_flags_get_first_value (g_type_class_ref (gst_message_type_get_type ()), message->type);
			g_debug ("plugin.vala:230: Pipe bus message: %s", (_tmp57_ != NULL) ? _tmp57_->value_name : NULL);
			break;
		}
	}
}

static Block7Data*
block7_data_ref (Block7Data* _data7_)
{
	g_atomic_int_inc (&_data7_->_ref_count_);
	return _data7_;
}

static void
block7_data_unref (void * _userdata_)
{
	Block7Data* _data7_;
	_data7_ = (Block7Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data7_->_ref_count_)) {
		DinoPluginsRtpPlugin* self;
		self = _data7_->self;
		_g_object_unref0 (_data7_->gst_device);
		_g_object_unref0 (_data7_->old_gst_device);
		_g_object_unref0 (self);
		g_slice_free (Block7Data, _data7_);
	}
}

static gboolean
___lambda20_ (Block7Data* _data7_,
              DinoPluginsRtpDevice* it)
{
	DinoPluginsRtpPlugin* self;
	GstDevice* _tmp0_;
	gboolean result;
	self = _data7_->self;
	g_return_val_if_fail (it != NULL, FALSE);
	_tmp0_ = _data7_->gst_device;
	result = dino_plugins_rtp_device_matches (it, _tmp0_);
	return result;
}

static gboolean
____lambda20__gee_predicate (gconstpointer g,
                             gpointer self)
{
	gboolean result;
	result = ___lambda20_ (self, (DinoPluginsRtpDevice*) g);
	return result;
}

static gboolean
___lambda21_ (Block7Data* _data7_,
              DinoPluginsRtpDevice* it)
{
	DinoPluginsRtpPlugin* self;
	GstDevice* _tmp0_;
	gboolean result;
	self = _data7_->self;
	g_return_val_if_fail (it != NULL, FALSE);
	_tmp0_ = _data7_->old_gst_device;
	result = dino_plugins_rtp_device_matches (it, _tmp0_);
	return result;
}

static gboolean
____lambda21__gee_predicate (gconstpointer g,
                             gpointer self)
{
	gboolean result;
	result = ___lambda21_ (self, (DinoPluginsRtpDevice*) g);
	return result;
}

static gboolean
___lambda22_ (Block7Data* _data7_,
              DinoPluginsRtpDevice* it)
{
	DinoPluginsRtpPlugin* self;
	GstDevice* _tmp0_;
	gboolean result;
	self = _data7_->self;
	g_return_val_if_fail (it != NULL, FALSE);
	_tmp0_ = _data7_->gst_device;
	result = dino_plugins_rtp_device_matches (it, _tmp0_);
	return result;
}

static gboolean
____lambda22__gee_predicate (gconstpointer g,
                             gpointer self)
{
	gboolean result;
	result = ___lambda22_ (self, (DinoPluginsRtpDevice*) g);
	return result;
}

static gboolean
dino_plugins_rtp_plugin_on_device_monitor_message (DinoPluginsRtpPlugin* self,
                                                   GstBus* bus,
                                                   GstMessage* message)
{
	Block7Data* _data7_;
	DinoPluginsRtpDevice* device = NULL;
	DinoPluginsRtpDevice* _tmp19_;
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (bus != NULL, FALSE);
	g_return_val_if_fail (message != NULL, FALSE);
	_data7_ = g_slice_new0 (Block7Data);
	_data7_->_ref_count_ = 1;
	_data7_->self = g_object_ref (self);
	_data7_->old_gst_device = NULL;
	_data7_->gst_device = NULL;
	device = NULL;
	switch (message->type) {
		case GST_MESSAGE_DEVICE_ADDED:
		{
			GstDevice* _tmp0_ = NULL;
			GeeList* _tmp1_;
			GstDevice* _tmp2_;
			DinoPluginsRtpDevice* _tmp3_;
			GeeList* _tmp4_;
			DinoPluginsRtpDevice* _tmp5_;
			gst_message_parse_device_added (message, &_tmp0_);
			_g_object_unref0 (_data7_->gst_device);
			_data7_->gst_device = _tmp0_;
			_tmp1_ = self->priv->devices;
			if (gee_traversable_any_match ((GeeTraversable*) _tmp1_, ____lambda20__gee_predicate, block7_data_ref (_data7_), block7_data_unref)) {
				result = G_SOURCE_CONTINUE;
				_g_object_unref0 (device);
				block7_data_unref (_data7_);
				_data7_ = NULL;
				return result;
			}
			_tmp2_ = _data7_->gst_device;
			_tmp3_ = dino_plugins_rtp_device_new (self, _tmp2_);
			_g_object_unref0 (device);
			device = _tmp3_;
			_tmp4_ = self->priv->devices;
			_tmp5_ = device;
			gee_collection_add ((GeeCollection*) _tmp4_, _tmp5_);
			break;
		}
		case GST_MESSAGE_DEVICE_CHANGED:
		{
			GstDevice* _tmp6_ = NULL;
			GstDevice* _tmp7_ = NULL;
			GeeList* _tmp8_;
			gpointer _tmp9_;
			DinoPluginsRtpDevice* _tmp10_;
			gst_message_parse_device_changed (message, &_tmp6_, &_tmp7_);
			_g_object_unref0 (_data7_->gst_device);
			_data7_->gst_device = _tmp6_;
			_g_object_unref0 (_data7_->old_gst_device);
			_data7_->old_gst_device = _tmp7_;
			_tmp8_ = self->priv->devices;
			_tmp9_ = gee_traversable_first_match ((GeeTraversable*) _tmp8_, ____lambda21__gee_predicate, block7_data_ref (_data7_), block7_data_unref);
			_g_object_unref0 (device);
			device = (DinoPluginsRtpDevice*) _tmp9_;
			_tmp10_ = device;
			if (_tmp10_ != NULL) {
				DinoPluginsRtpDevice* _tmp11_;
				GstDevice* _tmp12_;
				_tmp11_ = device;
				_tmp12_ = _data7_->gst_device;
				dino_plugins_rtp_device_update (_tmp11_, _tmp12_);
			}
			break;
		}
		case GST_MESSAGE_DEVICE_REMOVED:
		{
			GstDevice* _tmp13_ = NULL;
			GeeList* _tmp14_;
			gpointer _tmp15_;
			DinoPluginsRtpDevice* _tmp16_;
			gst_message_parse_device_removed (message, &_tmp13_);
			_g_object_unref0 (_data7_->gst_device);
			_data7_->gst_device = _tmp13_;
			_tmp14_ = self->priv->devices;
			_tmp15_ = gee_traversable_first_match ((GeeTraversable*) _tmp14_, ____lambda22__gee_predicate, block7_data_ref (_data7_), block7_data_unref);
			_g_object_unref0 (device);
			device = (DinoPluginsRtpDevice*) _tmp15_;
			_tmp16_ = device;
			if (_tmp16_ != NULL) {
				GeeList* _tmp17_;
				DinoPluginsRtpDevice* _tmp18_;
				_tmp17_ = self->priv->devices;
				_tmp18_ = device;
				gee_collection_remove ((GeeCollection*) _tmp17_, _tmp18_);
			}
			break;
		}
		default:
		{
			break;
		}
	}
	_tmp19_ = device;
	if (_tmp19_ != NULL) {
		DinoPluginsRtpDevice* _tmp20_;
		gchar* _tmp21_;
		gchar* _tmp22_;
		gchar* _tmp23_;
		DinoPluginsRtpDevice* _tmp24_;
		gboolean _tmp25_;
		gboolean _tmp26_;
		_tmp20_ = device;
		_tmp21_ = dino_plugins_media_device_get_media ((DinoPluginsMediaDevice*) _tmp20_);
		_tmp22_ = _tmp21_;
		_tmp23_ = _tmp22_;
		_tmp24_ = device;
		_tmp25_ = dino_plugins_rtp_device_get_is_sink (_tmp24_);
		_tmp26_ = _tmp25_;
		g_signal_emit_by_name ((DinoPluginsVideoCallPlugin*) self, "devices-changed", _tmp23_, _tmp26_);
		_g_free0 (_tmp23_);
	}
	result = G_SOURCE_CONTINUE;
	_g_object_unref0 (device);
	block7_data_unref (_data7_);
	_data7_ = NULL;
	return result;
}

static Block8Data*
block8_data_ref (Block8Data* _data8_)
{
	g_atomic_int_inc (&_data8_->_ref_count_);
	return _data8_;
}

static void
block8_data_unref (void * _userdata_)
{
	Block8Data* _data8_;
	_data8_ = (Block8Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data8_->_ref_count_)) {
		DinoPluginsRtpPlugin* self;
		self = _data8_->self;
		_g_object_unref0 (self);
		g_slice_free (Block8Data, _data8_);
	}
}

static gboolean
____lambda4_ (Block8Data* _data8_,
              DinoPluginsRtpStream* stream)
{
	DinoPluginsRtpPlugin* self;
	guint8 _tmp0_;
	guint8 _tmp1_;
	gboolean result;
	self = _data8_->self;
	g_return_val_if_fail (stream != NULL, FALSE);
	_tmp0_ = dino_plugins_rtp_stream_get_rtpid (stream);
	_tmp1_ = _tmp0_;
	result = _tmp1_ == _data8_->rtpid;
	return result;
}

static gboolean
_____lambda4__gee_predicate (gconstpointer g,
                             gpointer self)
{
	gboolean result;
	result = ____lambda4_ (self, (DinoPluginsRtpStream*) g);
	return result;
}

guint8
dino_plugins_rtp_plugin_next_free_id (DinoPluginsRtpPlugin* self)
{
	Block8Data* _data8_;
	guint8 result;
	g_return_val_if_fail (self != NULL, 0U);
	_data8_ = g_slice_new0 (Block8Data);
	_data8_->_ref_count_ = 1;
	_data8_->self = g_object_ref (self);
	_data8_->rtpid = (guint8) 0;
	while (TRUE) {
		gboolean _tmp0_ = FALSE;
		GeeList* _tmp1_;
		gint _tmp2_;
		gint _tmp3_;
		guint8 _tmp5_;
		_tmp1_ = self->priv->streams;
		_tmp2_ = gee_collection_get_size ((GeeCollection*) _tmp1_);
		_tmp3_ = _tmp2_;
		if (_tmp3_ < 100) {
			GeeList* _tmp4_;
			_tmp4_ = self->priv->streams;
			_tmp0_ = gee_traversable_any_match ((GeeTraversable*) _tmp4_, _____lambda4__gee_predicate, block8_data_ref (_data8_), block8_data_unref);
		} else {
			_tmp0_ = FALSE;
		}
		if (!_tmp0_) {
			break;
		}
		_tmp5_ = _data8_->rtpid;
		_data8_->rtpid = _tmp5_ + 1;
	}
	result = _data8_->rtpid;
	block8_data_unref (_data8_);
	_data8_ = NULL;
	return result;
}

DinoPluginsRtpStream*
dino_plugins_rtp_plugin_open_stream (DinoPluginsRtpPlugin* self,
                                     XmppXepJingleContent* content)
{
	XmppXepJingleRtpParameters* content_params = NULL;
	XmppXepJingleContentParameters* _tmp0_;
	XmppXepJingleRtpParameters* _tmp1_;
	XmppXepJingleRtpParameters* _tmp2_;
	DinoPluginsRtpStream* stream = NULL;
	XmppXepJingleRtpParameters* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	GeeList* _tmp8_;
	DinoPluginsRtpStream* _tmp9_;
	DinoPluginsRtpStream* result;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (content != NULL, NULL);
	dino_plugins_rtp_plugin_init_call_pipe (self);
	_tmp0_ = content->content_params;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, XMPP_XEP_JINGLE_RTP_TYPE_PARAMETERS) ? ((XmppXepJingleRtpParameters*) _tmp0_) : NULL);
	content_params = _tmp1_;
	_tmp2_ = content_params;
	if (_tmp2_ == NULL) {
		result = NULL;
		_g_object_unref0 (content_params);
		return result;
	}
	_tmp3_ = content_params;
	_tmp4_ = xmpp_xep_jingle_rtp_parameters_get_media (_tmp3_);
	_tmp5_ = _tmp4_;
	if (g_strcmp0 (_tmp5_, "video") == 0) {
		DinoPluginsRtpVideoStream* _tmp6_;
		_tmp6_ = dino_plugins_rtp_video_stream_new (self, content);
		_g_object_unref0 (stream);
		stream = (DinoPluginsRtpStream*) _tmp6_;
	} else {
		DinoPluginsRtpStream* _tmp7_;
		_tmp7_ = dino_plugins_rtp_stream_new (self, content);
		_g_object_unref0 (stream);
		stream = _tmp7_;
	}
	_tmp8_ = self->priv->streams;
	_tmp9_ = stream;
	gee_collection_add ((GeeCollection*) _tmp8_, _tmp9_);
	result = stream;
	_g_object_unref0 (content_params);
	return result;
}

void
dino_plugins_rtp_plugin_close_stream (DinoPluginsRtpPlugin* self,
                                      DinoPluginsRtpStream* stream)
{
	GeeList* _tmp0_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (stream != NULL);
	_tmp0_ = self->priv->streams;
	gee_collection_remove ((GeeCollection*) _tmp0_, stream);
	xmpp_xep_jingle_rtp_stream_destroy ((XmppXepJingleRtpStream*) stream);
	dino_plugins_rtp_plugin_destroy_call_pipe_if_unused (self);
}

static void
dino_plugins_rtp_plugin_real_shutdown (DinoPluginsRootInterface* base)
{
	DinoPluginsRtpPlugin * self;
	self = (DinoPluginsRtpPlugin*) base;
	dino_plugins_rtp_plugin_stop_device_monitor (self);
	dino_plugins_rtp_plugin_destroy_call_pipe (self);
	gst_deinit ();
}

static gboolean
dino_plugins_rtp_plugin_real_supported (DinoPluginsVideoCallPlugin* base)
{
	DinoPluginsRtpPlugin * self;
	DinoPluginsRtpCodecUtil* _tmp0_;
	gboolean result;
	self = (DinoPluginsRtpPlugin*) base;
	_tmp0_ = self->priv->_codec_util;
	result = dino_plugins_rtp_codec_util_is_element_supported (_tmp0_, "rtpbin");
	return result;
}

static DinoPluginsVideoCallWidget*
dino_plugins_rtp_plugin_real_create_widget (DinoPluginsVideoCallPlugin* base,
                                            DinoPluginsWidgetType type)
{
	DinoPluginsRtpPlugin * self;
	DinoPluginsVideoCallWidget* result;
	self = (DinoPluginsRtpPlugin*) base;
	dino_plugins_rtp_plugin_init_call_pipe (self);
	if (type == DINO_PLUGINS_WIDGET_TYPE_GTK4) {
		DinoPluginsRtpVideoWidget* _tmp0_;
		_tmp0_ = dino_plugins_rtp_video_widget_new (self);
		g_object_ref_sink (_tmp0_);
		result = (DinoPluginsVideoCallWidget*) _tmp0_;
		return result;
	}
	result = NULL;
	return result;
}

static Block9Data*
block9_data_ref (Block9Data* _data9_)
{
	g_atomic_int_inc (&_data9_->_ref_count_);
	return _data9_;
}

static void
block9_data_unref (void * _userdata_)
{
	Block9Data* _data9_;
	_data9_ = (Block9Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data9_->_ref_count_)) {
		DinoPluginsRtpPlugin* self;
		self = _data9_->self;
		_g_free0 (_data9_->media);
		_g_object_unref0 (self);
		g_slice_free (Block9Data, _data9_);
	}
}

static gboolean
____lambda27_ (Block9Data* _data9_,
               DinoPluginsRtpDevice* it)
{
	DinoPluginsRtpPlugin* self;
	gboolean _tmp0_ = FALSE;
	gboolean _tmp1_ = FALSE;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gboolean _tmp5_;
	gboolean result;
	self = _data9_->self;
	g_return_val_if_fail (it != NULL, FALSE);
	_tmp2_ = dino_plugins_media_device_get_media ((DinoPluginsMediaDevice*) it);
	_tmp3_ = _tmp2_;
	_tmp4_ = _tmp3_;
	_tmp5_ = g_strcmp0 (_tmp4_, _data9_->media) == 0;
	_g_free0 (_tmp4_);
	if (_tmp5_) {
		gboolean _tmp6_ = FALSE;
		gboolean _tmp7_ = FALSE;
		if (_data9_->incoming) {
			gboolean _tmp8_;
			gboolean _tmp9_;
			_tmp8_ = dino_plugins_rtp_device_get_is_sink (it);
			_tmp9_ = _tmp8_;
			_tmp7_ = _tmp9_;
		} else {
			_tmp7_ = FALSE;
		}
		if (_tmp7_) {
			_tmp6_ = TRUE;
		} else {
			gboolean _tmp10_ = FALSE;
			if (!_data9_->incoming) {
				gboolean _tmp11_;
				gboolean _tmp12_;
				_tmp11_ = dino_plugins_rtp_device_get_is_source (it);
				_tmp12_ = _tmp11_;
				_tmp10_ = _tmp12_;
			} else {
				_tmp10_ = FALSE;
			}
			_tmp6_ = _tmp10_;
		}
		_tmp1_ = _tmp6_;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		gboolean _tmp13_;
		gboolean _tmp14_;
		_tmp13_ = dino_plugins_rtp_device_get_is_monitor (it);
		_tmp14_ = _tmp13_;
		_tmp0_ = !_tmp14_;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}

static gboolean
_____lambda27__gee_predicate (gconstpointer g,
                              gpointer self)
{
	gboolean result;
	result = ____lambda27_ (self, (DinoPluginsRtpDevice*) g);
	return result;
}

static gint
__lambda28_ (DinoPluginsRtpPlugin* self,
             DinoPluginsMediaDevice* media_left,
             DinoPluginsMediaDevice* media_right)
{
	GCompareFunc _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gint _tmp7_;
	gint result;
	g_return_val_if_fail (media_left != NULL, -1);
	g_return_val_if_fail (media_right != NULL, -1);
	_tmp0_ = ((GCompareFunc) g_strcmp0);
	_tmp1_ = dino_plugins_media_device_get_id (media_left);
	_tmp2_ = _tmp1_;
	_tmp3_ = _tmp2_;
	_tmp4_ = dino_plugins_media_device_get_id (media_right);
	_tmp5_ = _tmp4_;
	_tmp6_ = _tmp5_;
	_tmp7_ = _tmp0_ (_tmp3_, _tmp6_);
	_g_free0 (_tmp6_);
	_g_free0 (_tmp3_);
	result = _tmp7_;
	return result;
}

static gint
___lambda28__gcompare_data_func (gconstpointer a,
                                 gconstpointer b,
                                 gpointer self)
{
	gint result;
	result = __lambda28_ ((DinoPluginsRtpPlugin*) self, (DinoPluginsMediaDevice*) a, (DinoPluginsMediaDevice*) b);
	return result;
}

static GeeList*
dino_plugins_rtp_plugin_real_get_devices (DinoPluginsVideoCallPlugin* base,
                                          const gchar* media,
                                          gboolean incoming)
{
	DinoPluginsRtpPlugin * self;
	Block9Data* _data9_;
	gchar* _tmp0_;
	GeeList* devices = NULL;
	gboolean _tmp1_ = FALSE;
	GeeList* _tmp9_;
	GeeList* result;
	self = (DinoPluginsRtpPlugin*) base;
	g_return_val_if_fail (media != NULL, NULL);
	_data9_ = g_slice_new0 (Block9Data);
	_data9_->_ref_count_ = 1;
	_data9_->self = g_object_ref (self);
	_tmp0_ = g_strdup (media);
	_g_free0 (_data9_->media);
	_data9_->media = _tmp0_;
	_data9_->incoming = incoming;
	dino_plugins_rtp_plugin_refresh_devices (self);
	if (g_strcmp0 (_data9_->media, "video") == 0) {
		_tmp1_ = !_data9_->incoming;
	} else {
		_tmp1_ = FALSE;
	}
	if (_tmp1_) {
		GeeList* _tmp2_;
		_tmp2_ = dino_plugins_rtp_plugin_get_video_sources (self);
		_g_object_unref0 (devices);
		devices = _tmp2_;
	} else {
		if (g_strcmp0 (_data9_->media, "audio") == 0) {
			GeeList* _tmp3_;
			_tmp3_ = dino_plugins_rtp_plugin_get_audio_devices (self, _data9_->incoming);
			_g_object_unref0 (devices);
			devices = _tmp3_;
		} else {
			GeeArrayList* _tmp4_;
			GeeList* _tmp5_;
			GeeList* _tmp6_;
			GeeIterator* _tmp7_;
			GeeIterator* _tmp8_;
			_tmp4_ = gee_array_list_new (DINO_PLUGINS_TYPE_MEDIA_DEVICE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
			_g_object_unref0 (devices);
			devices = (GeeList*) _tmp4_;
			_tmp5_ = devices;
			_tmp6_ = self->priv->devices;
			_tmp7_ = gee_traversable_filter ((GeeTraversable*) _tmp6_, _____lambda27__gee_predicate, block9_data_ref (_data9_), block9_data_unref);
			_tmp8_ = _tmp7_;
			gee_collection_add_all_iterator ((GeeCollection*) _tmp5_, _tmp8_);
			_g_object_unref0 (_tmp8_);
		}
	}
	_tmp9_ = devices;
	gee_list_sort (_tmp9_, ___lambda28__gcompare_data_func, g_object_ref (self), g_object_unref);
	result = devices;
	block9_data_unref (_data9_);
	_data9_ = NULL;
	return result;
}

GeeList*
dino_plugins_rtp_plugin_get_audio_devices (DinoPluginsRtpPlugin* self,
                                           gboolean incoming)
{
	GeeArrayList* pulse_devices = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* other_devices = NULL;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp34_ = NULL;
	GeeArrayList* _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	GeeList* _tmp40_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (DINO_PLUGINS_TYPE_MEDIA_DEVICE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	pulse_devices = _tmp0_;
	_tmp1_ = gee_array_list_new (DINO_PLUGINS_TYPE_MEDIA_DEVICE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	other_devices = _tmp1_;
	{
		GeeList* _device_list = NULL;
		GeeList* _tmp2_;
		gint _device_size = 0;
		GeeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _device_index = 0;
		_tmp2_ = self->priv->devices;
		_device_list = _tmp2_;
		_tmp3_ = _device_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_device_size = _tmp5_;
		_device_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			DinoPluginsRtpDevice* device = NULL;
			GeeList* _tmp8_;
			gpointer _tmp9_;
			DinoPluginsRtpDevice* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gboolean _tmp14_;
			gboolean _tmp15_ = FALSE;
			gboolean _tmp16_ = FALSE;
			DinoPluginsRtpDevice* _tmp24_;
			gboolean _tmp25_;
			gboolean _tmp26_;
			DinoPluginsRtpDevice* _tmp27_;
			DinoPluginsRtpDeviceProtocol _tmp28_;
			DinoPluginsRtpDeviceProtocol _tmp29_;
			_device_index = _device_index + 1;
			_tmp6_ = _device_index;
			_tmp7_ = _device_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _device_list;
			_tmp9_ = gee_list_get (_tmp8_, _device_index);
			device = (DinoPluginsRtpDevice*) _tmp9_;
			_tmp10_ = device;
			_tmp11_ = dino_plugins_media_device_get_media ((DinoPluginsMediaDevice*) _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = _tmp12_;
			_tmp14_ = g_strcmp0 (_tmp13_, "audio") != 0;
			_g_free0 (_tmp13_);
			if (_tmp14_) {
				_g_object_unref0 (device);
				continue;
			}
			if (incoming) {
				DinoPluginsRtpDevice* _tmp17_;
				gboolean _tmp18_;
				gboolean _tmp19_;
				_tmp17_ = device;
				_tmp18_ = dino_plugins_rtp_device_get_is_sink (_tmp17_);
				_tmp19_ = _tmp18_;
				_tmp16_ = !_tmp19_;
			} else {
				_tmp16_ = FALSE;
			}
			if (_tmp16_) {
				_tmp15_ = TRUE;
			} else {
				gboolean _tmp20_ = FALSE;
				if (!incoming) {
					DinoPluginsRtpDevice* _tmp21_;
					gboolean _tmp22_;
					gboolean _tmp23_;
					_tmp21_ = device;
					_tmp22_ = dino_plugins_rtp_device_get_is_source (_tmp21_);
					_tmp23_ = _tmp22_;
					_tmp20_ = !_tmp23_;
				} else {
					_tmp20_ = FALSE;
				}
				_tmp15_ = _tmp20_;
			}
			if (_tmp15_) {
				_g_object_unref0 (device);
				continue;
			}
			_tmp24_ = device;
			_tmp25_ = dino_plugins_rtp_device_get_is_monitor (_tmp24_);
			_tmp26_ = _tmp25_;
			if (_tmp26_) {
				_g_object_unref0 (device);
				continue;
			}
			_tmp27_ = device;
			_tmp28_ = dino_plugins_rtp_device_get_protocol (_tmp27_);
			_tmp29_ = _tmp28_;
			if (_tmp29_ == DINO_PLUGINS_RTP_DEVICE_PROTOCOL_PULSEAUDIO) {
				GeeArrayList* _tmp30_;
				DinoPluginsRtpDevice* _tmp31_;
				_tmp30_ = pulse_devices;
				_tmp31_ = device;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp30_, (DinoPluginsMediaDevice*) _tmp31_);
			} else {
				GeeArrayList* _tmp32_;
				DinoPluginsRtpDevice* _tmp33_;
				_tmp32_ = other_devices;
				_tmp33_ = device;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp32_, (DinoPluginsMediaDevice*) _tmp33_);
			}
			_g_object_unref0 (device);
		}
	}
	_tmp35_ = pulse_devices;
	_tmp36_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp35_);
	_tmp37_ = _tmp36_;
	if (_tmp37_ > 0) {
		GeeArrayList* _tmp38_;
		_tmp38_ = pulse_devices;
		_tmp34_ = _tmp38_;
	} else {
		GeeArrayList* _tmp39_;
		_tmp39_ = other_devices;
		_tmp34_ = _tmp39_;
	}
	_tmp40_ = _g_object_ref0 ((GeeList*) _tmp34_);
	result = _tmp40_;
	_g_object_unref0 (other_devices);
	_g_object_unref0 (pulse_devices);
	return result;
}

GeeList*
dino_plugins_rtp_plugin_get_video_sources (DinoPluginsRtpPlugin* self)
{
	GeeArrayList* pipewire_devices = NULL;
	GeeArrayList* _tmp0_;
	GeeArrayList* other_devices = NULL;
	GeeArrayList* _tmp1_;
	GeeArrayList* _tmp52_ = NULL;
	GeeArrayList* _tmp53_;
	gint _tmp54_;
	gint _tmp55_;
	GeeList* _tmp58_;
	GeeList* result;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = gee_array_list_new (DINO_PLUGINS_TYPE_MEDIA_DEVICE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	pipewire_devices = _tmp0_;
	_tmp1_ = gee_array_list_new (DINO_PLUGINS_TYPE_MEDIA_DEVICE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	other_devices = _tmp1_;
	{
		GeeList* _device_list = NULL;
		GeeList* _tmp2_;
		gint _device_size = 0;
		GeeList* _tmp3_;
		gint _tmp4_;
		gint _tmp5_;
		gint _device_index = 0;
		_tmp2_ = self->priv->devices;
		_device_list = _tmp2_;
		_tmp3_ = _device_list;
		_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
		_tmp5_ = _tmp4_;
		_device_size = _tmp5_;
		_device_index = -1;
		while (TRUE) {
			gint _tmp6_;
			gint _tmp7_;
			DinoPluginsRtpDevice* device = NULL;
			GeeList* _tmp8_;
			gpointer _tmp9_;
			DinoPluginsRtpDevice* _tmp10_;
			gchar* _tmp11_;
			gchar* _tmp12_;
			gchar* _tmp13_;
			gboolean _tmp14_;
			DinoPluginsRtpDevice* _tmp15_;
			gboolean _tmp16_;
			gboolean _tmp17_;
			DinoPluginsRtpDevice* _tmp18_;
			gboolean _tmp19_;
			gboolean _tmp20_;
			gboolean is_color = FALSE;
			DinoPluginsRtpDevice* _tmp45_;
			DinoPluginsRtpDeviceProtocol _tmp46_;
			DinoPluginsRtpDeviceProtocol _tmp47_;
			_device_index = _device_index + 1;
			_tmp6_ = _device_index;
			_tmp7_ = _device_size;
			if (!(_tmp6_ < _tmp7_)) {
				break;
			}
			_tmp8_ = _device_list;
			_tmp9_ = gee_list_get (_tmp8_, _device_index);
			device = (DinoPluginsRtpDevice*) _tmp9_;
			_tmp10_ = device;
			_tmp11_ = dino_plugins_media_device_get_media ((DinoPluginsMediaDevice*) _tmp10_);
			_tmp12_ = _tmp11_;
			_tmp13_ = _tmp12_;
			_tmp14_ = g_strcmp0 (_tmp13_, "video") != 0;
			_g_free0 (_tmp13_);
			if (_tmp14_) {
				_g_object_unref0 (device);
				continue;
			}
			_tmp15_ = device;
			_tmp16_ = dino_plugins_rtp_device_get_is_sink (_tmp15_);
			_tmp17_ = _tmp16_;
			if (_tmp17_) {
				_g_object_unref0 (device);
				continue;
			}
			_tmp18_ = device;
			_tmp19_ = dino_plugins_rtp_device_get_is_monitor (_tmp18_);
			_tmp20_ = _tmp19_;
			if (_tmp20_) {
				_g_object_unref0 (device);
				continue;
			}
			is_color = FALSE;
			{
				gint i = 0;
				i = 0;
				{
					gboolean _tmp21_ = FALSE;
					_tmp21_ = TRUE;
					while (TRUE) {
						DinoPluginsRtpDevice* _tmp23_;
						GstDevice* _tmp24_;
						GstDevice* _tmp25_;
						GstCaps* _tmp26_;
						GstCaps* _tmp27_;
						GstCaps* _tmp28_;
						gboolean _tmp29_;
						GstStructure* structure = NULL;
						DinoPluginsRtpDevice* _tmp30_;
						GstDevice* _tmp31_;
						GstDevice* _tmp32_;
						GstCaps* _tmp33_;
						GstCaps* _tmp34_;
						GstCaps* _tmp35_;
						GstStructure* _tmp36_;
						GstStructure* _tmp37_;
						GstStructure* _tmp38_;
						gchar* format = NULL;
						GstStructure* _tmp39_;
						const gchar* _tmp40_;
						gchar* _tmp41_;
						gboolean _tmp42_ = FALSE;
						const gchar* _tmp43_;
						if (!_tmp21_) {
							gint _tmp22_;
							_tmp22_ = i;
							i = _tmp22_ + 1;
						}
						_tmp21_ = FALSE;
						_tmp23_ = device;
						_tmp24_ = dino_plugins_rtp_device_get_device (_tmp23_);
						_tmp25_ = _tmp24_;
						_tmp26_ = gst_device_get_caps (_tmp25_);
						_tmp27_ = _tmp26_;
						_tmp28_ = _tmp27_;
						_tmp29_ = !(((guint) i) < gst_caps_get_size (_tmp28_));
						_gst_caps_unref0 (_tmp28_);
						if (_tmp29_) {
							break;
						}
						_tmp30_ = device;
						_tmp31_ = dino_plugins_rtp_device_get_device (_tmp30_);
						_tmp32_ = _tmp31_;
						_tmp33_ = gst_device_get_caps (_tmp32_);
						_tmp34_ = _tmp33_;
						_tmp35_ = _tmp34_;
						_tmp36_ = gst_caps_get_structure (_tmp35_, (guint) i);
						_tmp37_ = _tmp36_;
						_gst_caps_unref0 (_tmp35_);
						structure = _tmp37_;
						_tmp38_ = structure;
						if (!gst_structure_has_field (_tmp38_, "format")) {
							continue;
						}
						_tmp39_ = structure;
						_tmp40_ = gst_structure_get_string (_tmp39_, "format");
						_tmp41_ = g_strdup (_tmp40_);
						format = _tmp41_;
						_tmp43_ = format;
						if (_tmp43_ == NULL) {
							_tmp42_ = TRUE;
						} else {
							const gchar* _tmp44_;
							_tmp44_ = format;
							_tmp42_ = !g_str_has_prefix (_tmp44_, "GRAY");
						}
						if (_tmp42_) {
							is_color = TRUE;
						}
						_g_free0 (format);
					}
				}
			}
			if (!is_color) {
				_g_object_unref0 (device);
				continue;
			}
			_tmp45_ = device;
			_tmp46_ = dino_plugins_rtp_device_get_protocol (_tmp45_);
			_tmp47_ = _tmp46_;
			if (_tmp47_ == DINO_PLUGINS_RTP_DEVICE_PROTOCOL_PIPEWIRE) {
				GeeArrayList* _tmp48_;
				DinoPluginsRtpDevice* _tmp49_;
				_tmp48_ = pipewire_devices;
				_tmp49_ = device;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp48_, (DinoPluginsMediaDevice*) _tmp49_);
			} else {
				GeeArrayList* _tmp50_;
				DinoPluginsRtpDevice* _tmp51_;
				_tmp50_ = other_devices;
				_tmp51_ = device;
				gee_abstract_collection_add ((GeeAbstractCollection*) _tmp50_, (DinoPluginsMediaDevice*) _tmp51_);
			}
			_g_object_unref0 (device);
		}
	}
	_tmp53_ = pipewire_devices;
	_tmp54_ = gee_abstract_collection_get_size ((GeeAbstractCollection*) _tmp53_);
	_tmp55_ = _tmp54_;
	if (_tmp55_ > 0) {
		GeeArrayList* _tmp56_;
		_tmp56_ = pipewire_devices;
		_tmp52_ = _tmp56_;
	} else {
		GeeArrayList* _tmp57_;
		_tmp57_ = other_devices;
		_tmp52_ = _tmp57_;
	}
	_tmp58_ = _g_object_ref0 ((GeeList*) _tmp52_);
	result = _tmp58_;
	_g_object_unref0 (other_devices);
	_g_object_unref0 (pipewire_devices);
	return result;
}

static gint
dino_plugins_rtp_plugin_get_max_fps (DinoPluginsRtpPlugin* self,
                                     DinoPluginsRtpDevice* device)
{
	gint fps = 0;
	gchar* _tmp33_;
	gchar* _tmp34_;
	gchar* _tmp35_;
	gint result;
	g_return_val_if_fail (self != NULL, -1);
	g_return_val_if_fail (device != NULL, -1);
	fps = 0;
	{
		gint i = 0;
		i = 0;
		{
			gboolean _tmp0_ = FALSE;
			_tmp0_ = TRUE;
			while (TRUE) {
				GstDevice* _tmp2_;
				GstDevice* _tmp3_;
				GstCaps* _tmp4_;
				GstCaps* _tmp5_;
				GstCaps* _tmp6_;
				gboolean _tmp7_;
				GstStructure* structure = NULL;
				GstDevice* _tmp8_;
				GstDevice* _tmp9_;
				GstCaps* _tmp10_;
				GstCaps* _tmp11_;
				GstCaps* _tmp12_;
				GstStructure* _tmp13_;
				GstStructure* _tmp14_;
				GstStructure* _tmp15_;
				if (!_tmp0_) {
					gint _tmp1_;
					_tmp1_ = i;
					i = _tmp1_ + 1;
				}
				_tmp0_ = FALSE;
				_tmp2_ = dino_plugins_rtp_device_get_device (device);
				_tmp3_ = _tmp2_;
				_tmp4_ = gst_device_get_caps (_tmp3_);
				_tmp5_ = _tmp4_;
				_tmp6_ = _tmp5_;
				_tmp7_ = !(((guint) i) < gst_caps_get_size (_tmp6_));
				_gst_caps_unref0 (_tmp6_);
				if (_tmp7_) {
					break;
				}
				_tmp8_ = dino_plugins_rtp_device_get_device (device);
				_tmp9_ = _tmp8_;
				_tmp10_ = gst_device_get_caps (_tmp9_);
				_tmp11_ = _tmp10_;
				_tmp12_ = _tmp11_;
				_tmp13_ = gst_caps_get_structure (_tmp12_, (guint) i);
				_tmp14_ = _tmp13_;
				_gst_caps_unref0 (_tmp12_);
				structure = _tmp14_;
				_tmp15_ = structure;
				if (gst_structure_has_field (_tmp15_, "framerate")) {
					GValue framerate = {0};
					GstStructure* _tmp16_;
					GValue _tmp17_;
					GValue _tmp18_ = {0};
					_tmp16_ = structure;
					_tmp17_ = *gst_structure_get_value (_tmp16_, "framerate");
					if (G_IS_VALUE (&_tmp17_)) {
						g_value_init (&_tmp18_, G_VALUE_TYPE (&_tmp17_));
						g_value_copy (&_tmp17_, &_tmp18_);
					} else {
						_tmp18_ = _tmp17_;
					}
					framerate = _tmp18_;
					if (G_VALUE_TYPE (&framerate) == gst_fraction_get_type ()) {
						gint num = 0;
						GValue _tmp19_;
						gint den = 0;
						GValue _tmp20_;
						_tmp19_ = framerate;
						num = gst_value_get_fraction_numerator (&_tmp19_);
						_tmp20_ = framerate;
						den = gst_value_get_fraction_denominator (&_tmp20_);
						fps = MAX (fps, num / den);
					} else {
						if (G_VALUE_TYPE (&framerate) == gst_value_list_get_type ()) {
							{
								guint j = 0U;
								j = (guint) 0;
								{
									gboolean _tmp21_ = FALSE;
									_tmp21_ = TRUE;
									while (TRUE) {
										GValue _tmp23_;
										GValue fraction = {0};
										GValue _tmp24_;
										GValue _tmp25_;
										GValue _tmp26_ = {0};
										gint num = 0;
										GValue _tmp27_;
										gint den = 0;
										GValue _tmp28_;
										if (!_tmp21_) {
											guint _tmp22_;
											_tmp22_ = j;
											j = _tmp22_ + 1;
										}
										_tmp21_ = FALSE;
										_tmp23_ = framerate;
										if (!(j < gst_value_list_get_size (&_tmp23_))) {
											break;
										}
										_tmp24_ = framerate;
										_tmp25_ = *gst_value_list_get_value (&_tmp24_, j);
										if (G_IS_VALUE (&_tmp25_)) {
											g_value_init (&_tmp26_, G_VALUE_TYPE (&_tmp25_));
											g_value_copy (&_tmp25_, &_tmp26_);
										} else {
											_tmp26_ = _tmp25_;
										}
										fraction = _tmp26_;
										_tmp27_ = fraction;
										num = gst_value_get_fraction_numerator (&_tmp27_);
										_tmp28_ = fraction;
										den = gst_value_get_fraction_denominator (&_tmp28_);
										fps = MAX (fps, num / den);
										G_IS_VALUE (&fraction) ? (g_value_unset (&fraction), NULL) : NULL;
									}
								}
							}
						} else {
							const gchar* _tmp29_;
							gchar* _tmp30_;
							gchar* _tmp31_;
							gchar* _tmp32_;
							_tmp29_ = G_VALUE_TYPE_NAME (&framerate);
							_tmp30_ = dino_plugins_media_device_get_display_name ((DinoPluginsMediaDevice*) device);
							_tmp31_ = _tmp30_;
							_tmp32_ = _tmp31_;
							g_debug ("plugin.vala:424: Unknown type for framerate %s on device %s", _tmp29_, _tmp32_);
							_g_free0 (_tmp32_);
						}
					}
					G_IS_VALUE (&framerate) ? (g_value_unset (&framerate), NULL) : NULL;
				}
			}
		}
	}
	_tmp33_ = dino_plugins_media_device_get_display_name ((DinoPluginsMediaDevice*) device);
	_tmp34_ = _tmp33_;
	_tmp35_ = _tmp34_;
	g_debug ("plugin.vala:429: Max framerate for device %s: %d", _tmp35_, fps);
	_g_free0 (_tmp35_);
	result = fps;
	return result;
}

static DinoPluginsMediaDevice*
dino_plugins_rtp_plugin_real_get_preferred_device (DinoPluginsVideoCallPlugin* base,
                                                   const gchar* media,
                                                   gboolean incoming)
{
	DinoPluginsRtpPlugin * self;
	GeeList* devices = NULL;
	GeeArrayList* _tmp0_;
	GeeList* _tmp12_;
	gboolean _tmp13_;
	gboolean _tmp14_;
	DinoPluginsMediaDevice* result;
	self = (DinoPluginsRtpPlugin*) base;
	g_return_val_if_fail (media != NULL, NULL);
	_tmp0_ = gee_array_list_new (DINO_PLUGINS_RTP_TYPE_DEVICE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	devices = (GeeList*) _tmp0_;
	{
		GeeList* _media_device_list = NULL;
		GeeList* _tmp1_;
		gint _media_device_size = 0;
		GeeList* _tmp2_;
		gint _tmp3_;
		gint _tmp4_;
		gint _media_device_index = 0;
		_tmp1_ = dino_plugins_video_call_plugin_get_devices ((DinoPluginsVideoCallPlugin*) self, media, incoming);
		_media_device_list = _tmp1_;
		_tmp2_ = _media_device_list;
		_tmp3_ = gee_collection_get_size ((GeeCollection*) _tmp2_);
		_tmp4_ = _tmp3_;
		_media_device_size = _tmp4_;
		_media_device_index = -1;
		while (TRUE) {
			gint _tmp5_;
			gint _tmp6_;
			DinoPluginsMediaDevice* media_device = NULL;
			GeeList* _tmp7_;
			gpointer _tmp8_;
			DinoPluginsMediaDevice* _tmp9_;
			_media_device_index = _media_device_index + 1;
			_tmp5_ = _media_device_index;
			_tmp6_ = _media_device_size;
			if (!(_tmp5_ < _tmp6_)) {
				break;
			}
			_tmp7_ = _media_device_list;
			_tmp8_ = gee_list_get (_tmp7_, _media_device_index);
			media_device = (DinoPluginsMediaDevice*) _tmp8_;
			_tmp9_ = media_device;
			if (DINO_PLUGINS_RTP_IS_DEVICE (_tmp9_)) {
				GeeList* _tmp10_;
				DinoPluginsMediaDevice* _tmp11_;
				_tmp10_ = devices;
				_tmp11_ = media_device;
				gee_collection_add ((GeeCollection*) _tmp10_, G_TYPE_CHECK_INSTANCE_CAST (_tmp11_, DINO_PLUGINS_RTP_TYPE_DEVICE, DinoPluginsRtpDevice));
			}
			_g_object_unref0 (media_device);
		}
		_g_object_unref0 (_media_device_list);
	}
	_tmp12_ = devices;
	_tmp13_ = gee_collection_get_is_empty ((GeeCollection*) _tmp12_);
	_tmp14_ = _tmp13_;
	if (_tmp14_) {
		const gchar* _tmp15_ = NULL;
		if (incoming) {
			_tmp15_ = "incoming";
		} else {
			_tmp15_ = "outgoing";
		}
		g_warning ("plugin.vala:439: No preferred device for %s %s. Media will not be proc" \
"essed.", _tmp15_, media);
		result = NULL;
		_g_object_unref0 (devices);
		return result;
	}
	{
		GeeList* _device_list = NULL;
		GeeList* _tmp16_;
		gint _device_size = 0;
		GeeList* _tmp17_;
		gint _tmp18_;
		gint _tmp19_;
		gint _device_index = 0;
		_tmp16_ = devices;
		_device_list = _tmp16_;
		_tmp17_ = _device_list;
		_tmp18_ = gee_collection_get_size ((GeeCollection*) _tmp17_);
		_tmp19_ = _tmp18_;
		_device_size = _tmp19_;
		_device_index = -1;
		while (TRUE) {
			gint _tmp20_;
			gint _tmp21_;
			DinoPluginsRtpDevice* device = NULL;
			GeeList* _tmp22_;
			gpointer _tmp23_;
			DinoPluginsRtpDevice* _tmp24_;
			gboolean _tmp25_;
			gboolean _tmp26_;
			_device_index = _device_index + 1;
			_tmp20_ = _device_index;
			_tmp21_ = _device_size;
			if (!(_tmp20_ < _tmp21_)) {
				break;
			}
			_tmp22_ = _device_list;
			_tmp23_ = gee_list_get (_tmp22_, _device_index);
			device = (DinoPluginsRtpDevice*) _tmp23_;
			_tmp24_ = device;
			_tmp25_ = dino_plugins_rtp_device_get_is_default (_tmp24_);
			_tmp26_ = _tmp25_;
			if (_tmp26_) {
				const gchar* _tmp27_ = NULL;
				DinoPluginsRtpDevice* _tmp28_;
				gchar* _tmp29_;
				gchar* _tmp30_;
				gchar* _tmp31_;
				if (incoming) {
					_tmp27_ = "incoming";
				} else {
					_tmp27_ = "outgoing";
				}
				_tmp28_ = device;
				_tmp29_ = dino_plugins_media_device_get_display_name ((DinoPluginsMediaDevice*) _tmp28_);
				_tmp30_ = _tmp29_;
				_tmp31_ = _tmp30_;
				g_debug ("plugin.vala:446: Using %s for %s %s as it's default", _tmp31_, _tmp27_, media);
				_g_free0 (_tmp31_);
				result = (DinoPluginsMediaDevice*) device;
				_g_object_unref0 (devices);
				return result;
			}
			_g_object_unref0 (device);
		}
	}
	if (g_strcmp0 (media, "video") == 0) {
		gint max_fps = 0;
		DinoPluginsRtpDevice* max_fps_device = NULL;
		const gchar* _tmp45_ = NULL;
		DinoPluginsRtpDevice* _tmp46_;
		gchar* _tmp47_;
		gchar* _tmp48_;
		gchar* _tmp49_;
		max_fps = -1;
		max_fps_device = NULL;
		{
			GeeList* _device_list = NULL;
			GeeList* _tmp32_;
			gint _device_size = 0;
			GeeList* _tmp33_;
			gint _tmp34_;
			gint _tmp35_;
			gint _device_index = 0;
			_tmp32_ = devices;
			_device_list = _tmp32_;
			_tmp33_ = _device_list;
			_tmp34_ = gee_collection_get_size ((GeeCollection*) _tmp33_);
			_tmp35_ = _tmp34_;
			_device_size = _tmp35_;
			_device_index = -1;
			while (TRUE) {
				gint _tmp36_;
				gint _tmp37_;
				DinoPluginsRtpDevice* device = NULL;
				GeeList* _tmp38_;
				gpointer _tmp39_;
				gint fps = 0;
				DinoPluginsRtpDevice* _tmp40_;
				gboolean _tmp41_ = FALSE;
				_device_index = _device_index + 1;
				_tmp36_ = _device_index;
				_tmp37_ = _device_size;
				if (!(_tmp36_ < _tmp37_)) {
					break;
				}
				_tmp38_ = _device_list;
				_tmp39_ = gee_list_get (_tmp38_, _device_index);
				device = (DinoPluginsRtpDevice*) _tmp39_;
				_tmp40_ = device;
				fps = dino_plugins_rtp_plugin_get_max_fps (self, _tmp40_);
				if (fps > max_fps) {
					_tmp41_ = TRUE;
				} else {
					DinoPluginsRtpDevice* _tmp42_;
					_tmp42_ = max_fps_device;
					_tmp41_ = _tmp42_ == NULL;
				}
				if (_tmp41_) {
					DinoPluginsRtpDevice* _tmp43_;
					DinoPluginsRtpDevice* _tmp44_;
					max_fps = fps;
					_tmp43_ = device;
					_tmp44_ = _g_object_ref0 (_tmp43_);
					_g_object_unref0 (max_fps_device);
					max_fps_device = _tmp44_;
				}
				_g_object_unref0 (device);
			}
		}
		if (incoming) {
			_tmp45_ = "incoming";
		} else {
			_tmp45_ = "outgoing";
		}
		_tmp46_ = max_fps_device;
		_tmp47_ = dino_plugins_media_device_get_display_name ((DinoPluginsMediaDevice*) _tmp46_);
		_tmp48_ = _tmp47_;
		_tmp49_ = _tmp48_;
		g_debug ("plugin.vala:462: Using %s for %s %s as it has max FPS (%d)", _tmp49_, _tmp45_, media, max_fps);
		_g_free0 (_tmp49_);
		result = (DinoPluginsMediaDevice*) max_fps_device;
		_g_object_unref0 (devices);
		return result;
	} else {
		DinoPluginsRtpDevice* device = NULL;
		GeeList* _tmp50_;
		gpointer _tmp51_;
		const gchar* _tmp52_ = NULL;
		DinoPluginsRtpDevice* _tmp53_;
		gchar* _tmp54_;
		gchar* _tmp55_;
		gchar* _tmp56_;
		_tmp50_ = devices;
		_tmp51_ = gee_list_first (_tmp50_);
		device = (DinoPluginsRtpDevice*) _tmp51_;
		if (incoming) {
			_tmp52_ = "incoming";
		} else {
			_tmp52_ = "outgoing";
		}
		_tmp53_ = device;
		_tmp54_ = dino_plugins_media_device_get_display_name ((DinoPluginsMediaDevice*) _tmp53_);
		_tmp55_ = _tmp54_;
		_tmp56_ = _tmp55_;
		g_debug ("plugin.vala:467: Using %s for %s %s as it's first pick", _tmp56_, _tmp52_, media);
		_g_free0 (_tmp56_);
		result = (DinoPluginsMediaDevice*) device;
		_g_object_unref0 (devices);
		return result;
	}
}

static DinoPluginsMediaDevice*
dino_plugins_rtp_plugin_real_get_device (DinoPluginsVideoCallPlugin* base,
                                         XmppXepJingleRtpStream* stream,
                                         gboolean incoming)
{
	DinoPluginsRtpPlugin * self;
	DinoPluginsRtpStream* plugin_stream = NULL;
	DinoPluginsRtpStream* _tmp0_;
	DinoPluginsRtpStream* _tmp1_;
	DinoPluginsRtpDevice* _tmp2_ = NULL;
	DinoPluginsMediaDevice* device = NULL;
	DinoPluginsMediaDevice* _tmp9_;
	DinoPluginsMediaDevice* _tmp10_ = NULL;
	DinoPluginsMediaDevice* _tmp11_;
	DinoPluginsMediaDevice* _tmp12_;
	DinoPluginsMediaDevice* _tmp16_;
	DinoPluginsMediaDevice* result;
	self = (DinoPluginsRtpPlugin*) base;
	_tmp0_ = _g_object_ref0 (DINO_PLUGINS_RTP_IS_STREAM (stream) ? ((DinoPluginsRtpStream*) stream) : NULL);
	plugin_stream = _tmp0_;
	_tmp1_ = plugin_stream;
	if (_tmp1_ == NULL) {
		result = NULL;
		_g_object_unref0 (plugin_stream);
		return result;
	}
	if (incoming) {
		DinoPluginsRtpStream* _tmp3_;
		DinoPluginsRtpDevice* _tmp4_;
		DinoPluginsRtpDevice* _tmp5_;
		_tmp3_ = plugin_stream;
		_tmp4_ = dino_plugins_rtp_stream_get_output_device (_tmp3_);
		_tmp5_ = _tmp4_;
		_tmp2_ = _tmp5_;
	} else {
		DinoPluginsRtpStream* _tmp6_;
		DinoPluginsRtpDevice* _tmp7_;
		DinoPluginsRtpDevice* _tmp8_;
		_tmp6_ = plugin_stream;
		_tmp7_ = dino_plugins_rtp_stream_get_input_device (_tmp6_);
		_tmp8_ = _tmp7_;
		_tmp2_ = _tmp8_;
	}
	_tmp9_ = _g_object_ref0 ((DinoPluginsMediaDevice*) _tmp2_);
	device = _tmp9_;
	_tmp11_ = device;
	_tmp12_ = _g_object_ref0 (_tmp11_);
	_tmp10_ = _tmp12_;
	if (_tmp10_ == NULL) {
		const gchar* _tmp13_;
		const gchar* _tmp14_;
		DinoPluginsMediaDevice* _tmp15_;
		_tmp13_ = xmpp_xep_jingle_rtp_stream_get_media (stream);
		_tmp14_ = _tmp13_;
		_tmp15_ = dino_plugins_video_call_plugin_get_preferred_device ((DinoPluginsVideoCallPlugin*) self, _tmp14_, incoming);
		_g_object_unref0 (_tmp10_);
		_tmp10_ = _tmp15_;
	}
	_tmp16_ = _tmp10_;
	_tmp10_ = NULL;
	result = _tmp16_;
	_g_object_unref0 (_tmp10_);
	_g_object_unref0 (device);
	_g_object_unref0 (plugin_stream);
	return result;
}

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

static void
dino_plugins_rtp_plugin_real_dump_dot (DinoPluginsVideoCallPlugin* base)
{
	DinoPluginsRtpPlugin * self;
	GstPipeline* _tmp0_;
	gchar* name = NULL;
	GstPipeline* _tmp1_;
	GstClock* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GstPipeline* _tmp5_;
	GEnumValue* _tmp6_;
	gchar* _tmp7_;
	gchar* _tmp8_;
	GstPipeline* _tmp9_;
	const gchar* _tmp10_;
	const gchar* _tmp11_;
	const gchar* _tmp12_;
	gchar* _tmp13_;
	gchar* _tmp14_;
	self = (DinoPluginsRtpPlugin*) base;
	_tmp0_ = self->priv->_pipe;
	if (_tmp0_ == NULL) {
		return;
	}
	_tmp1_ = self->priv->_pipe;
	_tmp2_ = ((GstElement*) _tmp1_)->clock;
	_tmp3_ = g_strdup_printf ("%" G_GUINT64_FORMAT, (guint64) gst_clock_get_time (_tmp2_));
	_tmp4_ = _tmp3_;
	_tmp5_ = self->priv->_pipe;
	_tmp6_ = g_enum_get_value (g_type_class_ref (gst_state_get_type ()), ((GstElement*) _tmp5_)->current_state);
	_tmp7_ = g_strconcat ("pipe-", _tmp4_, "-", (_tmp6_ != NULL) ? _tmp6_->value_name : NULL, NULL);
	_tmp8_ = _tmp7_;
	_g_free0 (_tmp4_);
	name = _tmp8_;
	_tmp9_ = self->priv->_pipe;
	_tmp10_ = name;
	gst_debug_bin_to_dot_file ((GstBin*) _tmp9_, GST_DEBUG_GRAPH_SHOW_ALL, _tmp10_);
	_tmp11_ = name;
	_tmp12_ = string_to_string (_tmp11_);
	_tmp13_ = g_strconcat ("Stored pipe details as ", _tmp12_, "\n", NULL);
	_tmp14_ = _tmp13_;
	g_print ("%s", _tmp14_);
	_g_free0 (_tmp14_);
	_g_free0 (name);
}

static void
dino_plugins_rtp_plugin_real_set_pause (DinoPluginsVideoCallPlugin* base,
                                        XmppXepJingleRtpStream* stream,
                                        gboolean pause)
{
	DinoPluginsRtpPlugin * self;
	DinoPluginsRtpStream* plugin_stream = NULL;
	DinoPluginsRtpStream* _tmp0_;
	DinoPluginsRtpStream* _tmp1_;
	self = (DinoPluginsRtpPlugin*) base;
	_tmp0_ = _g_object_ref0 (DINO_PLUGINS_RTP_IS_STREAM (stream) ? ((DinoPluginsRtpStream*) stream) : NULL);
	plugin_stream = _tmp0_;
	_tmp1_ = plugin_stream;
	if (_tmp1_ == NULL) {
		_g_object_unref0 (plugin_stream);
		return;
	}
	if (pause) {
		DinoPluginsRtpStream* _tmp2_;
		_tmp2_ = plugin_stream;
		dino_plugins_rtp_stream_pause (_tmp2_);
	} else {
		DinoPluginsRtpStream* _tmp3_;
		_tmp3_ = plugin_stream;
		dino_plugins_rtp_stream_unpause (_tmp3_);
	}
	_g_object_unref0 (plugin_stream);
}

static void
dino_plugins_rtp_plugin_real_set_device (DinoPluginsVideoCallPlugin* base,
                                         XmppXepJingleRtpStream* stream,
                                         DinoPluginsMediaDevice* device)
{
	DinoPluginsRtpPlugin * self;
	DinoPluginsRtpDevice* real_device = NULL;
	DinoPluginsRtpDevice* _tmp0_;
	DinoPluginsRtpStream* plugin_stream = NULL;
	DinoPluginsRtpStream* _tmp1_;
	gboolean _tmp2_ = FALSE;
	DinoPluginsRtpDevice* _tmp3_;
	DinoPluginsRtpDevice* _tmp5_;
	gboolean _tmp6_;
	gboolean _tmp7_;
	self = (DinoPluginsRtpPlugin*) base;
	_tmp0_ = _g_object_ref0 (DINO_PLUGINS_RTP_IS_DEVICE (device) ? ((DinoPluginsRtpDevice*) device) : NULL);
	real_device = _tmp0_;
	_tmp1_ = _g_object_ref0 (DINO_PLUGINS_RTP_IS_STREAM (stream) ? ((DinoPluginsRtpStream*) stream) : NULL);
	plugin_stream = _tmp1_;
	_tmp3_ = real_device;
	if (_tmp3_ == NULL) {
		_tmp2_ = TRUE;
	} else {
		DinoPluginsRtpStream* _tmp4_;
		_tmp4_ = plugin_stream;
		_tmp2_ = _tmp4_ == NULL;
	}
	if (_tmp2_) {
		_g_object_unref0 (plugin_stream);
		_g_object_unref0 (real_device);
		return;
	}
	_tmp5_ = real_device;
	_tmp6_ = dino_plugins_rtp_device_get_is_source (_tmp5_);
	_tmp7_ = _tmp6_;
	if (_tmp7_) {
		DinoPluginsRtpStream* _tmp8_;
		DinoPluginsRtpDevice* _tmp9_;
		_tmp8_ = plugin_stream;
		_tmp9_ = real_device;
		dino_plugins_rtp_stream_set_input_device (_tmp8_, _tmp9_);
	} else {
		DinoPluginsRtpDevice* _tmp10_;
		gboolean _tmp11_;
		gboolean _tmp12_;
		_tmp10_ = real_device;
		_tmp11_ = dino_plugins_rtp_device_get_is_sink (_tmp10_);
		_tmp12_ = _tmp11_;
		if (_tmp12_) {
			DinoPluginsRtpStream* _tmp13_;
			DinoPluginsRtpDevice* _tmp14_;
			_tmp13_ = plugin_stream;
			_tmp14_ = real_device;
			dino_plugins_rtp_stream_set_output_device (_tmp13_, _tmp14_);
		}
	}
	_g_object_unref0 (plugin_stream);
	_g_object_unref0 (real_device);
}

DinoPluginsRtpPlugin*
dino_plugins_rtp_plugin_construct (GType object_type)
{
	DinoPluginsRtpPlugin * self = NULL;
	self = (DinoPluginsRtpPlugin*) g_object_new (object_type, NULL);
	return self;
}

DinoPluginsRtpPlugin*
dino_plugins_rtp_plugin_new (void)
{
	return dino_plugins_rtp_plugin_construct (DINO_PLUGINS_RTP_TYPE_PLUGIN);
}

DinoApplication*
dino_plugins_rtp_plugin_get_app (DinoPluginsRtpPlugin* self)
{
	DinoApplication* result;
	DinoApplication* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_app;
	result = _tmp0_;
	return result;
}

static void
dino_plugins_rtp_plugin_set_app (DinoPluginsRtpPlugin* self,
                                 DinoApplication* value)
{
	DinoApplication* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_plugins_rtp_plugin_get_app (self);
	if (old_value != value) {
		DinoApplication* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_app);
		self->priv->_app = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_APP_PROPERTY]);
	}
}

DinoPluginsRtpCodecUtil*
dino_plugins_rtp_plugin_get_codec_util (DinoPluginsRtpPlugin* self)
{
	DinoPluginsRtpCodecUtil* result;
	DinoPluginsRtpCodecUtil* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_codec_util;
	result = _tmp0_;
	return result;
}

static gpointer
_dino_plugins_rtp_codec_util_ref0 (gpointer self)
{
	return self ? dino_plugins_rtp_codec_util_ref (self) : NULL;
}

static void
dino_plugins_rtp_plugin_set_codec_util (DinoPluginsRtpPlugin* self,
                                        DinoPluginsRtpCodecUtil* value)
{
	DinoPluginsRtpCodecUtil* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_plugins_rtp_plugin_get_codec_util (self);
	if (old_value != value) {
		DinoPluginsRtpCodecUtil* _tmp0_;
		_tmp0_ = _dino_plugins_rtp_codec_util_ref0 (value);
		_dino_plugins_rtp_codec_util_unref0 (self->priv->_codec_util);
		self->priv->_codec_util = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_CODEC_UTIL_PROPERTY]);
	}
}

GstDeviceMonitor*
dino_plugins_rtp_plugin_get_device_monitor (DinoPluginsRtpPlugin* self)
{
	GstDeviceMonitor* result;
	GstDeviceMonitor* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_device_monitor;
	result = _tmp0_;
	return result;
}

static void
dino_plugins_rtp_plugin_set_device_monitor (DinoPluginsRtpPlugin* self,
                                            GstDeviceMonitor* value)
{
	GstDeviceMonitor* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_plugins_rtp_plugin_get_device_monitor (self);
	if (old_value != value) {
		GstDeviceMonitor* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_device_monitor);
		self->priv->_device_monitor = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_DEVICE_MONITOR_PROPERTY]);
	}
}

GstPipeline*
dino_plugins_rtp_plugin_get_pipe (DinoPluginsRtpPlugin* self)
{
	GstPipeline* result;
	GstPipeline* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_pipe;
	result = _tmp0_;
	return result;
}

static void
dino_plugins_rtp_plugin_set_pipe (DinoPluginsRtpPlugin* self,
                                  GstPipeline* value)
{
	GstPipeline* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_plugins_rtp_plugin_get_pipe (self);
	if (old_value != value) {
		GstPipeline* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_pipe);
		self->priv->_pipe = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_PIPE_PROPERTY]);
	}
}

GstBin*
dino_plugins_rtp_plugin_get_rtpbin (DinoPluginsRtpPlugin* self)
{
	GstBin* result;
	GstBin* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_rtpbin;
	result = _tmp0_;
	return result;
}

static void
dino_plugins_rtp_plugin_set_rtpbin (DinoPluginsRtpPlugin* self,
                                    GstBin* value)
{
	GstBin* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_plugins_rtp_plugin_get_rtpbin (self);
	if (old_value != value) {
		GstBin* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_rtpbin);
		self->priv->_rtpbin = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_RTPBIN_PROPERTY]);
	}
}

GstElement*
dino_plugins_rtp_plugin_get_echoprobe (DinoPluginsRtpPlugin* self)
{
	GstElement* result;
	GstElement* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_echoprobe;
	result = _tmp0_;
	return result;
}

static void
dino_plugins_rtp_plugin_set_echoprobe (DinoPluginsRtpPlugin* self,
                                       GstElement* value)
{
	GstElement* old_value;
	g_return_if_fail (self != NULL);
	old_value = dino_plugins_rtp_plugin_get_echoprobe (self);
	if (old_value != value) {
		GstElement* _tmp0_;
		_tmp0_ = _g_object_ref0 (value);
		_g_object_unref0 (self->priv->_echoprobe);
		self->priv->_echoprobe = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_ECHOPROBE_PROPERTY]);
	}
}

static void
dino_plugins_rtp_plugin_class_init (DinoPluginsRtpPluginClass * klass,
                                    gpointer klass_data)
{
	dino_plugins_rtp_plugin_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &DinoPluginsRtpPlugin_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_dino_plugins_rtp_plugin_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_dino_plugins_rtp_plugin_set_property;
	G_OBJECT_CLASS (klass)->finalize = dino_plugins_rtp_plugin_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PLUGINS_RTP_PLUGIN_APP_PROPERTY, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_APP_PROPERTY] = g_param_spec_object ("app", "app", "app", DINO_TYPE_APPLICATION, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PLUGINS_RTP_PLUGIN_CODEC_UTIL_PROPERTY, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_CODEC_UTIL_PROPERTY] = dino_plugins_rtp_param_spec_codec_util ("codec-util", "codec-util", "codec-util", DINO_PLUGINS_RTP_TYPE_CODEC_UTIL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PLUGINS_RTP_PLUGIN_DEVICE_MONITOR_PROPERTY, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_DEVICE_MONITOR_PROPERTY] = g_param_spec_object ("device-monitor", "device-monitor", "device-monitor", gst_device_monitor_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PLUGINS_RTP_PLUGIN_PIPE_PROPERTY, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_PIPE_PROPERTY] = g_param_spec_object ("pipe", "pipe", "pipe", gst_pipeline_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PLUGINS_RTP_PLUGIN_RTPBIN_PROPERTY, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_RTPBIN_PROPERTY] = g_param_spec_object ("rtpbin", "rtpbin", "rtpbin", gst_bin_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), DINO_PLUGINS_RTP_PLUGIN_ECHOPROBE_PROPERTY, dino_plugins_rtp_plugin_properties[DINO_PLUGINS_RTP_PLUGIN_ECHOPROBE_PROPERTY] = g_param_spec_object ("echoprobe", "echoprobe", "echoprobe", gst_element_get_type (), G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
dino_plugins_rtp_plugin_dino_plugins_root_interface_interface_init (DinoPluginsRootInterfaceIface * iface,
                                                                    gpointer iface_data)
{
	dino_plugins_rtp_plugin_dino_plugins_root_interface_parent_iface = g_type_interface_peek_parent (iface);
	iface->registered = (void (*) (DinoPluginsRootInterface*, DinoApplication*)) dino_plugins_rtp_plugin_real_registered;
	iface->shutdown = (void (*) (DinoPluginsRootInterface*)) dino_plugins_rtp_plugin_real_shutdown;
}

static void
dino_plugins_rtp_plugin_dino_plugins_video_call_plugin_interface_init (DinoPluginsVideoCallPluginIface * iface,
                                                                       gpointer iface_data)
{
	dino_plugins_rtp_plugin_dino_plugins_video_call_plugin_parent_iface = g_type_interface_peek_parent (iface);
	iface->supported = (gboolean (*) (DinoPluginsVideoCallPlugin*)) dino_plugins_rtp_plugin_real_supported;
	iface->create_widget = (DinoPluginsVideoCallWidget* (*) (DinoPluginsVideoCallPlugin*, DinoPluginsWidgetType)) dino_plugins_rtp_plugin_real_create_widget;
	iface->get_devices = (GeeList* (*) (DinoPluginsVideoCallPlugin*, const gchar*, gboolean)) dino_plugins_rtp_plugin_real_get_devices;
	iface->get_preferred_device = (DinoPluginsMediaDevice* (*) (DinoPluginsVideoCallPlugin*, const gchar*, gboolean)) dino_plugins_rtp_plugin_real_get_preferred_device;
	iface->get_device = (DinoPluginsMediaDevice* (*) (DinoPluginsVideoCallPlugin*, XmppXepJingleRtpStream*, gboolean)) dino_plugins_rtp_plugin_real_get_device;
	iface->dump_dot = (void (*) (DinoPluginsVideoCallPlugin*)) dino_plugins_rtp_plugin_real_dump_dot;
	iface->set_pause = (void (*) (DinoPluginsVideoCallPlugin*, XmppXepJingleRtpStream*, gboolean)) dino_plugins_rtp_plugin_real_set_pause;
	iface->set_device = (void (*) (DinoPluginsVideoCallPlugin*, XmppXepJingleRtpStream*, DinoPluginsMediaDevice*)) dino_plugins_rtp_plugin_real_set_device;
}

static void
dino_plugins_rtp_plugin_instance_init (DinoPluginsRtpPlugin * self,
                                       gpointer klass)
{
	GeeArrayList* _tmp0_;
	GeeArrayList* _tmp1_;
	self->priv = dino_plugins_rtp_plugin_get_instance_private (self);
	_tmp0_ = gee_array_list_new (DINO_PLUGINS_RTP_TYPE_STREAM, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->streams = (GeeList*) _tmp0_;
	_tmp1_ = gee_array_list_new (DINO_PLUGINS_RTP_TYPE_DEVICE, (GBoxedCopyFunc) g_object_ref, (GDestroyNotify) g_object_unref, NULL, NULL, NULL);
	self->priv->devices = (GeeList*) _tmp1_;
	self->priv->last_devices_refresh = (gint64) 0;
	self->priv->pause_count = 0;
}

static void
dino_plugins_rtp_plugin_finalize (GObject * obj)
{
	DinoPluginsRtpPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, DINO_PLUGINS_RTP_TYPE_PLUGIN, DinoPluginsRtpPlugin);
	_g_object_unref0 (self->priv->_app);
	_dino_plugins_rtp_codec_util_unref0 (self->priv->_codec_util);
	_g_object_unref0 (self->priv->_device_monitor);
	_g_object_unref0 (self->priv->_pipe);
	_g_object_unref0 (self->priv->_rtpbin);
	_g_object_unref0 (self->priv->_echoprobe);
	_g_object_unref0 (self->priv->streams);
	_g_object_unref0 (self->priv->devices);
	G_OBJECT_CLASS (dino_plugins_rtp_plugin_parent_class)->finalize (obj);
}

static GType
dino_plugins_rtp_plugin_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (DinoPluginsRtpPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) dino_plugins_rtp_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (DinoPluginsRtpPlugin), 0, (GInstanceInitFunc) dino_plugins_rtp_plugin_instance_init, NULL };
	static const GInterfaceInfo dino_plugins_root_interface_info = { (GInterfaceInitFunc) dino_plugins_rtp_plugin_dino_plugins_root_interface_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	static const GInterfaceInfo dino_plugins_video_call_plugin_info = { (GInterfaceInitFunc) dino_plugins_rtp_plugin_dino_plugins_video_call_plugin_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
	GType dino_plugins_rtp_plugin_type_id;
	dino_plugins_rtp_plugin_type_id = g_type_register_static (G_TYPE_OBJECT, "DinoPluginsRtpPlugin", &g_define_type_info, 0);
	g_type_add_interface_static (dino_plugins_rtp_plugin_type_id, DINO_PLUGINS_TYPE_ROOT_INTERFACE, &dino_plugins_root_interface_info);
	g_type_add_interface_static (dino_plugins_rtp_plugin_type_id, DINO_PLUGINS_TYPE_VIDEO_CALL_PLUGIN, &dino_plugins_video_call_plugin_info);
	DinoPluginsRtpPlugin_private_offset = g_type_add_instance_private (dino_plugins_rtp_plugin_type_id, sizeof (DinoPluginsRtpPluginPrivate));
	return dino_plugins_rtp_plugin_type_id;
}

GType
dino_plugins_rtp_plugin_get_type (void)
{
	static volatile gsize dino_plugins_rtp_plugin_type_id__once = 0;
	if (g_once_init_enter (&dino_plugins_rtp_plugin_type_id__once)) {
		GType dino_plugins_rtp_plugin_type_id;
		dino_plugins_rtp_plugin_type_id = dino_plugins_rtp_plugin_get_type_once ();
		g_once_init_leave (&dino_plugins_rtp_plugin_type_id__once, dino_plugins_rtp_plugin_type_id);
	}
	return dino_plugins_rtp_plugin_type_id__once;
}

static void
_vala_dino_plugins_rtp_plugin_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec)
{
	DinoPluginsRtpPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_PLUGINS_RTP_TYPE_PLUGIN, DinoPluginsRtpPlugin);
	switch (property_id) {
		case DINO_PLUGINS_RTP_PLUGIN_APP_PROPERTY:
		g_value_set_object (value, dino_plugins_rtp_plugin_get_app (self));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_CODEC_UTIL_PROPERTY:
		dino_plugins_rtp_value_set_codec_util (value, dino_plugins_rtp_plugin_get_codec_util (self));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_DEVICE_MONITOR_PROPERTY:
		g_value_set_object (value, dino_plugins_rtp_plugin_get_device_monitor (self));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_PIPE_PROPERTY:
		g_value_set_object (value, dino_plugins_rtp_plugin_get_pipe (self));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_RTPBIN_PROPERTY:
		g_value_set_object (value, dino_plugins_rtp_plugin_get_rtpbin (self));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_ECHOPROBE_PROPERTY:
		g_value_set_object (value, dino_plugins_rtp_plugin_get_echoprobe (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_dino_plugins_rtp_plugin_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec)
{
	DinoPluginsRtpPlugin * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, DINO_PLUGINS_RTP_TYPE_PLUGIN, DinoPluginsRtpPlugin);
	switch (property_id) {
		case DINO_PLUGINS_RTP_PLUGIN_APP_PROPERTY:
		dino_plugins_rtp_plugin_set_app (self, g_value_get_object (value));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_CODEC_UTIL_PROPERTY:
		dino_plugins_rtp_plugin_set_codec_util (self, dino_plugins_rtp_value_get_codec_util (value));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_DEVICE_MONITOR_PROPERTY:
		dino_plugins_rtp_plugin_set_device_monitor (self, g_value_get_object (value));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_PIPE_PROPERTY:
		dino_plugins_rtp_plugin_set_pipe (self, g_value_get_object (value));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_RTPBIN_PROPERTY:
		dino_plugins_rtp_plugin_set_rtpbin (self, g_value_get_object (value));
		break;
		case DINO_PLUGINS_RTP_PLUGIN_ECHOPROBE_PROPERTY:
		dino_plugins_rtp_plugin_set_echoprobe (self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_array_destroy (gpointer array,
                     gssize array_length,
                     GDestroyNotify destroy_func)
{
	if ((array != NULL) && (destroy_func != NULL)) {
		gssize i;
		for (i = 0; i < array_length; i = i + 1) {
			if (((gpointer*) array)[i] != NULL) {
				destroy_func (((gpointer*) array)[i]);
			}
		}
	}
}

static void
_vala_array_free (gpointer array,
                  gssize array_length,
                  GDestroyNotify destroy_func)
{
	_vala_array_destroy (array, array_length, destroy_func);
	g_free (array);
}

static gssize
_vala_array_length (gpointer array)
{
	gssize length;
	length = 0;
	if (array) {
		while (((gpointer*) array)[length]) {
			length++;
		}
	}
	return length;
}

