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

#include <adwaita.h>
#include <glib-object.h>
#include <gtk/gtk.h>
#include <glib.h>
#include <float.h>
#include <math.h>
#include <gdk/gdk.h>
#include <stdlib.h>
#include <string.h>
#include <gst/gst.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
#if !defined(VALA_EXTERN)
#if defined(_MSC_VER)
#define VALA_EXTERN __declspec(dllexport) extern
#elif __GNUC__ >= 4
#define VALA_EXTERN __attribute__((visibility("default"))) extern
#else
#define VALA_EXTERN extern
#endif
#endif

#define TUBA_WIDGETS_AUDIO_TYPE_PLAYER (tuba_widgets_audio_player_get_type ())
#define TUBA_WIDGETS_AUDIO_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_AUDIO_TYPE_PLAYER, TubaWidgetsAudioPlayer))
#define TUBA_WIDGETS_AUDIO_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_AUDIO_TYPE_PLAYER, TubaWidgetsAudioPlayerClass))
#define TUBA_WIDGETS_AUDIO_IS_PLAYER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_AUDIO_TYPE_PLAYER))
#define TUBA_WIDGETS_AUDIO_IS_PLAYER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_AUDIO_TYPE_PLAYER))
#define TUBA_WIDGETS_AUDIO_PLAYER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_AUDIO_TYPE_PLAYER, TubaWidgetsAudioPlayerClass))

typedef struct _TubaWidgetsAudioPlayer TubaWidgetsAudioPlayer;
typedef struct _TubaWidgetsAudioPlayerClass TubaWidgetsAudioPlayerClass;
typedef struct _TubaWidgetsAudioPlayerPrivate TubaWidgetsAudioPlayerPrivate;

#define TUBA_WIDGETS_AUDIO_TYPE_STREAM (tuba_widgets_audio_stream_get_type ())
#define TUBA_WIDGETS_AUDIO_STREAM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_AUDIO_TYPE_STREAM, TubaWidgetsAudioStream))
#define TUBA_WIDGETS_AUDIO_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_AUDIO_TYPE_STREAM, TubaWidgetsAudioStreamClass))
#define TUBA_WIDGETS_AUDIO_IS_STREAM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_AUDIO_TYPE_STREAM))
#define TUBA_WIDGETS_AUDIO_IS_STREAM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_AUDIO_TYPE_STREAM))
#define TUBA_WIDGETS_AUDIO_STREAM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_AUDIO_TYPE_STREAM, TubaWidgetsAudioStreamClass))

typedef struct _TubaWidgetsAudioStream TubaWidgetsAudioStream;
typedef struct _TubaWidgetsAudioStreamClass TubaWidgetsAudioStreamClass;

#define TUBA_WIDGETS_AUDIO_TYPE_VISUALIZER (tuba_widgets_audio_visualizer_get_type ())
#define TUBA_WIDGETS_AUDIO_VISUALIZER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_AUDIO_TYPE_VISUALIZER, TubaWidgetsAudioVisualizer))
#define TUBA_WIDGETS_AUDIO_VISUALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_AUDIO_TYPE_VISUALIZER, TubaWidgetsAudioVisualizerClass))
#define TUBA_WIDGETS_AUDIO_IS_VISUALIZER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_AUDIO_TYPE_VISUALIZER))
#define TUBA_WIDGETS_AUDIO_IS_VISUALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_AUDIO_TYPE_VISUALIZER))
#define TUBA_WIDGETS_AUDIO_VISUALIZER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_AUDIO_TYPE_VISUALIZER, TubaWidgetsAudioVisualizerClass))

typedef struct _TubaWidgetsAudioVisualizer TubaWidgetsAudioVisualizer;
typedef struct _TubaWidgetsAudioVisualizerClass TubaWidgetsAudioVisualizerClass;
enum  {
	TUBA_WIDGETS_AUDIO_PLAYER_0_PROPERTY,
	TUBA_WIDGETS_AUDIO_PLAYER_URL_PROPERTY,
	TUBA_WIDGETS_AUDIO_PLAYER_PLAYING_PROPERTY,
	TUBA_WIDGETS_AUDIO_PLAYER_VOLUME_PROPERTY,
	TUBA_WIDGETS_AUDIO_PLAYER_PROGRESS_PROPERTY,
	TUBA_WIDGETS_AUDIO_PLAYER_READY_PROPERTY,
	TUBA_WIDGETS_AUDIO_PLAYER_MUTED_PROPERTY,
	TUBA_WIDGETS_AUDIO_PLAYER_NUM_PROPERTIES
};
static GParamSpec* tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_NUM_PROPERTIES];
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define TUBA_WIDGETS_AUDIO_TYPE_CONTROLS (tuba_widgets_audio_controls_get_type ())
#define TUBA_WIDGETS_AUDIO_CONTROLS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), TUBA_WIDGETS_AUDIO_TYPE_CONTROLS, TubaWidgetsAudioControls))
#define TUBA_WIDGETS_AUDIO_CONTROLS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), TUBA_WIDGETS_AUDIO_TYPE_CONTROLS, TubaWidgetsAudioControlsClass))
#define TUBA_WIDGETS_AUDIO_IS_CONTROLS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), TUBA_WIDGETS_AUDIO_TYPE_CONTROLS))
#define TUBA_WIDGETS_AUDIO_IS_CONTROLS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), TUBA_WIDGETS_AUDIO_TYPE_CONTROLS))
#define TUBA_WIDGETS_AUDIO_CONTROLS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), TUBA_WIDGETS_AUDIO_TYPE_CONTROLS, TubaWidgetsAudioControlsClass))

