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

#include <gtk/gtk.h>
#include <glib-object.h>
#include <glib.h>
#include <gdk/gdk.h>
#include <cairo-gobject.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
#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 PDFPC_VIEW_TYPE_VIDEO (pdfpc_view_video_get_type ())
#define PDFPC_VIEW_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), PDFPC_VIEW_TYPE_VIDEO, pdfpcViewVideo))
#define PDFPC_VIEW_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), PDFPC_VIEW_TYPE_VIDEO, pdfpcViewVideoClass))
#define PDFPC_VIEW_IS_VIDEO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), PDFPC_VIEW_TYPE_VIDEO))
#define PDFPC_VIEW_IS_VIDEO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), PDFPC_VIEW_TYPE_VIDEO))
#define PDFPC_VIEW_VIDEO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), PDFPC_VIEW_TYPE_VIDEO, pdfpcViewVideoClass))

typedef struct _pdfpcViewVideo pdfpcViewVideo;
typedef struct _pdfpcViewVideoClass pdfpcViewVideoClass;
typedef struct _pdfpcViewVideoPrivate pdfpcViewVideoPrivate;
enum  {
	PDFPC_VIEW_VIDEO_0_PROPERTY,
	PDFPC_VIEW_VIDEO_NUM_PROPERTIES
};
static GParamSpec* pdfpc_view_video_properties[PDFPC_VIEW_VIDEO_NUM_PROPERTIES];

struct _pdfpcViewVideo {
	GtkFixed parent_instance;
	pdfpcViewVideoPrivate * priv;
};

struct _pdfpcViewVideoClass {
	GtkFixedClass parent_class;
};

struct _pdfpcViewVideoPrivate {
	GList* videos;
};

static gint pdfpcViewVideo_private_offset;
static gpointer pdfpc_view_video_parent_class = NULL;

VALA_EXTERN GType pdfpc_view_video_get_type (void) G_GNUC_CONST ;
G_DEFINE_AUTOPTR_CLEANUP_FUNC (pdfpcViewVideo, g_object_unref)
static void _g_object_unref0_ (gpointer var);
static inline void _g_list_free__g_object_unref0_ (GList* self);
VALA_EXTERN pdfpcViewVideo* pdfpc_view_video_new (void);
VALA_EXTERN pdfpcViewVideo* pdfpc_view_video_construct (GType object_type);
VALA_EXTERN void pdfpc_view_video_add_video (pdfpcViewVideo* self,
                                 GtkWidget* video,
                                 GdkRectangle* position);
VALA_EXTERN void pdfpc_view_video_resize_video (pdfpcViewVideo* self,
                                    GtkWidget* video,
                                    GdkRectangle* position);
VALA_EXTERN void pdfpc_view_video_remove_video (pdfpcViewVideo* self,
                                    GtkWidget* video);
static void pdfpc_view_video_finalize (GObject * obj);
static GType pdfpc_view_video_get_type_once (void);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

static inline gpointer
pdfpc_view_video_get_instance_private (pdfpcViewVideo* self)
{
	return G_STRUCT_MEMBER_P (self, pdfpcViewVideo_private_offset);
}

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

pdfpcViewVideo*
pdfpc_view_video_construct (GType object_type)
{
	pdfpcViewVideo * self = NULL;
	self = (pdfpcViewVideo*) g_object_new (object_type, NULL);
	(self->priv->videos == NULL) ? NULL : (self->priv->videos = (_g_list_free__g_object_unref0_ (self->priv->videos), NULL));
	self->priv->videos = NULL;
	return self;
}

pdfpcViewVideo*
pdfpc_view_video_new (void)
{
	return pdfpc_view_video_construct (PDFPC_VIEW_TYPE_VIDEO);
}

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

void
pdfpc_view_video_add_video (pdfpcViewVideo* self,
                            GtkWidget* video,
                            GdkRectangle* position)
{
	GdkRectangle _tmp0_;
	GdkRectangle _tmp1_;
	GdkRectangle _tmp2_;
	GdkRectangle _tmp3_;
	GtkWidget* _tmp4_;
	GdkWindow* _tmp5_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (video != NULL);
	g_return_if_fail (position != NULL);
	_tmp0_ = *position;
	_tmp1_ = *position;
	gtk_widget_set_size_request (video, _tmp0_.width, _tmp1_.height);
	_tmp2_ = *position;
	_tmp3_ = *position;
	gtk_fixed_put ((GtkFixed*) self, video, _tmp2_.x, _tmp3_.y);
	_tmp4_ = _g_object_ref0 (video);
	self->priv->videos = g_list_append (self->priv->videos, _tmp4_);
	_tmp5_ = gtk_widget_get_window (video);
	gdk_window_set_pass_through (_tmp5_, TRUE);
	gtk_widget_show_all ((GtkWidget*) self);
}

