/* rygel-mediathek-video-item-factory.c generated by valac 0.30.0.35-2c9e8, the Vala compiler
 * generated from rygel-mediathek-video-item-factory.vala, do not modify */

/*
 * Copyright (C) 2011 Jens Georg
 *
 * Author: Jens Georg <mail@jensge.org>
 *
 * 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 <rygel-server.h>
#include <stdlib.h>
#include <string.h>
#include <gio/gio.h>
#include <libxml/tree.h>
#include <gee.h>
#include <libsoup/soup.h>
#include <rygel-core.h>


#define RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM (rygel_mediathek_video_item_get_type ())
#define RYGEL_MEDIATHEK_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM, RygelMediathekVideoItem))
#define RYGEL_MEDIATHEK_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM, RygelMediathekVideoItemClass))
#define RYGEL_MEDIATHEK_IS_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM))
#define RYGEL_MEDIATHEK_IS_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM))
#define RYGEL_MEDIATHEK_VIDEO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM, RygelMediathekVideoItemClass))

typedef struct _RygelMediathekVideoItem RygelMediathekVideoItem;
typedef struct _RygelMediathekVideoItemClass RygelMediathekVideoItemClass;
typedef struct _RygelMediathekVideoItemPrivate RygelMediathekVideoItemPrivate;

#define RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM_FACTORY (rygel_mediathek_video_item_factory_get_type ())
#define RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM_FACTORY, RygelMediathekVideoItemFactory))
#define RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM_FACTORY, RygelMediathekVideoItemFactoryClass))
#define RYGEL_MEDIATHEK_IS_VIDEO_ITEM_FACTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM_FACTORY))
#define RYGEL_MEDIATHEK_IS_VIDEO_ITEM_FACTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM_FACTORY))
#define RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM_FACTORY, RygelMediathekVideoItemFactoryClass))

typedef struct _RygelMediathekVideoItemFactory RygelMediathekVideoItemFactory;
typedef struct _RygelMediathekVideoItemFactoryClass RygelMediathekVideoItemFactoryClass;
typedef struct _RygelMediathekVideoItemFactoryPrivate RygelMediathekVideoItemFactoryPrivate;

#define RYGEL_MEDIATHEK_TYPE_PLAYLIST_PARSER (rygel_mediathek_playlist_parser_get_type ())
#define RYGEL_MEDIATHEK_PLAYLIST_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIATHEK_TYPE_PLAYLIST_PARSER, RygelMediathekPlaylistParser))
#define RYGEL_MEDIATHEK_PLAYLIST_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIATHEK_TYPE_PLAYLIST_PARSER, RygelMediathekPlaylistParserClass))
#define RYGEL_MEDIATHEK_IS_PLAYLIST_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIATHEK_TYPE_PLAYLIST_PARSER))
#define RYGEL_MEDIATHEK_IS_PLAYLIST_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIATHEK_TYPE_PLAYLIST_PARSER))
#define RYGEL_MEDIATHEK_PLAYLIST_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIATHEK_TYPE_PLAYLIST_PARSER, RygelMediathekPlaylistParserClass))

typedef struct _RygelMediathekPlaylistParser RygelMediathekPlaylistParser;
typedef struct _RygelMediathekPlaylistParserClass RygelMediathekPlaylistParserClass;
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _Block2Data Block2Data;
typedef struct _RygelMediathekVideoItemFactoryCreateData RygelMediathekVideoItemFactoryCreateData;

#define RYGEL_MEDIATHEK_TYPE_MOV_PLAYLIST_PARSER (rygel_mediathek_mov_playlist_parser_get_type ())
#define RYGEL_MEDIATHEK_MOV_PLAYLIST_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIATHEK_TYPE_MOV_PLAYLIST_PARSER, RygelMediathekMovPlaylistParser))
#define RYGEL_MEDIATHEK_MOV_PLAYLIST_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIATHEK_TYPE_MOV_PLAYLIST_PARSER, RygelMediathekMovPlaylistParserClass))
#define RYGEL_MEDIATHEK_IS_MOV_PLAYLIST_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIATHEK_TYPE_MOV_PLAYLIST_PARSER))
#define RYGEL_MEDIATHEK_IS_MOV_PLAYLIST_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIATHEK_TYPE_MOV_PLAYLIST_PARSER))
#define RYGEL_MEDIATHEK_MOV_PLAYLIST_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIATHEK_TYPE_MOV_PLAYLIST_PARSER, RygelMediathekMovPlaylistParserClass))

typedef struct _RygelMediathekMovPlaylistParser RygelMediathekMovPlaylistParser;
typedef struct _RygelMediathekMovPlaylistParserClass RygelMediathekMovPlaylistParserClass;

typedef enum  {
	RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR_XML_PARSE_ERROR,
	RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR_NETWORK_ERROR
} RygelMediathekVideoItemError;
#define RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR rygel_mediathek_video_item_error_quark ()
struct _RygelMediathekVideoItem {
	RygelVideoItem parent_instance;
	RygelMediathekVideoItemPrivate * priv;
};

struct _RygelMediathekVideoItemClass {
	RygelVideoItemClass parent_class;
};

struct _RygelMediathekVideoItemFactory {
	GObject parent_instance;
	RygelMediathekVideoItemFactoryPrivate * priv;
};

struct _RygelMediathekVideoItemFactoryClass {
	GObjectClass parent_class;
};

struct _RygelMediathekVideoItemFactoryPrivate {
	RygelMediathekPlaylistParser* playlist_parser;
	gchar* video_format;
};

struct _Block2Data {
	int _ref_count_;
	RygelMediathekVideoItemFactory* self;
	RygelMediathekVideoItem* item;
	RygelMediaEngine* media_engine;
	gpointer _async_data_;
};

struct _RygelMediathekVideoItemFactoryCreateData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelMediathekVideoItemFactory* self;
	RygelMediaContainer* parent;
	xmlNode* xml_item;
	RygelMediathekVideoItem* result;
	Block2Data* _data2_;
	gchar* title;
	gchar* playlist_url;
	gchar* date;
	gchar* description;
	xmlNode* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	GeeList* resolved_uris;
	RygelMediathekPlaylistParser* _tmp5_;
	const gchar* _tmp6_;
	GeeList* _tmp7_;
	gboolean _tmp8_;
	GeeList* _tmp9_;
	GeeList* _tmp10_;
	gint _tmp11_;
	gint _tmp12_;
	gchar* id;
	const gchar* _tmp13_;
	gchar* _tmp14_;
	const gchar* _tmp15_;
	RygelMediaContainer* _tmp16_;
	const gchar* _tmp17_;
	RygelMediathekVideoItem* _tmp18_;
	RygelMediathekVideoItem* _tmp19_;
	RygelMediathekPlaylistParser* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	RygelMediathekVideoItem* _tmp23_;
	RygelMediathekVideoItem* _tmp24_;
	const gchar* _tmp25_;
	RygelMediathekVideoItem* _tmp26_;
	const gchar* _tmp27_;
	const gchar* _tmp28_;
	RygelMediathekVideoItem* _tmp29_;
	GeeList* _uri_list;
	GeeList* _tmp30_;
	GeeList* _tmp31_;
	gint _uri_size;
	GeeList* _tmp32_;
	gint _tmp33_;
	gint _tmp34_;
	gint _uri_index;
	gint _tmp35_;
	gint _tmp36_;
	gint _tmp37_;
	gchar* uri;
	GeeList* _tmp38_;
	gint _tmp39_;
	gpointer _tmp40_;
	RygelMediathekVideoItem* _tmp41_;
	const gchar* _tmp42_;
	RygelMediaEngine* _tmp43_;
	RygelMediaEngine* _tmp44_;
	RygelMediathekVideoItem* _tmp45_;
	RygelMediathekVideoItem* _tmp46_;
	RygelMediathekVideoItem* _tmp47_;
	GError * _inner_error_;
};


static gpointer rygel_mediathek_video_item_parent_class = NULL;
static RygelTrackableItemIface* rygel_mediathek_video_item_rygel_trackable_item_parent_iface = NULL;
static gpointer rygel_mediathek_video_item_factory_parent_class = NULL;
static RygelMediathekVideoItemFactory* rygel_mediathek_video_item_factory_instance;
static RygelMediathekVideoItemFactory* rygel_mediathek_video_item_factory_instance = NULL;

GQuark rygel_mediathek_video_item_error_quark (void);
GType rygel_mediathek_video_item_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_MEDIATHEK_VIDEO_ITEM_DUMMY_PROPERTY
};
RygelMediathekVideoItem* rygel_mediathek_video_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelMediathekVideoItem* rygel_mediathek_video_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title);
GType rygel_mediathek_video_item_factory_get_type (void) G_GNUC_CONST;
GType rygel_mediathek_playlist_parser_get_type (void) G_GNUC_CONST;
#define RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM_FACTORY, RygelMediathekVideoItemFactoryPrivate))
enum  {
	RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY_DUMMY_PROPERTY
};
#define RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY_VIDEO_FORMAT_WMV "wmv"
#define RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY_VIDEO_FORMAT_MP4 "mp4"
RygelMediathekVideoItemFactory* rygel_mediathek_video_item_factory_get_default (void);
static RygelMediathekVideoItemFactory* rygel_mediathek_video_item_factory_new (void);
static RygelMediathekVideoItemFactory* rygel_mediathek_video_item_factory_construct (GType object_type);
static void rygel_mediathek_video_item_factory_create_data_free (gpointer _data);
void rygel_mediathek_video_item_factory_create (RygelMediathekVideoItemFactory* self, RygelMediaContainer* parent, xmlNode* xml_item, GAsyncReadyCallback _callback_, gpointer _user_data_);
RygelMediathekVideoItem* rygel_mediathek_video_item_factory_create_finish (RygelMediathekVideoItemFactory* self, GAsyncResult* _res_, GError** error);
static gboolean rygel_mediathek_video_item_factory_create_co (RygelMediathekVideoItemFactoryCreateData* _data_);
static Block2Data* block2_data_ref (Block2Data* _data2_);
static void block2_data_unref (void * _userdata_);
static void rygel_mediathek_video_item_factory_extract_data_from_xml (RygelMediathekVideoItemFactory* self, xmlNode* item, gchar** title, gchar** playlist_url, gchar** date, gchar** description, GError** error);
void rygel_mediathek_playlist_parser_parse (RygelMediathekPlaylistParser* self, const gchar* uri, GAsyncReadyCallback _callback_, gpointer _user_data_);
GeeList* rygel_mediathek_playlist_parser_parse_finish (RygelMediathekPlaylistParser* self, GAsyncResult* _res_, GError** error);
static void rygel_mediathek_video_item_factory_create_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
const gchar* rygel_mediathek_playlist_parser_get_mime_type (RygelMediathekPlaylistParser* self);
static void __lambda6_ (Block2Data* _data2_, GObject* obj, GAsyncResult* res);
static void ___lambda6__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self);
SoupSession* rygel_mediathek_root_container_get_default_session (void);
RygelMediathekMovPlaylistParser* rygel_mediathek_mov_playlist_parser_new (SoupSession* session);
RygelMediathekMovPlaylistParser* rygel_mediathek_mov_playlist_parser_construct (GType object_type, SoupSession* session);
GType rygel_mediathek_mov_playlist_parser_get_type (void) G_GNUC_CONST;
static gboolean rygel_mediathek_video_item_factory_namespace_ok (RygelMediathekVideoItemFactory* self, xmlNode* node, const gchar* prefix);
const gchar* rygel_mediathek_playlist_parser_get_playlist_suffix (RygelMediathekPlaylistParser* self);
static void rygel_mediathek_video_item_factory_finalize (GObject* obj);


GQuark rygel_mediathek_video_item_error_quark (void) {
	return g_quark_from_static_string ("rygel_mediathek_video_item_error-quark");
}


RygelMediathekVideoItem* rygel_mediathek_video_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title) {
	RygelMediathekVideoItem * self = NULL;
	const gchar* _tmp0_ = NULL;
	RygelMediaContainer* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (parent != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = id;
	_tmp1_ = parent;
	_tmp2_ = title;
	self = (RygelMediathekVideoItem*) rygel_video_item_construct (object_type, _tmp0_, _tmp1_, _tmp2_, RYGEL_VIDEO_ITEM_UPNP_CLASS);
	return self;
}


RygelMediathekVideoItem* rygel_mediathek_video_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title) {
	return rygel_mediathek_video_item_construct (RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM, id, parent, title);
}


static void rygel_mediathek_video_item_class_init (RygelMediathekVideoItemClass * klass) {
	rygel_mediathek_video_item_parent_class = g_type_class_peek_parent (klass);
}


static void rygel_mediathek_video_item_rygel_trackable_item_interface_init (RygelTrackableItemIface * iface) {
	rygel_mediathek_video_item_rygel_trackable_item_parent_iface = g_type_interface_peek_parent (iface);
}


static void rygel_mediathek_video_item_instance_init (RygelMediathekVideoItem * self) {
}


GType rygel_mediathek_video_item_get_type (void) {
	static volatile gsize rygel_mediathek_video_item_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_mediathek_video_item_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelMediathekVideoItemClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_mediathek_video_item_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediathekVideoItem), 0, (GInstanceInitFunc) rygel_mediathek_video_item_instance_init, NULL };
		static const GInterfaceInfo rygel_trackable_item_info = { (GInterfaceInitFunc) rygel_mediathek_video_item_rygel_trackable_item_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType rygel_mediathek_video_item_type_id;
		rygel_mediathek_video_item_type_id = g_type_register_static (RYGEL_TYPE_VIDEO_ITEM, "RygelMediathekVideoItem", &g_define_type_info, 0);
		g_type_add_interface_static (rygel_mediathek_video_item_type_id, RYGEL_TYPE_TRACKABLE_ITEM, &rygel_trackable_item_info);
		g_once_init_leave (&rygel_mediathek_video_item_type_id__volatile, rygel_mediathek_video_item_type_id);
	}
	return rygel_mediathek_video_item_type_id__volatile;
}


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


RygelMediathekVideoItemFactory* rygel_mediathek_video_item_factory_get_default (void) {
	RygelMediathekVideoItemFactory* result = NULL;
	RygelMediathekVideoItemFactory* _tmp0_ = NULL;
	RygelMediathekVideoItemFactory* _tmp2_ = NULL;
	RygelMediathekVideoItemFactory* _tmp3_ = NULL;
	_tmp0_ = rygel_mediathek_video_item_factory_instance;
	if (_tmp0_ == NULL) {
		RygelMediathekVideoItemFactory* _tmp1_ = NULL;
		_tmp1_ = rygel_mediathek_video_item_factory_new ();
		_g_object_unref0 (rygel_mediathek_video_item_factory_instance);
		rygel_mediathek_video_item_factory_instance = _tmp1_;
	}
	_tmp2_ = rygel_mediathek_video_item_factory_instance;
	_tmp3_ = _g_object_ref0 (_tmp2_);
	result = _tmp3_;
	return result;
}


static void rygel_mediathek_video_item_factory_create_data_free (gpointer _data) {
	RygelMediathekVideoItemFactoryCreateData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->parent);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediathekVideoItemFactoryCreateData, _data_);
}


void rygel_mediathek_video_item_factory_create (RygelMediathekVideoItemFactory* self, RygelMediaContainer* parent, xmlNode* xml_item, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelMediathekVideoItemFactoryCreateData* _data_;
	RygelMediathekVideoItemFactory* _tmp0_ = NULL;
	RygelMediaContainer* _tmp1_ = NULL;
	RygelMediaContainer* _tmp2_ = NULL;
	xmlNode* _tmp3_ = NULL;
	_data_ = g_slice_new0 (RygelMediathekVideoItemFactoryCreateData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_mediathek_video_item_factory_create);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_mediathek_video_item_factory_create_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = parent;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->parent);
	_data_->parent = _tmp2_;
	_tmp3_ = xml_item;
	_data_->xml_item = _tmp3_;
	rygel_mediathek_video_item_factory_create_co (_data_);
}


RygelMediathekVideoItem* rygel_mediathek_video_item_factory_create_finish (RygelMediathekVideoItemFactory* self, GAsyncResult* _res_, GError** error) {
	RygelMediathekVideoItem* result;
	RygelMediathekVideoItemFactoryCreateData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return NULL;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static Block2Data* block2_data_ref (Block2Data* _data2_) {
	g_atomic_int_inc (&_data2_->_ref_count_);
	return _data2_;
}


static void block2_data_unref (void * _userdata_) {
	Block2Data* _data2_;
	_data2_ = (Block2Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data2_->_ref_count_)) {
		RygelMediathekVideoItemFactory* self;
		self = _data2_->self;
		_g_object_unref0 (_data2_->media_engine);
		_g_object_unref0 (_data2_->item);
		_g_object_unref0 (self);
		g_slice_free (Block2Data, _data2_);
	}
}


static void rygel_mediathek_video_item_factory_create_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelMediathekVideoItemFactoryCreateData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_mediathek_video_item_factory_create_co (_data_);
}


static void __lambda6_ (Block2Data* _data2_, GObject* obj, GAsyncResult* res) {
	RygelMediathekVideoItemFactory* self;
	GeeList* added_resources = NULL;
	RygelMediaEngine* _tmp0_ = NULL;
	GAsyncResult* _tmp1_ = NULL;
	GeeList* _tmp2_ = NULL;
	GeeList* _tmp3_ = NULL;
	gint _tmp4_ = 0;
	gint _tmp5_ = 0;
	RygelMediathekVideoItem* _tmp6_ = NULL;
	gchar* _tmp7_ = NULL;
	gchar* _tmp8_ = NULL;
	RygelMediathekVideoItem* _tmp23_ = NULL;
	GeeList* _tmp24_ = NULL;
	GeeList* _tmp25_ = NULL;
	GeeList* _tmp26_ = NULL;
	self = _data2_->self;
	g_return_if_fail (res != NULL);
	_tmp0_ = _data2_->media_engine;
	_tmp1_ = res;
	_tmp2_ = rygel_media_engine_get_resources_for_item_finish (_tmp0_, _tmp1_);
	added_resources = _tmp2_;
	_tmp3_ = added_resources;
	_tmp4_ = gee_collection_get_size ((GeeCollection*) _tmp3_);
	_tmp5_ = _tmp4_;
	_tmp6_ = _data2_->item;
	_tmp7_ = rygel_media_object_get_primary_uri ((RygelMediaObject*) _tmp6_);
	_tmp8_ = _tmp7_;
	g_debug ("rygel-mediathek-video-item-factory.vala:89: Adding %d resources to ite" \
"m source %s", _tmp5_, _tmp8_);
	_g_free0 (_tmp8_);
	{
		GeeList* _resrc_list = NULL;
		GeeList* _tmp9_ = NULL;
		GeeList* _tmp10_ = NULL;
		gint _resrc_size = 0;
		GeeList* _tmp11_ = NULL;
		gint _tmp12_ = 0;
		gint _tmp13_ = 0;
		gint _resrc_index = 0;
		_tmp9_ = added_resources;
		_tmp10_ = _g_object_ref0 (_tmp9_);
		_resrc_list = _tmp10_;
		_tmp11_ = _resrc_list;
		_tmp12_ = gee_collection_get_size ((GeeCollection*) _tmp11_);
		_tmp13_ = _tmp12_;
		_resrc_size = _tmp13_;
		_resrc_index = -1;
		while (TRUE) {
			gint _tmp14_ = 0;
			gint _tmp15_ = 0;
			gint _tmp16_ = 0;
			RygelMediaResource* resrc = NULL;
			GeeList* _tmp17_ = NULL;
			gint _tmp18_ = 0;
			gpointer _tmp19_ = NULL;
			RygelMediaResource* _tmp20_ = NULL;
			gchar* _tmp21_ = NULL;
			gchar* _tmp22_ = NULL;
			_tmp14_ = _resrc_index;
			_resrc_index = _tmp14_ + 1;
			_tmp15_ = _resrc_index;
			_tmp16_ = _resrc_size;
			if (!(_tmp15_ < _tmp16_)) {
				break;
			}
			_tmp17_ = _resrc_list;
			_tmp18_ = _resrc_index;
			_tmp19_ = gee_list_get (_tmp17_, _tmp18_);
			resrc = (RygelMediaResource*) _tmp19_;
			_tmp20_ = resrc;
			_tmp21_ = rygel_media_resource_get_name (_tmp20_);
			_tmp22_ = _tmp21_;
			g_debug ("rygel-mediathek-video-item-factory.vala:92: Media-export item media re" \
"source %s", _tmp22_);
			_g_free0 (_tmp22_);
			_g_object_unref0 (resrc);
		}
		_g_object_unref0 (_resrc_list);
	}
	_tmp23_ = _data2_->item;
	_tmp24_ = rygel_media_object_get_resource_list ((RygelMediaObject*) _tmp23_);
	_tmp25_ = _tmp24_;
	_tmp26_ = added_resources;
	gee_collection_add_all ((GeeCollection*) _tmp25_, (GeeCollection*) _tmp26_);
	_g_object_unref0 (_tmp25_);
	_g_object_unref0 (added_resources);
}


static void ___lambda6__gasync_ready_callback (GObject* source_object, GAsyncResult* res, gpointer self) {
	__lambda6_ (self, source_object, res);
	block2_data_unref (self);
}


static gboolean rygel_mediathek_video_item_factory_create_co (RygelMediathekVideoItemFactoryCreateData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data2_ = g_slice_new0 (Block2Data);
	_data_->_data2_->_ref_count_ = 1;
	_data_->_data2_->self = g_object_ref (_data_->self);
	_data_->_data2_->_async_data_ = _data_;
	_data_->description = NULL;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->xml_item;
	_data_->_tmp1_ = NULL;
	_data_->_tmp2_ = NULL;
	_data_->_tmp3_ = NULL;
	_data_->_tmp4_ = NULL;
	rygel_mediathek_video_item_factory_extract_data_from_xml (_data_->self, _data_->_tmp0_, &_data_->_tmp1_, &_data_->_tmp2_, &_data_->_tmp3_, &_data_->_tmp4_, &_data_->_inner_error_);
	_g_free0 (_data_->title);
	_data_->title = _data_->_tmp1_;
	_g_free0 (_data_->playlist_url);
	_data_->playlist_url = _data_->_tmp2_;
	_g_free0 (_data_->date);
	_data_->date = _data_->_tmp3_;
	_g_free0 (_data_->description);
	_data_->description = _data_->_tmp4_;
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		if (_data_->_inner_error_->domain == RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_free0 (_data_->description);
			_g_free0 (_data_->date);
			_g_free0 (_data_->playlist_url);
			_g_free0 (_data_->title);
			block2_data_unref (_data_->_data2_);
			_data_->_data2_ = NULL;
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_free0 (_data_->description);
			_g_free0 (_data_->date);
			_g_free0 (_data_->playlist_url);
			_g_free0 (_data_->title);
			block2_data_unref (_data_->_data2_);
			_data_->_data2_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = _data_->self->priv->playlist_parser;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = _data_->playlist_url;
	_data_->_state_ = 1;
	rygel_mediathek_playlist_parser_parse (_data_->_tmp5_, _data_->_tmp6_, rygel_mediathek_video_item_factory_create_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = rygel_mediathek_playlist_parser_parse_finish (_data_->_tmp5_, _data_->_res_, &_data_->_inner_error_);
	_data_->resolved_uris = _data_->_tmp7_;
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		if (_data_->_inner_error_->domain == RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_free0 (_data_->description);
			_g_free0 (_data_->date);
			_g_free0 (_data_->playlist_url);
			_g_free0 (_data_->title);
			block2_data_unref (_data_->_data2_);
			_data_->_data2_ = NULL;
			if (_data_->_state_ == 0) {
				g_simple_async_result_complete_in_idle (_data_->_async_result);
			} else {
				g_simple_async_result_complete (_data_->_async_result);
			}
			g_object_unref (_data_->_async_result);
			return FALSE;
		} else {
			_g_free0 (_data_->description);
			_g_free0 (_data_->date);
			_g_free0 (_data_->playlist_url);
			_g_free0 (_data_->title);
			block2_data_unref (_data_->_data2_);
			_data_->_data2_ = NULL;
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _data_->_inner_error_->message, g_quark_to_string (_data_->_inner_error_->domain), _data_->_inner_error_->code);
			g_clear_error (&_data_->_inner_error_);
			return FALSE;
		}
	}
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = _data_->resolved_uris;
	if (_data_->_tmp9_ == NULL) {
		_data_->_tmp8_ = TRUE;
	} else {
		_data_->_tmp10_ = NULL;
		_data_->_tmp10_ = _data_->resolved_uris;
		_data_->_tmp11_ = 0;
		_data_->_tmp11_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp10_);
		_data_->_tmp12_ = 0;
		_data_->_tmp12_ = _data_->_tmp11_;
		_data_->_tmp8_ = _data_->_tmp12_ == 0;
	}
	if (_data_->_tmp8_) {
		_data_->result = NULL;
		_g_object_unref0 (_data_->resolved_uris);
		_g_free0 (_data_->description);
		_g_free0 (_data_->date);
		_g_free0 (_data_->playlist_url);
		_g_free0 (_data_->title);
		block2_data_unref (_data_->_data2_);
		_data_->_data2_ = NULL;
		if (_data_->_state_ == 0) {
			g_simple_async_result_complete_in_idle (_data_->_async_result);
		} else {
			g_simple_async_result_complete (_data_->_async_result);
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp13_ = NULL;
	_data_->_tmp13_ = _data_->title;
	_data_->_tmp14_ = NULL;
	_data_->_tmp14_ = g_compute_checksum_for_string (G_CHECKSUM_MD5, _data_->_tmp13_, (gsize) -1);
	_data_->id = _data_->_tmp14_;
	_data_->_tmp15_ = NULL;
	_data_->_tmp15_ = _data_->id;
	_data_->_tmp16_ = NULL;
	_data_->_tmp16_ = _data_->parent;
	_data_->_tmp17_ = NULL;
	_data_->_tmp17_ = _data_->title;
	_data_->_tmp18_ = NULL;
	_data_->_tmp18_ = rygel_mediathek_video_item_new (_data_->_tmp15_, _data_->_tmp16_, _data_->_tmp17_);
	_data_->_data2_->item = _data_->_tmp18_;
	_data_->_tmp19_ = NULL;
	_data_->_tmp19_ = _data_->_data2_->item;
	_data_->_tmp20_ = NULL;
	_data_->_tmp20_ = _data_->self->priv->playlist_parser;
	_data_->_tmp21_ = NULL;
	_data_->_tmp21_ = rygel_mediathek_playlist_parser_get_mime_type (_data_->_tmp20_);
	_data_->_tmp22_ = NULL;
	_data_->_tmp22_ = _data_->_tmp21_;
	rygel_media_file_item_set_mime_type ((RygelMediaFileItem*) _data_->_tmp19_, _data_->_tmp22_);
	_data_->_tmp23_ = NULL;
	_data_->_tmp23_ = _data_->_data2_->item;
	rygel_video_item_set_author ((RygelVideoItem*) _data_->_tmp23_, "ZDF - Second German TV Channel Streams");
	_data_->_tmp24_ = NULL;
	_data_->_tmp24_ = _data_->_data2_->item;
	_data_->_tmp25_ = NULL;
	_data_->_tmp25_ = _data_->date;
	rygel_media_object_set_date ((RygelMediaObject*) _data_->_tmp24_, _data_->_tmp25_);
	_data_->_tmp26_ = NULL;
	_data_->_tmp26_ = _data_->_data2_->item;
	_data_->_tmp27_ = NULL;
	_data_->_tmp27_ = _data_->description;
	rygel_media_item_set_description ((RygelMediaItem*) _data_->_tmp26_, _data_->_tmp27_);
	_data_->_tmp28_ = NULL;
	_data_->_tmp28_ = _data_->self->priv->video_format;
	if (g_strcmp0 (_data_->_tmp28_, RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY_VIDEO_FORMAT_WMV) == 0) {
		_data_->_tmp29_ = NULL;
		_data_->_tmp29_ = _data_->_data2_->item;
		rygel_media_file_item_set_dlna_profile ((RygelMediaFileItem*) _data_->_tmp29_, "WMVMED_FULL");
	}
	{
		_data_->_tmp30_ = NULL;
		_data_->_tmp30_ = _data_->resolved_uris;
		_data_->_tmp31_ = NULL;
		_data_->_tmp31_ = _g_object_ref0 (_data_->_tmp30_);
		_data_->_uri_list = _data_->_tmp31_;
		_data_->_tmp32_ = NULL;
		_data_->_tmp32_ = _data_->_uri_list;
		_data_->_tmp33_ = 0;
		_data_->_tmp33_ = gee_collection_get_size ((GeeCollection*) _data_->_tmp32_);
		_data_->_tmp34_ = 0;
		_data_->_tmp34_ = _data_->_tmp33_;
		_data_->_uri_size = _data_->_tmp34_;
		_data_->_uri_index = -1;
		while (TRUE) {
			_data_->_tmp35_ = 0;
			_data_->_tmp35_ = _data_->_uri_index;
			_data_->_uri_index = _data_->_tmp35_ + 1;
			_data_->_tmp36_ = 0;
			_data_->_tmp36_ = _data_->_uri_index;
			_data_->_tmp37_ = 0;
			_data_->_tmp37_ = _data_->_uri_size;
			if (!(_data_->_tmp36_ < _data_->_tmp37_)) {
				break;
			}
			_data_->_tmp38_ = NULL;
			_data_->_tmp38_ = _data_->_uri_list;
			_data_->_tmp39_ = 0;
			_data_->_tmp39_ = _data_->_uri_index;
			_data_->_tmp40_ = NULL;
			_data_->_tmp40_ = gee_list_get (_data_->_tmp38_, _data_->_tmp39_);
			_data_->uri = (gchar*) _data_->_tmp40_;
			_data_->_tmp41_ = NULL;
			_data_->_tmp41_ = _data_->_data2_->item;
			_data_->_tmp42_ = NULL;
			_data_->_tmp42_ = _data_->uri;
			rygel_media_object_add_uri ((RygelMediaObject*) _data_->_tmp41_, _data_->_tmp42_);
			_g_free0 (_data_->uri);
		}
		_g_object_unref0 (_data_->_uri_list);
	}
	_data_->_tmp43_ = NULL;
	_data_->_tmp43_ = rygel_media_engine_get_default ();
	_data_->_data2_->media_engine = _data_->_tmp43_;
	_data_->_tmp44_ = NULL;
	_data_->_tmp44_ = _data_->_data2_->media_engine;
	_data_->_tmp45_ = NULL;
	_data_->_tmp45_ = _data_->_data2_->item;
	rygel_media_engine_get_resources_for_item (_data_->_tmp44_, (RygelMediaObject*) _data_->_tmp45_, ___lambda6__gasync_ready_callback, block2_data_ref (_data_->_data2_));
	_data_->_tmp46_ = NULL;
	_data_->_tmp46_ = _data_->_data2_->item;
	_data_->_tmp47_ = NULL;
	_data_->_tmp47_ = _g_object_ref0 (_data_->_tmp46_);
	_data_->result = _data_->_tmp47_;
	_g_free0 (_data_->id);
	_g_object_unref0 (_data_->resolved_uris);
	_g_free0 (_data_->description);
	_g_free0 (_data_->date);
	_g_free0 (_data_->playlist_url);
	_g_free0 (_data_->title);
	block2_data_unref (_data_->_data2_);
	_data_->_data2_ = NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
	_g_free0 (_data_->id);
	_g_object_unref0 (_data_->resolved_uris);
	_g_free0 (_data_->description);
	_g_free0 (_data_->date);
	_g_free0 (_data_->playlist_url);
	_g_free0 (_data_->title);
	block2_data_unref (_data_->_data2_);
	_data_->_data2_ = NULL;
	if (_data_->_state_ == 0) {
		g_simple_async_result_complete_in_idle (_data_->_async_result);
	} else {
		g_simple_async_result_complete (_data_->_async_result);
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static RygelMediathekVideoItemFactory* rygel_mediathek_video_item_factory_construct (GType object_type) {
	RygelMediathekVideoItemFactory * self = NULL;
	gchar* _tmp0_ = NULL;
	SoupSession* session = NULL;
	SoupSession* _tmp1_ = NULL;
	RygelMediathekMovPlaylistParser* _tmp2_ = NULL;
	self = (RygelMediathekVideoItemFactory*) g_object_new (object_type, NULL);
	_tmp0_ = g_strdup (RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY_VIDEO_FORMAT_MP4);
	_g_free0 (self->priv->video_format);
	self->priv->video_format = _tmp0_;
	g_debug ("rygel-mediathek-video-item-factory.vala:104: Exposing mediathek items " \
"in format: mp4");
	_tmp1_ = rygel_mediathek_root_container_get_default_session ();
	session = _tmp1_;
	_tmp2_ = rygel_mediathek_mov_playlist_parser_new (session);
	_g_object_unref0 (self->priv->playlist_parser);
	self->priv->playlist_parser = (RygelMediathekPlaylistParser*) _tmp2_;
	_g_object_unref0 (session);
	return self;
}


static RygelMediathekVideoItemFactory* rygel_mediathek_video_item_factory_new (void) {
	return rygel_mediathek_video_item_factory_construct (RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM_FACTORY);
}


static gboolean rygel_mediathek_video_item_factory_namespace_ok (RygelMediathekVideoItemFactory* self, xmlNode* node, const gchar* prefix) {
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	xmlNode* _tmp1_ = NULL;
	xmlNs* _tmp2_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (prefix != NULL, FALSE);
	_tmp1_ = node;
	_tmp2_ = _tmp1_->ns;
	if (_tmp2_ != NULL) {
		xmlNode* _tmp3_ = NULL;
		xmlNs* _tmp4_ = NULL;
		const gchar* _tmp5_ = NULL;
		const gchar* _tmp6_ = NULL;
		_tmp3_ = node;
		_tmp4_ = _tmp3_->ns;
		_tmp5_ = _tmp4_->prefix;
		_tmp6_ = prefix;
		_tmp0_ = g_strcmp0 (_tmp5_, _tmp6_) == 0;
	} else {
		_tmp0_ = FALSE;
	}
	result = _tmp0_;
	return result;
}


static void rygel_mediathek_video_item_factory_extract_data_from_xml (RygelMediathekVideoItemFactory* self, xmlNode* item, gchar** title, gchar** playlist_url, gchar** date, gchar** description, GError** error) {
	gchar* _vala_title = NULL;
	gchar* _vala_playlist_url = NULL;
	gchar* _vala_date = NULL;
	gchar* _vala_description = NULL;
	xmlNode* title_node = NULL;
	xmlNode* _tmp0_ = NULL;
	xmlNode* _tmp1_ = NULL;
	xmlNode* group = NULL;
	xmlNode* _tmp2_ = NULL;
	xmlNode* _tmp3_ = NULL;
	xmlNode* _tmp4_ = NULL;
	xmlNode* _tmp6_ = NULL;
	xmlNode* _tmp8_ = NULL;
	gboolean _tmp9_ = FALSE;
	xmlNode* content = NULL;
	xmlNode* _tmp11_ = NULL;
	xmlNode* _tmp12_ = NULL;
	xmlNode* _tmp13_ = NULL;
	const gchar* _tmp34_ = NULL;
	xmlNode* _tmp36_ = NULL;
	gchar* _tmp37_ = NULL;
	xmlNode* date_node = NULL;
	xmlNode* _tmp38_ = NULL;
	xmlNode* _tmp39_ = NULL;
	gboolean _tmp40_ = FALSE;
	xmlNode* _tmp41_ = NULL;
	xmlNode* desc_node = NULL;
	xmlNode* _tmp46_ = NULL;
	xmlNode* _tmp47_ = NULL;
	xmlNode* _tmp48_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = item;
	_tmp1_ = rygel_xml_utils_get_element (_tmp0_, "title", NULL);
	title_node = _tmp1_;
	_tmp2_ = item;
	_tmp3_ = rygel_xml_utils_get_element (_tmp2_, "group", NULL);
	group = _tmp3_;
	_g_free0 (_vala_playlist_url);
	_vala_playlist_url = NULL;
	_tmp4_ = title_node;
	if (_tmp4_ == NULL) {
		GError* _tmp5_ = NULL;
		_tmp5_ = g_error_new_literal (RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR, RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR_XML_PARSE_ERROR, "No 'title' element");
		_inner_error_ = _tmp5_;
		if (_inner_error_->domain == RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR) {
			g_propagate_error (error, _inner_error_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp6_ = group;
	if (_tmp6_ == NULL) {
		GError* _tmp7_ = NULL;
		_tmp7_ = g_error_new_literal (RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR, RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR_XML_PARSE_ERROR, "No 'group' element");
		_inner_error_ = _tmp7_;
		if (_inner_error_->domain == RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR) {
			g_propagate_error (error, _inner_error_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp8_ = group;
	_tmp9_ = rygel_mediathek_video_item_factory_namespace_ok (self, _tmp8_, "media");
	if (!_tmp9_) {
		GError* _tmp10_ = NULL;
		_tmp10_ = g_error_new_literal (RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR, RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR_XML_PARSE_ERROR, "Invalid namespace");
		_inner_error_ = _tmp10_;
		if (_inner_error_->domain == RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR) {
			g_propagate_error (error, _inner_error_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp11_ = group;
	_tmp12_ = rygel_xml_utils_get_element (_tmp11_, "content", NULL);
	content = _tmp12_;
	_tmp13_ = content;
	if (_tmp13_ == NULL) {
		GError* _tmp14_ = NULL;
		_tmp14_ = g_error_new_literal (RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR, RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR_XML_PARSE_ERROR, "'group' has no 'content' element");
		_inner_error_ = _tmp14_;
		if (_inner_error_->domain == RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR) {
			g_propagate_error (error, _inner_error_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	while (TRUE) {
		xmlNode* _tmp15_ = NULL;
		xmlAttr* url_attribute = NULL;
		xmlNode* _tmp16_ = NULL;
		xmlAttr* _tmp17_ = NULL;
		gboolean _tmp18_ = FALSE;
		xmlAttr* _tmp19_ = NULL;
		xmlNode* _tmp32_ = NULL;
		xmlNode* _tmp33_ = NULL;
		_tmp15_ = content;
		if (!(_tmp15_ != NULL)) {
			break;
		}
		_tmp16_ = content;
		_tmp17_ = xmlHasProp (_tmp16_, (xmlChar*) "url");
		url_attribute = _tmp17_;
		_tmp19_ = url_attribute;
		if (_tmp19_ != NULL) {
			xmlNode* _tmp20_ = NULL;
			gboolean _tmp21_ = FALSE;
			_tmp20_ = content;
			_tmp21_ = rygel_mediathek_video_item_factory_namespace_ok (self, _tmp20_, "media");
			_tmp18_ = _tmp21_;
		} else {
			_tmp18_ = FALSE;
		}
		if (_tmp18_) {
			const gchar* url = NULL;
			xmlAttr* _tmp22_ = NULL;
			xmlNode* _tmp23_ = NULL;
			const gchar* _tmp24_ = NULL;
			const gchar* _tmp25_ = NULL;
			RygelMediathekPlaylistParser* _tmp26_ = NULL;
			const gchar* _tmp27_ = NULL;
			const gchar* _tmp28_ = NULL;
			gboolean _tmp29_ = FALSE;
			_tmp22_ = url_attribute;
			_tmp23_ = _tmp22_->children;
			_tmp24_ = _tmp23_->content;
			url = _tmp24_;
			_tmp25_ = url;
			_tmp26_ = self->priv->playlist_parser;
			_tmp27_ = rygel_mediathek_playlist_parser_get_playlist_suffix (_tmp26_);
			_tmp28_ = _tmp27_;
			_tmp29_ = g_str_has_suffix (_tmp25_, _tmp28_);
			if (_tmp29_) {
				const gchar* _tmp30_ = NULL;
				gchar* _tmp31_ = NULL;
				_tmp30_ = url;
				_tmp31_ = g_strdup (_tmp30_);
				_g_free0 (_vala_playlist_url);
				_vala_playlist_url = _tmp31_;
				break;
			}
		}
		_tmp32_ = content;
		_tmp33_ = _tmp32_->next;
		content = _tmp33_;
	}
	_tmp34_ = _vala_playlist_url;
	if (_tmp34_ == NULL) {
		GError* _tmp35_ = NULL;
		_tmp35_ = g_error_new_literal (RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR, RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR_XML_PARSE_ERROR, "No URL found");
		_inner_error_ = _tmp35_;
		if (_inner_error_->domain == RYGEL_MEDIATHEK_VIDEO_ITEM_ERROR) {
			g_propagate_error (error, _inner_error_);
			return;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error_->message, g_quark_to_string (_inner_error_->domain), _inner_error_->code);
			g_clear_error (&_inner_error_);
			return;
		}
	}
	_tmp36_ = title_node;
	_tmp37_ = (gchar*) xmlNodeGetContent (_tmp36_);
	_g_free0 (_vala_title);
	_vala_title = _tmp37_;
	_tmp38_ = item;
	_tmp39_ = rygel_xml_utils_get_element (_tmp38_, "date", NULL);
	date_node = _tmp39_;
	_tmp41_ = date_node;
	if (_tmp41_ != NULL) {
		xmlNode* _tmp42_ = NULL;
		gboolean _tmp43_ = FALSE;
		_tmp42_ = date_node;
		_tmp43_ = rygel_mediathek_video_item_factory_namespace_ok (self, _tmp42_, "dc");
		_tmp40_ = _tmp43_;
	} else {
		_tmp40_ = FALSE;
	}
	if (_tmp40_) {
		xmlNode* _tmp44_ = NULL;
		gchar* _tmp45_ = NULL;
		_tmp44_ = date_node;
		_tmp45_ = (gchar*) xmlNodeGetContent (_tmp44_);
		_g_free0 (_vala_date);
		_vala_date = _tmp45_;
	} else {
		_g_free0 (_vala_date);
		_vala_date = NULL;
	}
	_tmp46_ = item;
	_tmp47_ = rygel_xml_utils_get_element (_tmp46_, "description", NULL);
	desc_node = _tmp47_;
	_tmp48_ = desc_node;
	if (_tmp48_ != NULL) {
		xmlNode* _tmp49_ = NULL;
		gchar* _tmp50_ = NULL;
		_tmp49_ = desc_node;
		_tmp50_ = (gchar*) xmlNodeGetContent (_tmp49_);
		_g_free0 (_vala_description);
		_vala_description = _tmp50_;
	} else {
		_g_free0 (_vala_description);
		_vala_description = NULL;
	}
	if (title) {
		*title = _vala_title;
	} else {
		_g_free0 (_vala_title);
	}
	if (playlist_url) {
		*playlist_url = _vala_playlist_url;
	} else {
		_g_free0 (_vala_playlist_url);
	}
	if (date) {
		*date = _vala_date;
	} else {
		_g_free0 (_vala_date);
	}
	if (description) {
		*description = _vala_description;
	} else {
		_g_free0 (_vala_description);
	}
}


static void rygel_mediathek_video_item_factory_class_init (RygelMediathekVideoItemFactoryClass * klass) {
	rygel_mediathek_video_item_factory_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (RygelMediathekVideoItemFactoryPrivate));
	G_OBJECT_CLASS (klass)->finalize = rygel_mediathek_video_item_factory_finalize;
}


static void rygel_mediathek_video_item_factory_instance_init (RygelMediathekVideoItemFactory * self) {
	self->priv = RYGEL_MEDIATHEK_VIDEO_ITEM_FACTORY_GET_PRIVATE (self);
}


static void rygel_mediathek_video_item_factory_finalize (GObject* obj) {
	RygelMediathekVideoItemFactory * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIATHEK_TYPE_VIDEO_ITEM_FACTORY, RygelMediathekVideoItemFactory);
	_g_object_unref0 (self->priv->playlist_parser);
	_g_free0 (self->priv->video_format);
	G_OBJECT_CLASS (rygel_mediathek_video_item_factory_parent_class)->finalize (obj);
}


GType rygel_mediathek_video_item_factory_get_type (void) {
	static volatile gsize rygel_mediathek_video_item_factory_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_mediathek_video_item_factory_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelMediathekVideoItemFactoryClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_mediathek_video_item_factory_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediathekVideoItemFactory), 0, (GInstanceInitFunc) rygel_mediathek_video_item_factory_instance_init, NULL };
		GType rygel_mediathek_video_item_factory_type_id;
		rygel_mediathek_video_item_factory_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelMediathekVideoItemFactory", &g_define_type_info, 0);
		g_once_init_leave (&rygel_mediathek_video_item_factory_type_id__volatile, rygel_mediathek_video_item_factory_type_id);
	}
	return rygel_mediathek_video_item_factory_type_id__volatile;
}