typedef struct _TubaWidgetsAudioControls TubaWidgetsAudioControls;
typedef struct _TubaWidgetsAudioControlsClass TubaWidgetsAudioControlsClass;

struct _TubaWidgetsAudioPlayer {
	AdwBin parent_instance;
	TubaWidgetsAudioPlayerPrivate * priv;
};

struct _TubaWidgetsAudioPlayerClass {
	AdwBinClass parent_class;
};

struct _TubaWidgetsAudioPlayerPrivate {
	TubaWidgetsAudioStream* player;
	GtkOverlay* overlay;
	TubaWidgetsAudioVisualizer* visualizer;
	GtkRevealer* controls_revealer;
	gboolean _playing;
	gdouble _volume;
	gdouble _progress;
	gboolean _ready;
	gboolean should_hide_controls;
	gdouble on_motion_last_x;
	gdouble on_motion_last_y;
	guint revealer_timeout;
};

static gint TubaWidgetsAudioPlayer_private_offset;
static gpointer tuba_widgets_audio_player_parent_class = NULL;

VALA_EXTERN GType tuba_widgets_audio_player_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsAudioPlayer, g_object_unref)
VALA_EXTERN GType tuba_widgets_audio_stream_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsAudioStream, g_object_unref)
VALA_EXTERN GType tuba_widgets_audio_visualizer_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsAudioVisualizer, g_object_unref)
static void tuba_widgets_audio_player_on_ended (TubaWidgetsAudioPlayer* self);
VALA_EXTERN void tuba_widgets_audio_player_set_playing (TubaWidgetsAudioPlayer* self,
                                            gboolean value);
VALA_EXTERN void tuba_widgets_audio_player_on_leave (TubaWidgetsAudioPlayer* self);
VALA_EXTERN void tuba_widgets_audio_player_on_motion (TubaWidgetsAudioPlayer* self,
                                          gdouble x,
                                          gdouble y);
static void tuba_widgets_audio_player_on_reveal_media_buttons (TubaWidgetsAudioPlayer* self);
static gboolean tuba_widgets_audio_player_on_hide_media_buttons (TubaWidgetsAudioPlayer* self);
static gboolean _tuba_widgets_audio_player_on_hide_media_buttons_gsource_func (gpointer self);
VALA_EXTERN void tuba_widgets_audio_player_on_click_gesture (TubaWidgetsAudioPlayer* self);
VALA_EXTERN gboolean tuba_widgets_audio_player_get_playing (TubaWidgetsAudioPlayer* self);
VALA_EXTERN TubaWidgetsAudioPlayer* tuba_widgets_audio_player_new (GdkTexture* texture,
                                                       const gchar* blurhash);
VALA_EXTERN TubaWidgetsAudioPlayer* tuba_widgets_audio_player_construct (GType object_type,
                                                             GdkTexture* texture,
                                                             const gchar* blurhash);
VALA_EXTERN TubaWidgetsAudioVisualizer* tuba_widgets_audio_visualizer_new (GdkTexture* texture,
                                                               const gchar* blurhash);
VALA_EXTERN TubaWidgetsAudioVisualizer* tuba_widgets_audio_visualizer_construct (GType object_type,
                                                                     GdkTexture* texture,
                                                                     const gchar* blurhash);
static void _tuba_widgets_audio_player_on_motion_gtk_event_controller_motion_motion (GtkEventControllerMotion* _sender,
                                                                              gdouble x,
                                                                              gdouble y,
                                                                              gpointer self);
static void _tuba_widgets_audio_player_on_leave_gtk_event_controller_motion_leave (GtkEventControllerMotion* _sender,
                                                                            gpointer self);
static void _tuba_widgets_audio_player_on_click_gesture_gtk_gesture_click_released (GtkGestureClick* _sender,
                                                                             gint n_press,
                                                                             gdouble x,
                                                                             gdouble y,
                                                                             gpointer self);