void
pdfpc_view_video_resize_video (pdfpcViewVideo* self,
                               GtkWidget* video,
                               GdkRectangle* position)
{
	GList* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (video != NULL);
	g_return_if_fail (position != NULL);
	_tmp0_ = self->priv->videos;
	_tmp1_ = g_list_find (_tmp0_, video);
	if (_tmp1_ != NULL) {
		GdkRectangle _tmp2_;
		GdkRectangle _tmp3_;
		GdkRectangle _tmp4_;
		GdkRectangle _tmp5_;
		_tmp2_ = *position;
		_tmp3_ = *position;
		gtk_widget_set_size_request (video, _tmp2_.width, _tmp3_.height);
		_tmp4_ = *position;
		_tmp5_ = *position;
		gtk_fixed_move ((GtkFixed*) self, video, _tmp4_.x, _tmp5_.y);
	}
}

static GList*
vala_g_list_remove_full (GList* self,
                         gconstpointer data,
                         GFreeFunc func)
{
	GList* l = NULL;
	GList* result;
	l = self;
	while (TRUE) {
		GList* _tmp0_;
		GList* _tmp1_;
		gconstpointer _tmp2_;
		_tmp0_ = l;
		if (!(_tmp0_ != NULL)) {
			break;
		}
		_tmp1_ = l;
		_tmp2_ = ((GList*) _tmp1_)->data;
		if (_tmp2_ != data) {
			GList* _tmp3_;
			GList* _tmp4_;
			_tmp3_ = l;
			_tmp4_ = ((GList*) _tmp3_)->next;
			l = _tmp4_;
		} else {
			GList* _tmp5_;
			gconstpointer _tmp6_;
			GList* _tmp7_;
			_tmp5_ = l;
			_tmp6_ = ((GList*) _tmp5_)->data;
			func (_tmp6_);
			_tmp7_ = l;
			self = g_list_delete_link (self, (GList*) _tmp7_);
			break;
		}
	}
	result = self;
	return result;
}

void
pdfpc_view_video_remove_video (pdfpcViewVideo* self,
                               GtkWidget* video)
{
	GList* _tmp0_;
	GList* _tmp1_;
	g_return_if_fail (self != NULL);
	g_return_if_fail (video != NULL);
	_tmp0_ = self->priv->videos;
	_tmp1_ = g_list_find (_tmp0_, video);
	if (_tmp1_ != NULL) {
		gtk_container_remove ((GtkContainer*) self, video);
		self->priv->videos = vala_g_list_remove_full (self->priv->videos, video, _g_object_unref0_);
	}
}

static void
pdfpc_view_video_class_init (pdfpcViewVideoClass * klass,
                             gpointer klass_data)
{
	pdfpc_view_video_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &pdfpcViewVideo_private_offset);
	G_OBJECT_CLASS (klass)->finalize = pdfpc_view_video_finalize;
}

static void
pdfpc_view_video_instance_init (pdfpcViewVideo * self,
                                gpointer klass)
{
	self->priv = pdfpc_view_video_get_instance_private (self);
	self->priv->videos = NULL;
}

static void
pdfpc_view_video_finalize (GObject * obj)
{
	pdfpcViewVideo * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, PDFPC_VIEW_TYPE_VIDEO, pdfpcViewVideo);
	(self->priv->videos == NULL) ? NULL : (self->priv->videos = (_g_list_free__g_object_unref0_ (self->priv->videos), NULL));
	G_OBJECT_CLASS (pdfpc_view_video_parent_class)->finalize (obj);
}

/**
     * View which holds gtksinks from gstreamer and place it at the correct
     * position within a Gtk.Overlay setting for a slide with an embedded
     * video.
     */
static GType
pdfpc_view_video_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (pdfpcViewVideoClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) pdfpc_view_video_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (pdfpcViewVideo), 0, (GInstanceInitFunc) pdfpc_view_video_instance_init, NULL };
	GType pdfpc_view_video_type_id;
	pdfpc_view_video_type_id = g_type_register_static (gtk_fixed_get_type (), "pdfpcViewVideo", &g_define_type_info, 0);
	pdfpcViewVideo_private_offset = g_type_add_instance_private (pdfpc_view_video_type_id, sizeof (pdfpcViewVideoPrivate));
	return pdfpc_view_video_type_id;
}

GType
pdfpc_view_video_get_type (void)
{
	static volatile gsize pdfpc_view_video_type_id__once = 0;
	if (g_once_init_enter (&pdfpc_view_video_type_id__once)) {
		GType pdfpc_view_video_type_id;
		pdfpc_view_video_type_id = pdfpc_view_video_get_type_once ();
		g_once_init_leave (&pdfpc_view_video_type_id__once, pdfpc_view_video_type_id);
	}
	return pdfpc_view_video_type_id__once;
}

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

