/* rygel-thumbnail.c generated by valac 0.17.4.16-52707, the Vala compiler
 * generated from rygel-thumbnail.vala, do not modify */

/*
 * Copyright (C) 2008 Zeeshan Ali <zeenix@gmail.com>.
 *
 * Author: Zeeshan Ali <zeenix@gmail.com>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or
 * (at your option) any later version.
 *
 * Rygel is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Lesser General Public License for more details.
 *
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program; if not, write to the Free Software Foundation,
 * Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include <libgupnp-av/gupnp-av.h>


#define RYGEL_TYPE_ICON_INFO (rygel_icon_info_get_type ())
#define RYGEL_ICON_INFO(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_ICON_INFO, RygelIconInfo))
#define RYGEL_ICON_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_ICON_INFO, RygelIconInfoClass))
#define RYGEL_IS_ICON_INFO(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_ICON_INFO))
#define RYGEL_IS_ICON_INFO_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_ICON_INFO))
#define RYGEL_ICON_INFO_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_ICON_INFO, RygelIconInfoClass))

typedef struct _RygelIconInfo RygelIconInfo;
typedef struct _RygelIconInfoClass RygelIconInfoClass;
typedef struct _RygelIconInfoPrivate RygelIconInfoPrivate;

#define RYGEL_TYPE_THUMBNAIL (rygel_thumbnail_get_type ())
#define RYGEL_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_THUMBNAIL, RygelThumbnail))
#define RYGEL_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_THUMBNAIL, RygelThumbnailClass))
#define RYGEL_IS_THUMBNAIL(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_THUMBNAIL))
#define RYGEL_IS_THUMBNAIL_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_THUMBNAIL))
#define RYGEL_THUMBNAIL_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_THUMBNAIL, RygelThumbnailClass))

typedef struct _RygelThumbnail RygelThumbnail;
typedef struct _RygelThumbnailClass RygelThumbnailClass;
typedef struct _RygelThumbnailPrivate RygelThumbnailPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

struct _RygelIconInfo {
	GTypeInstance parent_instance;
	volatile int ref_count;
	RygelIconInfoPrivate * priv;
	gchar* mime_type;
	gchar* uri;
	gchar* file_extension;
	gint64 size;
	gint width;
	gint height;
	gint depth;
};

struct _RygelIconInfoClass {
	GTypeClass parent_class;
	void (*finalize) (RygelIconInfo *self);
};

struct _RygelThumbnail {
	RygelIconInfo parent_instance;
	RygelThumbnailPrivate * priv;
	gchar* dlna_profile;
};

struct _RygelThumbnailClass {
	RygelIconInfoClass parent_class;
	GUPnPDIDLLiteResource* (*add_resource) (RygelThumbnail* self, GUPnPDIDLLiteItem* didl_item, const gchar* protocol);
};


static gpointer rygel_thumbnail_parent_class = NULL;

gpointer rygel_icon_info_ref (gpointer instance);
void rygel_icon_info_unref (gpointer instance);
GParamSpec* rygel_param_spec_icon_info (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void rygel_value_set_icon_info (GValue* value, gpointer v_object);
void rygel_value_take_icon_info (GValue* value, gpointer v_object);
gpointer rygel_value_get_icon_info (const GValue* value);
GType rygel_icon_info_get_type (void) G_GNUC_CONST;
GType rygel_thumbnail_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_THUMBNAIL_DUMMY_PROPERTY
};
RygelThumbnail* rygel_thumbnail_new (const gchar* mime_type, const gchar* dlna_profile, const gchar* file_extension);
RygelThumbnail* rygel_thumbnail_construct (GType object_type, const gchar* mime_type, const gchar* dlna_profile, const gchar* file_extension);
RygelIconInfo* rygel_icon_info_new (const gchar* mime_type, const gchar* file_extension);
RygelIconInfo* rygel_icon_info_construct (GType object_type, const gchar* mime_type, const gchar* file_extension);
GUPnPDIDLLiteResource* rygel_thumbnail_add_resource (RygelThumbnail* self, GUPnPDIDLLiteItem* didl_item, const gchar* protocol);
static GUPnPDIDLLiteResource* rygel_thumbnail_real_add_resource (RygelThumbnail* self, GUPnPDIDLLiteItem* didl_item, const gchar* protocol);
static GUPnPProtocolInfo* rygel_thumbnail_get_protocol_info (RygelThumbnail* self, const gchar* protocol);
static void rygel_thumbnail_finalize (RygelIconInfo* obj);


RygelThumbnail* rygel_thumbnail_construct (GType object_type, const gchar* mime_type, const gchar* dlna_profile, const gchar* file_extension) {
	RygelThumbnail* self = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	gchar* _tmp3_;
#line 31 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	g_return_val_if_fail (mime_type != NULL, NULL);
#line 31 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	g_return_val_if_fail (dlna_profile != NULL, NULL);
#line 31 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	g_return_val_if_fail (file_extension != NULL, NULL);
#line 34 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp0_ = mime_type;
#line 34 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp1_ = file_extension;
#line 34 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	self = (RygelThumbnail*) rygel_icon_info_construct (object_type, _tmp0_, _tmp1_);
#line 36 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp2_ = dlna_profile;
#line 36 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp3_ = g_strdup (_tmp2_);
#line 36 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_g_free0 (self->dlna_profile);
#line 36 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	self->dlna_profile = _tmp3_;
#line 31 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	return self;
#line 139 "rygel-thumbnail.c"
}


RygelThumbnail* rygel_thumbnail_new (const gchar* mime_type, const gchar* dlna_profile, const gchar* file_extension) {
#line 31 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	return rygel_thumbnail_construct (RYGEL_TYPE_THUMBNAIL, mime_type, dlna_profile, file_extension);
#line 146 "rygel-thumbnail.c"
}


static GUPnPDIDLLiteResource* rygel_thumbnail_real_add_resource (RygelThumbnail* self, GUPnPDIDLLiteItem* didl_item, const gchar* protocol) {
	GUPnPDIDLLiteResource* result = NULL;
	GUPnPDIDLLiteItem* _tmp0_;
	GUPnPDIDLLiteResource* _tmp1_ = NULL;
	GUPnPDIDLLiteResource* res;
	const gchar* _tmp2_;
	gint64 _tmp3_;
	gint _tmp4_;
	gint _tmp5_;
	gint _tmp6_;
	const gchar* _tmp7_;
	GUPnPProtocolInfo* _tmp8_ = NULL;
	GUPnPProtocolInfo* _tmp9_;
#line 39 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	g_return_val_if_fail (didl_item != NULL, NULL);
#line 39 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	g_return_val_if_fail (protocol != NULL, NULL);
#line 41 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp0_ = didl_item;
#line 41 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp1_ = gupnp_didl_lite_object_add_resource ((GUPnPDIDLLiteObject*) _tmp0_);
#line 41 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	res = _tmp1_;
#line 43 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp2_ = ((RygelIconInfo*) self)->uri;
#line 43 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_didl_lite_resource_set_uri (res, _tmp2_);
#line 44 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp3_ = ((RygelIconInfo*) self)->size;
#line 44 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_didl_lite_resource_set_size64 (res, _tmp3_);
#line 46 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp4_ = ((RygelIconInfo*) self)->width;
#line 46 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_didl_lite_resource_set_width (res, _tmp4_);
#line 47 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp5_ = ((RygelIconInfo*) self)->height;
#line 47 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_didl_lite_resource_set_height (res, _tmp5_);
#line 48 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp6_ = ((RygelIconInfo*) self)->depth;
#line 48 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_didl_lite_resource_set_color_depth (res, _tmp6_);
#line 51 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp7_ = protocol;
#line 51 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp8_ = rygel_thumbnail_get_protocol_info (self, _tmp7_);
#line 51 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp9_ = _tmp8_;
#line 51 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_didl_lite_resource_set_protocol_info (res, _tmp9_);
#line 51 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_g_object_unref0 (_tmp9_);
#line 53 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	result = res;
#line 53 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	return result;
#line 207 "rygel-thumbnail.c"
}


GUPnPDIDLLiteResource* rygel_thumbnail_add_resource (RygelThumbnail* self, GUPnPDIDLLiteItem* didl_item, const gchar* protocol) {
#line 39 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 39 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	return RYGEL_THUMBNAIL_GET_CLASS (self)->add_resource (self, didl_item, protocol);
#line 216 "rygel-thumbnail.c"
}


static GUPnPProtocolInfo* rygel_thumbnail_get_protocol_info (RygelThumbnail* self, const gchar* protocol) {
	GUPnPProtocolInfo* result = NULL;
	GUPnPProtocolInfo* _tmp0_;
	GUPnPProtocolInfo* protocol_info;
	const gchar* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	GUPnPDLNAFlags _tmp4_;
	GUPnPDLNAFlags _tmp5_;
#line 56 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	g_return_val_if_fail (self != NULL, NULL);
#line 56 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	g_return_val_if_fail (protocol != NULL, NULL);
#line 57 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp0_ = gupnp_protocol_info_new ();
#line 57 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	protocol_info = _tmp0_;
#line 59 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp1_ = ((RygelIconInfo*) self)->mime_type;
#line 59 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_protocol_info_set_mime_type (protocol_info, _tmp1_);
#line 60 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp2_ = self->dlna_profile;
#line 60 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_protocol_info_set_dlna_profile (protocol_info, _tmp2_);
#line 61 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp3_ = protocol;
#line 61 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_protocol_info_set_protocol (protocol_info, _tmp3_);
#line 62 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp4_ = gupnp_protocol_info_get_dlna_flags (protocol_info);
#line 62 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_tmp5_ = _tmp4_;
#line 62 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_protocol_info_set_dlna_flags (protocol_info, _tmp5_ | (((GUPNP_DLNA_FLAGS_INTERACTIVE_TRANSFER_MODE | GUPNP_DLNA_FLAGS_BACKGROUND_TRANSFER_MODE) | GUPNP_DLNA_FLAGS_CONNECTION_STALL) | GUPNP_DLNA_FLAGS_DLNA_V15));
#line 66 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_protocol_info_set_dlna_operation (protocol_info, GUPNP_DLNA_OPERATION_RANGE);
#line 67 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	gupnp_protocol_info_set_dlna_conversion (protocol_info, GUPNP_DLNA_CONVERSION_TRANSCODED);
#line 69 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	result = protocol_info;
#line 69 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	return result;
#line 263 "rygel-thumbnail.c"
}


static void rygel_thumbnail_class_init (RygelThumbnailClass * klass) {
#line 28 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	rygel_thumbnail_parent_class = g_type_class_peek_parent (klass);
#line 28 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	RYGEL_ICON_INFO_CLASS (klass)->finalize = rygel_thumbnail_finalize;
#line 28 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	RYGEL_THUMBNAIL_CLASS (klass)->add_resource = rygel_thumbnail_real_add_resource;
#line 274 "rygel-thumbnail.c"
}


static void rygel_thumbnail_instance_init (RygelThumbnail * self) {
}


static void rygel_thumbnail_finalize (RygelIconInfo* obj) {
	RygelThumbnail * self;
#line 28 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_THUMBNAIL, RygelThumbnail);
#line 29 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	_g_free0 (self->dlna_profile);
#line 28 "/home/jens/Source/rygel/tests/rygel-thumbnail.vala"
	RYGEL_ICON_INFO_CLASS (rygel_thumbnail_parent_class)->finalize (obj);
#line 290 "rygel-thumbnail.c"
}


/**
 * Represents a picture or video thumbnail.
 */
GType rygel_thumbnail_get_type (void) {
	static volatile gsize rygel_thumbnail_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_thumbnail_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelThumbnailClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_thumbnail_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelThumbnail), 0, (GInstanceInitFunc) rygel_thumbnail_instance_init, NULL };
		GType rygel_thumbnail_type_id;
		rygel_thumbnail_type_id = g_type_register_static (RYGEL_TYPE_ICON_INFO, "RygelThumbnail", &g_define_type_info, 0);
		g_once_init_leave (&rygel_thumbnail_type_id__volatile, rygel_thumbnail_type_id);
	}
	return rygel_thumbnail_type_id__volatile;
}