static void tuba_widgets_audio_player_on_destroy (TubaWidgetsAudioPlayer* self);
VALA_EXTERN void tuba_widgets_audio_stream_destroy (TubaWidgetsAudioStream* self);
VALA_EXTERN const gchar* tuba_widgets_audio_player_get_url (TubaWidgetsAudioPlayer* self);
VALA_EXTERN const gchar* tuba_widgets_audio_stream_get_url (TubaWidgetsAudioStream* self);
VALA_EXTERN void tuba_widgets_audio_player_set_url (TubaWidgetsAudioPlayer* self,
                                        const gchar* value);
VALA_EXTERN void tuba_widgets_audio_stream_set_url (TubaWidgetsAudioStream* self,
                                        const gchar* value);
VALA_EXTERN void tuba_widgets_audio_stream_set_state (TubaWidgetsAudioStream* self,
                                          GstState value);
VALA_EXTERN gdouble tuba_widgets_audio_player_get_volume (TubaWidgetsAudioPlayer* self);
VALA_EXTERN void tuba_widgets_audio_player_set_volume (TubaWidgetsAudioPlayer* self,
                                           gdouble value);
VALA_EXTERN gdouble tuba_widgets_audio_player_get_progress (TubaWidgetsAudioPlayer* self);
VALA_EXTERN void tuba_widgets_audio_player_set_progress (TubaWidgetsAudioPlayer* self,
                                             gdouble value);
VALA_EXTERN gboolean tuba_widgets_audio_player_get_ready (TubaWidgetsAudioPlayer* self);
VALA_EXTERN void tuba_widgets_audio_player_set_ready (TubaWidgetsAudioPlayer* self,
                                          gboolean value);
VALA_EXTERN gboolean tuba_widgets_audio_player_get_muted (TubaWidgetsAudioPlayer* self);
static GObject * tuba_widgets_audio_player_constructor (GType type,
                                                 guint n_construct_properties,
                                                 GObjectConstructParam * construct_properties);
VALA_EXTERN TubaWidgetsAudioStream* tuba_widgets_audio_stream_new (void);
VALA_EXTERN TubaWidgetsAudioStream* tuba_widgets_audio_stream_construct (GType object_type);
VALA_EXTERN GType tuba_widgets_audio_controls_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (TubaWidgetsAudioControls, g_object_unref)
VALA_EXTERN TubaWidgetsAudioControls* tuba_widgets_audio_controls_new (void);
VALA_EXTERN TubaWidgetsAudioControls* tuba_widgets_audio_controls_construct (GType object_type);
static void _tuba_widgets_audio_player_on_ended_tuba_widgets_audio_stream_ended (TubaWidgetsAudioStream* _sender,
                                                                          gpointer self);
static void _tuba_widgets_audio_player_on_destroy_gtk_widget_destroy (GtkWidget* _sender,
                                                               gpointer self);
static void tuba_widgets_audio_player_finalize (GObject * obj);
static GType tuba_widgets_audio_player_get_type_once (void);
static void _vala_tuba_widgets_audio_player_get_property (GObject * object,
                                                   guint property_id,
                                                   GValue * value,
                                                   GParamSpec * pspec);
static void _vala_tuba_widgets_audio_player_set_property (GObject * object,
                                                   guint property_id,
                                                   const GValue * value,
                                                   GParamSpec * pspec);

static inline gpointer
tuba_widgets_audio_player_get_instance_private (TubaWidgetsAudioPlayer* self)
{
	return G_STRUCT_MEMBER_P (self, TubaWidgetsAudioPlayer_private_offset);
}

static void
tuba_widgets_audio_player_on_ended (TubaWidgetsAudioPlayer* self)
{
	g_return_if_fail (self != NULL);
	tuba_widgets_audio_player_set_playing (self, FALSE);
}

void
tuba_widgets_audio_player_on_leave (TubaWidgetsAudioPlayer* self)
{
	g_return_if_fail (self != NULL);
	self->priv->should_hide_controls = FALSE;
}

void
tuba_widgets_audio_player_on_motion (TubaWidgetsAudioPlayer* self,
                                     gdouble x,
                                     gdouble y)
{
	gboolean _tmp0_ = FALSE;
	g_return_if_fail (self != NULL);
	if (self->priv->on_motion_last_x == x) {
		_tmp0_ = self->priv->on_motion_last_y == y;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		return;
	}
	self->priv->should_hide_controls = TRUE;
	self->priv->on_motion_last_x = x;
	self->priv->on_motion_last_y = y;
	tuba_widgets_audio_player_on_reveal_media_buttons (self);
}

static gboolean
_tuba_widgets_audio_player_on_hide_media_buttons_gsource_func (gpointer self)
{
	gboolean result;
	result = tuba_widgets_audio_player_on_hide_media_buttons ((TubaWidgetsAudioPlayer*) self);
	return result;
}

static void
tuba_widgets_audio_player_on_reveal_media_buttons (TubaWidgetsAudioPlayer* self)
{
	GtkRevealer* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->controls_revealer;
	gtk_revealer_set_reveal_child (_tmp0_, TRUE);
	if (self->priv->revealer_timeout > ((guint) 0)) {
		g_source_remove (self->priv->revealer_timeout);
	}
	self->priv->revealer_timeout = g_timeout_add_full (G_PRIORITY_LOW, (guint) (5 * 1000), _tuba_widgets_audio_player_on_hide_media_buttons_gsource_func, g_object_ref (self), g_object_unref);
}

static gboolean
tuba_widgets_audio_player_on_hide_media_buttons (TubaWidgetsAudioPlayer* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	self->priv->revealer_timeout = (guint) 0;
	if (self->priv->should_hide_controls) {
		GtkRevealer* _tmp0_;
		_tmp0_ = self->priv->controls_revealer;
		gtk_revealer_set_reveal_child (_tmp0_, FALSE);
	}
	result = G_SOURCE_REMOVE;
	return result;
}

void
tuba_widgets_audio_player_on_click_gesture (TubaWidgetsAudioPlayer* self)
{
	gboolean _tmp0_;
	gboolean _tmp1_;
	g_return_if_fail (self != NULL);
	tuba_widgets_audio_player_on_reveal_media_buttons (self);
	_tmp0_ = tuba_widgets_audio_player_get_playing (self);
	_tmp1_ = _tmp0_;
	tuba_widgets_audio_player_set_playing (self, !_tmp1_);
}

static void
_tuba_widgets_audio_player_on_motion_gtk_event_controller_motion_motion (GtkEventControllerMotion* _sender,
                                                                         gdouble x,
                                                                         gdouble y,
                                                                         gpointer self)
{
	tuba_widgets_audio_player_on_motion ((TubaWidgetsAudioPlayer*) self, x, y);
}

static void
_tuba_widgets_audio_player_on_leave_gtk_event_controller_motion_leave (GtkEventControllerMotion* _sender,
                                                                       gpointer self)
{
	tuba_widgets_audio_player_on_leave ((TubaWidgetsAudioPlayer*) self);
}

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

static void
_tuba_widgets_audio_player_on_click_gesture_gtk_gesture_click_released (GtkGestureClick* _sender,
                                                                        gint n_press,
                                                                        gdouble x,
                                                                        gdouble y,
                                                                        gpointer self)
{
	tuba_widgets_audio_player_on_click_gesture ((TubaWidgetsAudioPlayer*) self);
}

TubaWidgetsAudioPlayer*
tuba_widgets_audio_player_construct (GType object_type,
                                     GdkTexture* texture,
                                     const gchar* blurhash)
{
	TubaWidgetsAudioPlayer * self = NULL;
	TubaWidgetsAudioVisualizer* _tmp0_ = NULL;
	GtkEventControllerMotion* motion = NULL;
	GtkEventControllerMotion* _tmp1_ = NULL;
	TubaWidgetsAudioVisualizer* _tmp2_;
	GtkEventController* _tmp3_;
	GtkGestureClick* click_gesture = NULL;
	GtkGestureClick* _tmp4_ = NULL;
	TubaWidgetsAudioVisualizer* _tmp5_;
	GtkEventController* _tmp6_;
	TubaWidgetsAudioStream* _tmp7_;
	TubaWidgetsAudioVisualizer* _tmp8_;
	GtkOverlay* _tmp9_;
	TubaWidgetsAudioVisualizer* _tmp10_;
	self = (TubaWidgetsAudioPlayer*) g_object_new (object_type, NULL);
	_tmp0_ = tuba_widgets_audio_visualizer_new (texture, blurhash);
	gtk_widget_set_vexpand ((GtkWidget*) _tmp0_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp0_, TRUE);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->visualizer);
	self->priv->visualizer = _tmp0_;
	_tmp1_ = (GtkEventControllerMotion*) gtk_event_controller_motion_new ();
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp1_, GTK_PHASE_BUBBLE);
	motion = _tmp1_;
	g_signal_connect_object (motion, "motion", (GCallback) _tuba_widgets_audio_player_on_motion_gtk_event_controller_motion_motion, self, 0);
	g_signal_connect_object (motion, "leave", (GCallback) _tuba_widgets_audio_player_on_leave_gtk_event_controller_motion_leave, self, 0);
	_tmp2_ = self->priv->visualizer;
	_tmp3_ = _g_object_ref0 ((GtkEventController*) motion);
	gtk_widget_add_controller ((GtkWidget*) _tmp2_, _tmp3_);
	_tmp4_ = (GtkGestureClick*) gtk_gesture_click_new ();
	gtk_gesture_single_set_button ((GtkGestureSingle*) _tmp4_, (guint) GDK_BUTTON_PRIMARY);
	gtk_event_controller_set_propagation_phase ((GtkEventController*) _tmp4_, GTK_PHASE_BUBBLE);
	click_gesture = _tmp4_;
	g_signal_connect_object (click_gesture, "released", (GCallback) _tuba_widgets_audio_player_on_click_gesture_gtk_gesture_click_released, self, 0);
	_tmp5_ = self->priv->visualizer;
	_tmp6_ = _g_object_ref0 ((GtkEventController*) click_gesture);
	gtk_widget_add_controller ((GtkWidget*) _tmp5_, _tmp6_);
	_tmp7_ = self->priv->player;
	_tmp8_ = self->priv->visualizer;
	g_object_bind_property_with_closures ((GObject*) _tmp7_, "level", (GObject*) _tmp8_, "level", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp9_ = self->priv->overlay;
	_tmp10_ = self->priv->visualizer;
	gtk_overlay_set_child (_tmp9_, (GtkWidget*) _tmp10_);
	tuba_widgets_audio_player_on_reveal_media_buttons (self);
	_g_object_unref0 (click_gesture);
	_g_object_unref0 (motion);
	return self;
}

TubaWidgetsAudioPlayer*
tuba_widgets_audio_player_new (GdkTexture* texture,
                               const gchar* blurhash)
{
	return tuba_widgets_audio_player_construct (TUBA_WIDGETS_AUDIO_TYPE_PLAYER, texture, blurhash);
}

static void
tuba_widgets_audio_player_on_destroy (TubaWidgetsAudioPlayer* self)
{
	TubaWidgetsAudioStream* _tmp0_;
	g_return_if_fail (self != NULL);
	if (self->priv->revealer_timeout > ((guint) 0)) {
		g_source_remove (self->priv->revealer_timeout);
		self->priv->revealer_timeout = (guint) 0;
	}
	_tmp0_ = self->priv->player;
	tuba_widgets_audio_stream_destroy (_tmp0_);
}

const gchar*
tuba_widgets_audio_player_get_url (TubaWidgetsAudioPlayer* self)
{
	const gchar* result;
	TubaWidgetsAudioStream* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->player;
	_tmp1_ = tuba_widgets_audio_stream_get_url (_tmp0_);
	_tmp2_ = _tmp1_;
	result = _tmp2_;
	return result;
}

void
tuba_widgets_audio_player_set_url (TubaWidgetsAudioPlayer* self,
                                   const gchar* value)
{
	TubaWidgetsAudioStream* _tmp0_;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->player;
	tuba_widgets_audio_stream_set_url (_tmp0_, value);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_URL_PROPERTY]);
}

gboolean
tuba_widgets_audio_player_get_playing (TubaWidgetsAudioPlayer* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_playing;
	return result;
}

void
tuba_widgets_audio_player_set_playing (TubaWidgetsAudioPlayer* self,
                                       gboolean value)
{
	GstState _tmp0_ = 0;
	TubaWidgetsAudioStream* _tmp1_;
	g_return_if_fail (self != NULL);
	self->priv->_playing = value;
	if (value) {
		_tmp0_ = GST_STATE_PLAYING;
	} else {
		_tmp0_ = GST_STATE_PAUSED;
	}
	_tmp1_ = self->priv->player;
	tuba_widgets_audio_stream_set_state (_tmp1_, _tmp0_);
	g_object_notify_by_pspec ((GObject *) self, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_PLAYING_PROPERTY]);
}

gdouble
tuba_widgets_audio_player_get_volume (TubaWidgetsAudioPlayer* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_volume;
	return result;
}

void
tuba_widgets_audio_player_set_volume (TubaWidgetsAudioPlayer* self,
                                      gdouble value)
{
	gdouble old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_audio_player_get_volume (self);
	if (old_value != value) {
		self->priv->_volume = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_VOLUME_PROPERTY]);
	}
}

gdouble
tuba_widgets_audio_player_get_progress (TubaWidgetsAudioPlayer* self)
{
	gdouble result;
	g_return_val_if_fail (self != NULL, -1.0);
	result = self->priv->_progress;
	return result;
}

void
tuba_widgets_audio_player_set_progress (TubaWidgetsAudioPlayer* self,
                                        gdouble value)
{
	gdouble old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_audio_player_get_progress (self);
	if (old_value != value) {
		self->priv->_progress = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_PROGRESS_PROPERTY]);
	}
}

gboolean
tuba_widgets_audio_player_get_ready (TubaWidgetsAudioPlayer* self)
{
	gboolean result;
	g_return_val_if_fail (self != NULL, FALSE);
	result = self->priv->_ready;
	return result;
}

void
tuba_widgets_audio_player_set_ready (TubaWidgetsAudioPlayer* self,
                                     gboolean value)
{
	gboolean old_value;
	g_return_if_fail (self != NULL);
	old_value = tuba_widgets_audio_player_get_ready (self);
	if (old_value != value) {
		self->priv->_ready = value;
		g_object_notify_by_pspec ((GObject *) self, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_READY_PROPERTY]);
	}
}

gboolean
tuba_widgets_audio_player_get_muted (TubaWidgetsAudioPlayer* self)
{
	gboolean result;
	gdouble _tmp0_;
	g_return_val_if_fail (self != NULL, FALSE);
	_tmp0_ = self->priv->_volume;
	result = _tmp0_ == 0.0;
	return result;
}

static void
_tuba_widgets_audio_player_on_ended_tuba_widgets_audio_stream_ended (TubaWidgetsAudioStream* _sender,
                                                                     gpointer self)
{
	tuba_widgets_audio_player_on_ended ((TubaWidgetsAudioPlayer*) self);
}

static void
_tuba_widgets_audio_player_on_destroy_gtk_widget_destroy (GtkWidget* _sender,
                                                          gpointer self)
{
	tuba_widgets_audio_player_on_destroy ((TubaWidgetsAudioPlayer*) self);
}

static GObject *
tuba_widgets_audio_player_constructor (GType type,
                                       guint n_construct_properties,
                                       GObjectConstructParam * construct_properties)
{
	GObject * obj;
	GObjectClass * parent_class;
	TubaWidgetsAudioPlayer * self;
	GtkOverlay* _tmp0_ = NULL;
	TubaWidgetsAudioStream* _tmp1_;
	TubaWidgetsAudioStream* _tmp2_;
	TubaWidgetsAudioStream* _tmp3_;
	TubaWidgetsAudioControls* controls = NULL;
	TubaWidgetsAudioControls* _tmp4_ = NULL;
	TubaWidgetsAudioControls* _tmp5_;
	TubaWidgetsAudioControls* _tmp6_;
	TubaWidgetsAudioControls* _tmp7_;
	TubaWidgetsAudioControls* _tmp8_;
	TubaWidgetsAudioControls* _tmp9_;
	GtkWidget* _tmp10_;
	AdwClamp* _tmp11_ = NULL;
	GtkRevealer* _tmp12_ = NULL;
	GtkOverlay* _tmp13_;
	GtkRevealer* _tmp14_;
	TubaWidgetsAudioStream* _tmp15_;
	TubaWidgetsAudioControls* _tmp16_;
	TubaWidgetsAudioStream* _tmp17_;
	TubaWidgetsAudioControls* _tmp18_;
	TubaWidgetsAudioStream* _tmp19_;
	TubaWidgetsAudioStream* _tmp20_;
	GtkOverlay* _tmp21_;
	parent_class = G_OBJECT_CLASS (tuba_widgets_audio_player_parent_class);
	obj = parent_class->constructor (type, n_construct_properties, construct_properties);
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_AUDIO_TYPE_PLAYER, TubaWidgetsAudioPlayer);
	_tmp0_ = (GtkOverlay*) gtk_overlay_new ();
	gtk_widget_set_vexpand ((GtkWidget*) _tmp0_, TRUE);
	gtk_widget_set_hexpand ((GtkWidget*) _tmp0_, TRUE);
	g_object_ref_sink (_tmp0_);
	_g_object_unref0 (self->priv->overlay);
	self->priv->overlay = _tmp0_;
	_tmp1_ = tuba_widgets_audio_stream_new ();
	_g_object_unref0 (self->priv->player);
	self->priv->player = _tmp1_;
	_tmp2_ = self->priv->player;
	g_object_bind_property_with_closures ((GObject*) self, "volume", (GObject*) _tmp2_, "volume", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp3_ = self->priv->player;
	g_object_bind_property_with_closures ((GObject*) self, "progress", (GObject*) _tmp3_, "progress", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp4_ = tuba_widgets_audio_controls_new ();
	gtk_widget_set_hexpand ((GtkWidget*) _tmp4_, TRUE);
	gtk_widget_set_valign ((GtkWidget*) _tmp4_, GTK_ALIGN_END);
	g_object_ref_sink (_tmp4_);
	controls = _tmp4_;
	_tmp5_ = controls;
	g_object_bind_property_with_closures ((GObject*) _tmp5_, "volume", (GObject*) self, "volume", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp6_ = controls;
	g_object_bind_property_with_closures ((GObject*) _tmp6_, "progress", (GObject*) self, "progress", G_BINDING_SYNC_CREATE | G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp7_ = controls;
	g_object_bind_property_with_closures ((GObject*) _tmp7_, "playing", (GObject*) self, "playing", G_BINDING_BIDIRECTIONAL, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp8_ = controls;
	g_object_bind_property_with_closures ((GObject*) self, "ready", (GObject*) _tmp8_, "ready", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp9_ = controls;
	_tmp10_ = _g_object_ref0 ((GtkWidget*) _tmp9_);
	_tmp11_ = (AdwClamp*) adw_clamp_new ();
	adw_clamp_set_child (_tmp11_, _tmp10_);
	_g_object_unref0 (_tmp10_);
	adw_clamp_set_maximum_size (_tmp11_, 1500);
	g_object_ref_sink (_tmp11_);
	_tmp12_ = (GtkRevealer*) gtk_revealer_new ();
	gtk_revealer_set_child (_tmp12_, (GtkWidget*) _tmp11_);
	_g_object_unref0 (_tmp11_);
	gtk_revealer_set_transition_type (_tmp12_, GTK_REVEALER_TRANSITION_TYPE_CROSSFADE);
	gtk_widget_set_valign ((GtkWidget*) _tmp12_, GTK_ALIGN_END);
	gtk_revealer_set_transition_duration (_tmp12_, (guint) 800);
	g_object_ref_sink (_tmp12_);
	_g_object_unref0 (self->priv->controls_revealer);
	self->priv->controls_revealer = _tmp12_;
	_tmp13_ = self->priv->overlay;
	_tmp14_ = self->priv->controls_revealer;
	gtk_overlay_add_overlay (_tmp13_, (GtkWidget*) _tmp14_);
	_tmp15_ = self->priv->player;
	_tmp16_ = controls;
	g_object_bind_property_with_closures ((GObject*) _tmp15_, "current", (GObject*) _tmp16_, "current", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp17_ = self->priv->player;
	_tmp18_ = controls;
	g_object_bind_property_with_closures ((GObject*) _tmp17_, "duration", (GObject*) _tmp18_, "duration", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp19_ = self->priv->player;
	g_object_bind_property_with_closures ((GObject*) _tmp19_, "ready", (GObject*) self, "ready", G_BINDING_SYNC_CREATE, (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)), (GClosure*) ((NULL == NULL) ? NULL : g_cclosure_new ((GCallback) NULL, NULL, (GClosureNotify) NULL)));
	_tmp20_ = self->priv->player;
	g_signal_connect_object (_tmp20_, "ended", (GCallback) _tuba_widgets_audio_player_on_ended_tuba_widgets_audio_stream_ended, self, 0);
	_tmp21_ = self->priv->overlay;
	adw_bin_set_child ((AdwBin*) self, (GtkWidget*) _tmp21_);
	g_signal_connect_object ((GtkWidget*) self, "destroy", (GCallback) _tuba_widgets_audio_player_on_destroy_gtk_widget_destroy, self, 0);
	_g_object_unref0 (controls);
	return obj;
}

static void
tuba_widgets_audio_player_class_init (TubaWidgetsAudioPlayerClass * klass,
                                      gpointer klass_data)
{
	tuba_widgets_audio_player_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &TubaWidgetsAudioPlayer_private_offset);
	G_OBJECT_CLASS (klass)->get_property = _vala_tuba_widgets_audio_player_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_tuba_widgets_audio_player_set_property;
	G_OBJECT_CLASS (klass)->constructor = tuba_widgets_audio_player_constructor;
	G_OBJECT_CLASS (klass)->finalize = tuba_widgets_audio_player_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AUDIO_PLAYER_URL_PROPERTY, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_URL_PROPERTY] = g_param_spec_string ("url", "url", "url", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AUDIO_PLAYER_PLAYING_PROPERTY, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_PLAYING_PROPERTY] = g_param_spec_boolean ("playing", "playing", "playing", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AUDIO_PLAYER_VOLUME_PROPERTY, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_VOLUME_PROPERTY] = g_param_spec_double ("volume", "volume", "volume", -G_MAXDOUBLE, G_MAXDOUBLE, 1.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AUDIO_PLAYER_PROGRESS_PROPERTY, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_PROGRESS_PROPERTY] = g_param_spec_double ("progress", "progress", "progress", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AUDIO_PLAYER_READY_PROPERTY, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_READY_PROPERTY] = g_param_spec_boolean ("ready", "ready", "ready", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
	g_object_class_install_property (G_OBJECT_CLASS (klass), TUBA_WIDGETS_AUDIO_PLAYER_MUTED_PROPERTY, tuba_widgets_audio_player_properties[TUBA_WIDGETS_AUDIO_PLAYER_MUTED_PROPERTY] = g_param_spec_boolean ("muted", "muted", "muted", FALSE, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE));
}

static void
tuba_widgets_audio_player_instance_init (TubaWidgetsAudioPlayer * self,
                                         gpointer klass)
{
	self->priv = tuba_widgets_audio_player_get_instance_private (self);
	self->priv->_playing = FALSE;
	self->priv->_volume = 1.0;
	self->priv->_progress = 0.0;
	self->priv->_ready = FALSE;
	self->priv->should_hide_controls = TRUE;
	self->priv->on_motion_last_x = 0.0;
	self->priv->on_motion_last_y = 0.0;
	self->priv->revealer_timeout = (guint) 0;
}

static void
tuba_widgets_audio_player_finalize (GObject * obj)
{
	TubaWidgetsAudioPlayer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, TUBA_WIDGETS_AUDIO_TYPE_PLAYER, TubaWidgetsAudioPlayer);
	g_debug ("Player.vala:143: Destroying AudioPlayer");
	_g_object_unref0 (self->priv->player);
	_g_object_unref0 (self->priv->overlay);
	_g_object_unref0 (self->priv->visualizer);
	_g_object_unref0 (self->priv->controls_revealer);
	G_OBJECT_CLASS (tuba_widgets_audio_player_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
tuba_widgets_audio_player_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (TubaWidgetsAudioPlayerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) tuba_widgets_audio_player_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (TubaWidgetsAudioPlayer), 0, (GInstanceInitFunc) tuba_widgets_audio_player_instance_init, NULL };
	GType tuba_widgets_audio_player_type_id;
	tuba_widgets_audio_player_type_id = g_type_register_static (adw_bin_get_type (), "TubaWidgetsAudioPlayer", &g_define_type_info, G_TYPE_FLAG_NONE);
	TubaWidgetsAudioPlayer_private_offset = g_type_add_instance_private (tuba_widgets_audio_player_type_id, sizeof (TubaWidgetsAudioPlayerPrivate));
	return tuba_widgets_audio_player_type_id;
}

GType
tuba_widgets_audio_player_get_type (void)
{
	static GType tuba_widgets_audio_player_type_id__once = 0;
	if (g_once_init_enter_pointer (&tuba_widgets_audio_player_type_id__once)) {
		GType tuba_widgets_audio_player_type_id;
		tuba_widgets_audio_player_type_id = tuba_widgets_audio_player_get_type_once ();
		g_once_init_leave_pointer (&tuba_widgets_audio_player_type_id__once, tuba_widgets_audio_player_type_id);
	}
	return tuba_widgets_audio_player_type_id__once;
}

static void
_vala_tuba_widgets_audio_player_get_property (GObject * object,
                                              guint property_id,
                                              GValue * value,
                                              GParamSpec * pspec)
{
	TubaWidgetsAudioPlayer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_AUDIO_TYPE_PLAYER, TubaWidgetsAudioPlayer);
	switch (property_id) {
		case TUBA_WIDGETS_AUDIO_PLAYER_URL_PROPERTY:
		g_value_set_string (value, tuba_widgets_audio_player_get_url (self));
		break;
		case TUBA_WIDGETS_AUDIO_PLAYER_PLAYING_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_audio_player_get_playing (self));
		break;
		case TUBA_WIDGETS_AUDIO_PLAYER_VOLUME_PROPERTY:
		g_value_set_double (value, tuba_widgets_audio_player_get_volume (self));
		break;
		case TUBA_WIDGETS_AUDIO_PLAYER_PROGRESS_PROPERTY:
		g_value_set_double (value, tuba_widgets_audio_player_get_progress (self));
		break;
		case TUBA_WIDGETS_AUDIO_PLAYER_READY_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_audio_player_get_ready (self));
		break;
		case TUBA_WIDGETS_AUDIO_PLAYER_MUTED_PROPERTY:
		g_value_set_boolean (value, tuba_widgets_audio_player_get_muted (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_tuba_widgets_audio_player_set_property (GObject * object,
                                              guint property_id,
                                              const GValue * value,
                                              GParamSpec * pspec)
{
	TubaWidgetsAudioPlayer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, TUBA_WIDGETS_AUDIO_TYPE_PLAYER, TubaWidgetsAudioPlayer);
	switch (property_id) {
		case TUBA_WIDGETS_AUDIO_PLAYER_URL_PROPERTY:
		tuba_widgets_audio_player_set_url (self, g_value_get_string (value));
		break;
		case TUBA_WIDGETS_AUDIO_PLAYER_PLAYING_PROPERTY:
		tuba_widgets_audio_player_set_playing (self, g_value_get_boolean (value));
		break;
		case TUBA_WIDGETS_AUDIO_PLAYER_VOLUME_PROPERTY:
		tuba_widgets_audio_player_set_volume (self, g_value_get_double (value));
		break;
		case TUBA_WIDGETS_AUDIO_PLAYER_PROGRESS_PROPERTY:
		tuba_widgets_audio_player_set_progress (self, g_value_get_double (value));
		break;
		case TUBA_WIDGETS_AUDIO_PLAYER_READY_PROPERTY:
		tuba_widgets_audio_player_set_ready (self, g_value_get_boolean (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

