/* rygel-media-export-dvd-container.c generated by valac 0.42.2, the Vala compiler
 * generated from rygel-media-export-dvd-container.vala, do not modify */

/*
 * Copyright (C) 2015 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 <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <libgupnp/gupnp.h>
#include <libxml/tree.h>
#include <libxml/parser.h>
#include <libxml/xpath.h>
#include <glib/gstdio.h>
#include <glib/gi18n-lib.h>


#define RYGEL_MEDIA_EXPORT_TYPE_UPDATABLE_OBJECT (rygel_media_export_updatable_object_get_type ())
#define RYGEL_MEDIA_EXPORT_UPDATABLE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_UPDATABLE_OBJECT, RygelMediaExportUpdatableObject))
#define RYGEL_MEDIA_EXPORT_IS_UPDATABLE_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_UPDATABLE_OBJECT))
#define RYGEL_MEDIA_EXPORT_UPDATABLE_OBJECT_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_MEDIA_EXPORT_TYPE_UPDATABLE_OBJECT, RygelMediaExportUpdatableObjectIface))

typedef struct _RygelMediaExportUpdatableObject RygelMediaExportUpdatableObject;
typedef struct _RygelMediaExportUpdatableObjectIface RygelMediaExportUpdatableObjectIface;

#define RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER (rygel_media_export_dvd_container_get_type ())
#define RYGEL_MEDIA_EXPORT_DVD_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER, RygelMediaExportDVDContainer))
#define RYGEL_MEDIA_EXPORT_DVD_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER, RygelMediaExportDVDContainerClass))
#define RYGEL_MEDIA_EXPORT_IS_DVD_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER))
#define RYGEL_MEDIA_EXPORT_IS_DVD_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER))
#define RYGEL_MEDIA_EXPORT_DVD_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER, RygelMediaExportDVDContainerClass))

typedef struct _RygelMediaExportDVDContainer RygelMediaExportDVDContainer;
typedef struct _RygelMediaExportDVDContainerClass RygelMediaExportDVDContainerClass;
typedef struct _RygelMediaExportDVDContainerPrivate RygelMediaExportDVDContainerPrivate;
enum  {
	RYGEL_MEDIA_EXPORT_DVD_CONTAINER_0_PROPERTY,
	RYGEL_MEDIA_EXPORT_DVD_CONTAINER_PATH_PROPERTY,
	RYGEL_MEDIA_EXPORT_DVD_CONTAINER_NUM_PROPERTIES
};
static GParamSpec* rygel_media_export_dvd_container_properties[RYGEL_MEDIA_EXPORT_DVD_CONTAINER_NUM_PROPERTIES];
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _xmlXPathFreeContext0(var) ((var == NULL) ? NULL : (var = (xmlXPathFreeContext (var), NULL)))
typedef struct _RygelMediaExportDvdContainerFindObjectData RygelMediaExportDvdContainerFindObjectData;
typedef struct _RygelMediaExportDvdContainerCommitData RygelMediaExportDvdContainerCommitData;

#define RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE (rygel_media_export_media_cache_get_type ())
#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCache))
#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCacheClass))
#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE))
#define RYGEL_MEDIA_EXPORT_IS_MEDIA_CACHE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE))
#define RYGEL_MEDIA_EXPORT_MEDIA_CACHE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_MEDIA_CACHE, RygelMediaExportMediaCacheClass))

typedef struct _RygelMediaExportMediaCache RygelMediaExportMediaCache;
typedef struct _RygelMediaExportMediaCacheClass RygelMediaExportMediaCacheClass;
typedef struct _RygelMediaExportDvdContainerCommitCustomData RygelMediaExportDvdContainerCommitCustomData;

#define RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM (rygel_media_export_video_item_get_type ())
#define RYGEL_MEDIA_EXPORT_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM, RygelMediaExportVideoItem))
#define RYGEL_MEDIA_EXPORT_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM, RygelMediaExportVideoItemClass))
#define RYGEL_MEDIA_EXPORT_IS_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM))
#define RYGEL_MEDIA_EXPORT_IS_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM))
#define RYGEL_MEDIA_EXPORT_VIDEO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_VIDEO_ITEM, RygelMediaExportVideoItemClass))

typedef struct _RygelMediaExportVideoItem RygelMediaExportVideoItem;
typedef struct _RygelMediaExportVideoItemClass RygelMediaExportVideoItemClass;

#define RYGEL_MEDIA_EXPORT_TYPE_DVD_TRACK (rygel_media_export_dvd_track_get_type ())
#define RYGEL_MEDIA_EXPORT_DVD_TRACK(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_MEDIA_EXPORT_TYPE_DVD_TRACK, RygelMediaExportDVDTrack))
#define RYGEL_MEDIA_EXPORT_DVD_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_MEDIA_EXPORT_TYPE_DVD_TRACK, RygelMediaExportDVDTrackClass))
#define RYGEL_MEDIA_EXPORT_IS_DVD_TRACK(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_MEDIA_EXPORT_TYPE_DVD_TRACK))
#define RYGEL_MEDIA_EXPORT_IS_DVD_TRACK_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_MEDIA_EXPORT_TYPE_DVD_TRACK))
#define RYGEL_MEDIA_EXPORT_DVD_TRACK_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_MEDIA_EXPORT_TYPE_DVD_TRACK, RygelMediaExportDVDTrackClass))

typedef struct _RygelMediaExportDVDTrack RygelMediaExportDVDTrack;
typedef struct _RygelMediaExportDVDTrackClass RygelMediaExportDVDTrackClass;

struct _RygelMediaExportUpdatableObjectIface {
	GTypeInterface parent_iface;
	void (*commit_custom) (RygelMediaExportUpdatableObject* self, gboolean override_guarded, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*commit_custom_finish) (RygelMediaExportUpdatableObject* self, GAsyncResult* _res_, GError** error);
};

struct _RygelMediaExportDVDContainer {
	RygelSimpleContainer parent_instance;
	RygelMediaExportDVDContainerPrivate * priv;
};

struct _RygelMediaExportDVDContainerClass {
	RygelSimpleContainerClass parent_class;
};

struct _RygelMediaExportDVDContainerPrivate {
	gchar* _path;
	GUPnPXMLDoc* doc;
};

struct _RygelMediaExportDvdContainerFindObjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	RygelMediaExportDVDContainer* self;
	gchar* id;
	GCancellable* cancellable;
	RygelMediaObject* result;
	gchar** parts;
	gchar** _tmp0_;
	gchar** _tmp1_;
	gint parts_length1;
	gint _parts_size_;
	gint track;
	gchar** _tmp2_;
	gint _tmp2__length1;
	const gchar* _tmp3_;
	xmlXPathContext* context;
	GUPnPXMLDoc* _tmp4_;
	xmlDoc* _tmp5_;
	xmlXPathContext* _tmp6_;
	xmlXPathObject* xpo;
	xmlXPathContext* _tmp7_;
	xmlXPathObject* _tmp8_;
	gboolean _tmp9_;
	xmlXPathObject* _tmp10_;
	xmlXPathObjectType _tmp11_;
	xmlXPathObject* _tmp12_;
	xmlNodeSet* _tmp13_;
	gint _tmp14_;
	xmlXPathObject* _tmp15_;
	gchar** _tmp16_;
	gint _tmp16__length1;
	const gchar* _tmp17_;
	RygelMediaFileItem* object;
	gchar** _tmp18_;
	gint _tmp18__length1;
	const gchar* _tmp19_;
	xmlXPathObject* _tmp20_;
	xmlNodeSet* _tmp21_;
	gint _tmp22_;
	xmlNode* _tmp23_;
	RygelMediaFileItem* _tmp24_;
	xmlXPathObject* _tmp25_;
};

struct _RygelMediaExportDvdContainerCommitData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	RygelMediaExportDVDContainer* self;
	GError * _inner_error_;
};

struct _RygelMediaExportDvdContainerCommitCustomData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	GAsyncReadyCallback _callback_;
	gboolean _task_complete_;
	RygelMediaExportDVDContainer* self;
	gboolean override_guarded;
	RygelMediaExportMediaCache* _tmp0_;
	RygelMediaExportMediaCache* _tmp1_;
	GError * _inner_error_;
};


static gint RygelMediaExportDVDContainer_private_offset;
static gpointer rygel_media_export_dvd_container_parent_class = NULL;
static RygelMediaExportUpdatableObjectIface * rygel_media_export_dvd_container_rygel_media_export_updatable_object_parent_iface = NULL;

GType rygel_media_export_updatable_object_get_type (void) G_GNUC_CONST;
GType rygel_media_export_dvd_container_get_type (void) G_GNUC_CONST;
#define RYGEL_MEDIA_EXPORT_DVD_CONTAINER_UPNP_CLASS RYGEL_MEDIA_CONTAINER_PLAYLIST ".DVD"
#define RYGEL_MEDIA_EXPORT_DVD_CONTAINER_PREFIX "dvd"
#define RYGEL_MEDIA_EXPORT_DVD_CONTAINER_TRACK_PREFIX "dvd-track"
RygelMediaExportDVDContainer* rygel_media_export_dvd_container_new (const gchar* id,
                                                                    RygelMediaContainer* parent,
                                                                    const gchar* title,
                                                                    const gchar* path);
RygelMediaExportDVDContainer* rygel_media_export_dvd_container_construct (GType object_type,
                                                                          const gchar* id,
                                                                          RygelMediaContainer* parent,
                                                                          const gchar* title,
                                                                          const gchar* path);
static void rygel_media_export_dvd_container_real_constructed (GObject* base);
const gchar* rygel_media_export_dvd_container_get_path (RygelMediaExportDVDContainer* self);
static gchar* rygel_media_export_dvd_container_get_cache_path (RygelMediaExportDVDContainer* self,
                                                        const gchar* image_path);
static RygelMediaFileItem* rygel_media_export_dvd_container_get_item_for_xml (RygelMediaExportDVDContainer* self,
                                                                       gint track,
                                                                       xmlNode* node);
static void rygel_media_export_dvd_container_real_find_object_data_free (gpointer _data);
static void rygel_media_export_dvd_container_real_find_object_async_ready_wrapper (GObject *source_object,
                                                                            GAsyncResult *res,
                                                                            void *user_data);
static void rygel_media_export_dvd_container_real_find_object (RygelMediaContainer* base,
                                                        const gchar* id,
                                                        GCancellable* cancellable,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_);
static gboolean rygel_media_export_dvd_container_real_find_object_co (RygelMediaExportDvdContainerFindObjectData* _data_);
static void rygel_media_export_dvd_container_commit_data_free (gpointer _data);
static void rygel_media_export_dvd_container_commit_async_ready_wrapper (GObject *source_object,
                                                                  GAsyncResult *res,
                                                                  void *user_data);
void rygel_media_export_dvd_container_commit (RygelMediaExportDVDContainer* self,
                                              GAsyncReadyCallback _callback_,
                                              gpointer _user_data_);
void rygel_media_export_dvd_container_commit_finish (RygelMediaExportDVDContainer* self,
                                                     GAsyncResult* _res_,
                                                     GError** error);
static gboolean rygel_media_export_dvd_container_commit_co (RygelMediaExportDvdContainerCommitData* _data_);
void rygel_media_export_updatable_object_commit_custom (RygelMediaExportUpdatableObject* self,
                                                        gboolean override_guarded,
                                                        GAsyncReadyCallback _callback_,
                                                        gpointer _user_data_);
void rygel_media_export_updatable_object_commit_custom_finish (RygelMediaExportUpdatableObject* self,
                                                               GAsyncResult* _res_,
                                                               GError** error);
static void rygel_media_export_dvd_container_commit_ready (GObject* source_object,
                                                    GAsyncResult* _res_,
                                                    gpointer _user_data_);
static void rygel_media_export_dvd_container_real_commit_custom_data_free (gpointer _data);
static void rygel_media_export_dvd_container_real_commit_custom_async_ready_wrapper (GObject *source_object,
                                                                              GAsyncResult *res,
                                                                              void *user_data);
static void rygel_media_export_dvd_container_real_commit_custom (RygelMediaExportUpdatableObject* base,
                                                          gboolean override_guarded,
                                                          GAsyncReadyCallback _callback_,
                                                          gpointer _user_data_);
static gboolean rygel_media_export_dvd_container_real_commit_custom_co (RygelMediaExportDvdContainerCommitCustomData* _data_);
GType rygel_media_export_media_cache_get_type (void) G_GNUC_CONST;
RygelMediaExportMediaCache* rygel_media_export_media_cache_get_default (void);
void rygel_media_export_media_cache_save_container (RygelMediaExportMediaCache* self,
                                                    RygelMediaContainer* container,
                                                    GError** error);
static gchar* rygel_media_export_dvd_container_get_track_id (RygelMediaExportDVDContainer* self,
                                                      gint track);
static void _vala_array_add1 (gchar** * array,
                       int* length,
                       int* size,
                       gchar* value);
GType rygel_media_export_video_item_get_type (void) G_GNUC_CONST;
GType rygel_media_export_dvd_track_get_type (void) G_GNUC_CONST;
RygelMediaExportDVDTrack* rygel_media_export_dvd_track_new (const gchar* id,
                                                            RygelMediaContainer* parent,
                                                            const gchar* title,
                                                            gint track,
                                                            xmlNode* node);
RygelMediaExportDVDTrack* rygel_media_export_dvd_track_construct (GType object_type,
                                                                  const gchar* id,
                                                                  RygelMediaContainer* parent,
                                                                  const gchar* title,
                                                                  gint track,
                                                                  xmlNode* node);
void rygel_media_export_dvd_container_set_path (RygelMediaExportDVDContainer* self,
                                                const gchar* value);
static void rygel_media_export_dvd_container_finalize (GObject * obj);
static void _vala_rygel_media_export_dvd_container_get_property (GObject * object,
                                                          guint property_id,
                                                          GValue * value,
                                                          GParamSpec * pspec);
static void _vala_rygel_media_export_dvd_container_set_property (GObject * object,
                                                          guint property_id,
                                                          const GValue * value,
                                                          GParamSpec * pspec);
static void _vala_array_destroy (gpointer array,
                          gint array_length,
                          GDestroyNotify destroy_func);
static void _vala_array_free (gpointer array,
                       gint array_length,
                       GDestroyNotify destroy_func);
static gint _vala_array_length (gpointer array);


static inline gpointer
rygel_media_export_dvd_container_get_instance_private (RygelMediaExportDVDContainer* self)
{
	return G_STRUCT_MEMBER_P (self, RygelMediaExportDVDContainer_private_offset);
}


RygelMediaExportDVDContainer*
rygel_media_export_dvd_container_construct (GType object_type,
                                            const gchar* id,
                                            RygelMediaContainer* parent,
                                            const gchar* title,
                                            const gchar* path)
{
	RygelMediaExportDVDContainer * self = NULL;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	g_return_val_if_fail (path != NULL, NULL);
	self = (RygelMediaExportDVDContainer*) g_object_new (object_type, "id", id, "upnp-class", RYGEL_MEDIA_EXPORT_DVD_CONTAINER_UPNP_CLASS, "title", title, "parent", parent, "child-count", 0, "path", path, NULL);
	return self;
}


RygelMediaExportDVDContainer*
rygel_media_export_dvd_container_new (const gchar* id,
                                      RygelMediaContainer* parent,
                                      const gchar* title,
                                      const gchar* path)
{
	return rygel_media_export_dvd_container_construct (RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER, id, parent, title, path);
}


static void
rygel_media_export_dvd_container_real_constructed (GObject* base)
{
	RygelMediaExportDVDContainer * self;
	const gchar* _tmp0_;
	GFile* _tmp1_;
	GFile* _tmp2_;
	gchar* _tmp3_;
	gchar* _tmp4_;
	gchar* cache_path = NULL;
	const gchar* _tmp5_;
	gchar* _tmp6_;
	xmlDoc* doc = NULL;
	const gchar* _tmp7_;
	xmlDoc* _tmp8_;
	xmlDoc* _tmp9_;
	GUPnPXMLDoc* _tmp10_;
	xmlXPathContext* context = NULL;
	GUPnPXMLDoc* _tmp11_;
	xmlDoc* _tmp12_;
	xmlXPathContext* _tmp13_;
	xmlXPathObject* xpo = NULL;
	xmlXPathContext* _tmp14_;
	xmlXPathObject* _tmp15_;
	xmlXPathObject* _tmp16_;
	xmlXPathObjectType _tmp17_;
	xmlXPathObject* _tmp31_;
	self = (RygelMediaExportDVDContainer*) base;
	G_OBJECT_CLASS (rygel_media_export_dvd_container_parent_class)->constructed ((GObject*) G_TYPE_CHECK_INSTANCE_CAST (self, RYGEL_TYPE_SIMPLE_CONTAINER, RygelSimpleContainer));
	_tmp0_ = self->priv->_path;
	_tmp1_ = g_file_new_for_path (_tmp0_);
	_tmp2_ = _tmp1_;
	_tmp3_ = g_file_get_uri (_tmp2_);
	_tmp4_ = _tmp3_;
	rygel_media_object_add_uri ((RygelMediaObject*) self, _tmp4_);
	_g_free0 (_tmp4_);
	_g_object_unref0 (_tmp2_);
	_tmp5_ = self->priv->_path;
	_tmp6_ = rygel_media_export_dvd_container_get_cache_path (self, _tmp5_);
	cache_path = _tmp6_;
	_tmp7_ = cache_path;
	_tmp8_ = xmlReadFile (_tmp7_, NULL, (gint) (((((XML_PARSE_NOERROR | XML_PARSE_NOWARNING) | XML_PARSE_NOBLANKS) | XML_PARSE_RECOVER) | XML_PARSE_NOENT) | XML_PARSE_NONET));
	doc = _tmp8_;
	_tmp9_ = doc;
	_tmp10_ = gupnp_xml_doc_new (_tmp9_);
	_g_object_unref0 (self->priv->doc);
	self->priv->doc = _tmp10_;
	_tmp11_ = self->priv->doc;
	_tmp12_ = _tmp11_->doc;
	_tmp13_ = xmlXPathNewContext (_tmp12_);
	context = _tmp13_;
	_tmp14_ = context;
	_tmp15_ = xmlXPathEval ((xmlChar*) "/lsdvd/track", _tmp14_);
	xpo = _tmp15_;
	_tmp16_ = xpo;
	_tmp17_ = _tmp16_->type;
	if (_tmp17_ != XPATH_NODESET) {
		g_warning ("rygel-media-export-dvd-container.vala:64: No tracks found in DVD");
	} else {
		{
			gint i = 0;
			i = 0;
			{
				gboolean _tmp18_ = FALSE;
				_tmp18_ = TRUE;
				while (TRUE) {
					gint _tmp20_;
					xmlXPathObject* _tmp21_;
					xmlNodeSet* _tmp22_;
					xmlNode* node = NULL;
					xmlXPathObject* _tmp23_;
					xmlNodeSet* _tmp24_;
					gint _tmp25_;
					xmlNode* _tmp26_;
					RygelMediaFileItem* item = NULL;
					gint _tmp27_;
					xmlNode* _tmp28_;
					RygelMediaFileItem* _tmp29_;
					RygelMediaFileItem* _tmp30_;
					if (!_tmp18_) {
						gint _tmp19_;
						_tmp19_ = i;
						i = _tmp19_ + 1;
					}
					_tmp18_ = FALSE;
					_tmp20_ = i;
					_tmp21_ = xpo;
					_tmp22_ = _tmp21_->nodesetval;
					if (!(_tmp20_ < xmlXPathNodeSetGetLength (_tmp22_))) {
						break;
					}
					_tmp23_ = xpo;
					_tmp24_ = _tmp23_->nodesetval;
					_tmp25_ = i;
					_tmp26_ = xmlXPathNodeSetItem (_tmp24_, _tmp25_);
					node = _tmp26_;
					_tmp27_ = i;
					_tmp28_ = node;
					_tmp29_ = rygel_media_export_dvd_container_get_item_for_xml (self, _tmp27_, _tmp28_);
					item = _tmp29_;
					_tmp30_ = item;
					rygel_simple_container_add_child_item ((RygelSimpleContainer*) self, (RygelMediaItem*) _tmp30_);
					_g_object_unref0 (item);
				}
			}
		}
	}
	_tmp31_ = xpo;
	xmlXPathFreeObject (_tmp31_);
	_xmlXPathFreeContext0 (context);
	_g_free0 (cache_path);
}


static void
rygel_media_export_dvd_container_real_find_object_data_free (gpointer _data)
{
	RygelMediaExportDvdContainerFindObjectData* _data_;
	_data_ = _data;
	_g_free0 (_data_->id);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediaExportDvdContainerFindObjectData, _data_);
}


static void
rygel_media_export_dvd_container_real_find_object_async_ready_wrapper (GObject *source_object,
                                                                       GAsyncResult *res,
                                                                       void *user_data)
{
	RygelMediaExportDvdContainerFindObjectData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


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


static void
rygel_media_export_dvd_container_real_find_object (RygelMediaContainer* base,
                                                   const gchar* id,
                                                   GCancellable* cancellable,
                                                   GAsyncReadyCallback _callback_,
                                                   gpointer _user_data_)
{
	RygelMediaExportDVDContainer * self;
	RygelMediaExportDvdContainerFindObjectData* _data_;
	RygelMediaExportDVDContainer* _tmp0_;
	gchar* _tmp1_;
	GCancellable* _tmp2_;
	self = (RygelMediaExportDVDContainer*) base;
	_data_ = g_slice_new0 (RygelMediaExportDvdContainerFindObjectData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, rygel_media_export_dvd_container_real_find_object_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_dvd_container_real_find_object_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = g_strdup (id);
	_g_free0 (_data_->id);
	_data_->id = _tmp1_;
	_tmp2_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp2_;
	rygel_media_export_dvd_container_real_find_object_co (_data_);
}


static RygelMediaObject*
rygel_media_export_dvd_container_real_find_object_finish (RygelMediaContainer* base,
                                                          GAsyncResult* _res_,
                                                          GError** error)
{
	RygelMediaObject* result;
	RygelMediaExportDvdContainerFindObjectData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static gboolean
rygel_media_export_dvd_container_real_find_object_co (RygelMediaExportDvdContainerFindObjectData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	if (!g_str_has_prefix (_data_->id, RYGEL_MEDIA_EXPORT_DVD_CONTAINER_TRACK_PREFIX)) {
		_data_->result = NULL;
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (_data_->_task_complete_ != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp1_ = _data_->_tmp0_ = g_strsplit (_data_->id, ":", 0);
	_data_->parts = _data_->_tmp1_;
	_data_->parts_length1 = _vala_array_length (_data_->_tmp0_);
	_data_->_parts_size_ = _data_->parts_length1;
	_data_->_tmp2_ = _data_->parts;
	_data_->_tmp2__length1 = _data_->parts_length1;
	_data_->_tmp3_ = _data_->_tmp2_[2];
	_data_->track = atoi (_data_->_tmp3_);
	_data_->_tmp4_ = _data_->self->priv->doc;
	_data_->_tmp5_ = _data_->_tmp4_->doc;
	_data_->_tmp6_ = xmlXPathNewContext (_data_->_tmp5_);
	_data_->context = _data_->_tmp6_;
	_data_->_tmp7_ = _data_->context;
	_data_->_tmp8_ = xmlXPathEval ((xmlChar*) "/lsdvd/track", _data_->_tmp7_);
	_data_->xpo = _data_->_tmp8_;
	_data_->_tmp10_ = _data_->xpo;
	_data_->_tmp11_ = _data_->_tmp10_->type;
	if (_data_->_tmp11_ == XPATH_NODESET) {
		_data_->_tmp12_ = _data_->xpo;
		_data_->_tmp13_ = _data_->_tmp12_->nodesetval;
		_data_->_tmp14_ = _data_->track;
		_data_->_tmp9_ = xmlXPathNodeSetGetLength (_data_->_tmp13_) >= _data_->_tmp14_;
	} else {
		_data_->_tmp9_ = FALSE;
	}
	if (!_data_->_tmp9_) {
		_data_->_tmp15_ = _data_->xpo;
		xmlXPathFreeObject (_data_->_tmp15_);
		_data_->_tmp16_ = _data_->parts;
		_data_->_tmp16__length1 = _data_->parts_length1;
		_data_->_tmp17_ = _data_->_tmp16_[2];
		g_warning ("rygel-media-export-dvd-container.vala:91: No track %s in DVD", _data_->_tmp17_);
		_data_->result = NULL;
		_xmlXPathFreeContext0 (_data_->context);
		_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
		g_task_return_pointer (_data_->_async_result, _data_, NULL);
		if (_data_->_state_ != 0) {
			while (_data_->_task_complete_ != TRUE) {
				g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
			}
		}
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp18_ = _data_->parts;
	_data_->_tmp18__length1 = _data_->parts_length1;
	_data_->_tmp19_ = _data_->_tmp18_[2];
	_data_->_tmp20_ = _data_->xpo;
	_data_->_tmp21_ = _data_->_tmp20_->nodesetval;
	_data_->_tmp22_ = _data_->track;
	_data_->_tmp23_ = xmlXPathNodeSetItem (_data_->_tmp21_, _data_->_tmp22_);
	_data_->_tmp24_ = rygel_media_export_dvd_container_get_item_for_xml (_data_->self, atoi (_data_->_tmp19_), _data_->_tmp23_);
	_data_->object = _data_->_tmp24_;
	_data_->_tmp25_ = _data_->xpo;
	xmlXPathFreeObject (_data_->_tmp25_);
	_data_->result = (RygelMediaObject*) _data_->object;
	_xmlXPathFreeContext0 (_data_->context);
	_data_->parts = (_vala_array_free (_data_->parts, _data_->parts_length1, (GDestroyNotify) g_free), NULL);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static gchar*
rygel_media_export_dvd_container_get_cache_path (RygelMediaExportDVDContainer* self,
                                                 const gchar* image_path)
{
	gchar* result = NULL;
	const gchar* user_cache = NULL;
	const gchar* _tmp0_;
	gchar* id = NULL;
	gchar* _tmp1_;
	gchar* cache_folder = NULL;
	gchar* _tmp2_;
	gchar* _tmp3_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (image_path != NULL, NULL);
	_tmp0_ = g_get_user_cache_dir ();
	user_cache = _tmp0_;
	_tmp1_ = g_compute_checksum_for_string (G_CHECKSUM_MD5, image_path, (gsize) -1);
	id = _tmp1_;
	_tmp2_ = g_build_filename (user_cache, "rygel", "dvd-content", NULL);
	cache_folder = _tmp2_;
	g_mkdir_with_parents (cache_folder, 0700);
	_tmp3_ = g_build_filename (cache_folder, id, NULL);
	result = _tmp3_;
	_g_free0 (cache_folder);
	_g_free0 (id);
	return result;
}


static void
rygel_media_export_dvd_container_commit_data_free (gpointer _data)
{
	RygelMediaExportDvdContainerCommitData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediaExportDvdContainerCommitData, _data_);
}


static void
rygel_media_export_dvd_container_commit_async_ready_wrapper (GObject *source_object,
                                                             GAsyncResult *res,
                                                             void *user_data)
{
	RygelMediaExportDvdContainerCommitData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


void
rygel_media_export_dvd_container_commit (RygelMediaExportDVDContainer* self,
                                         GAsyncReadyCallback _callback_,
                                         gpointer _user_data_)
{
	RygelMediaExportDvdContainerCommitData* _data_;
	RygelMediaExportDVDContainer* _tmp0_;
	_data_ = g_slice_new0 (RygelMediaExportDvdContainerCommitData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, rygel_media_export_dvd_container_commit_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_dvd_container_commit_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_media_export_dvd_container_commit_co (_data_);
}


void
rygel_media_export_dvd_container_commit_finish (RygelMediaExportDVDContainer* self,
                                                GAsyncResult* _res_,
                                                GError** error)
{
	RygelMediaExportDvdContainerCommitData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}


static void
rygel_media_export_dvd_container_commit_ready (GObject* source_object,
                                               GAsyncResult* _res_,
                                               gpointer _user_data_)
{
	RygelMediaExportDvdContainerCommitData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	_data_->_task_complete_ = TRUE;
	rygel_media_export_dvd_container_commit_co (_data_);
}


static gboolean
rygel_media_export_dvd_container_commit_co (RygelMediaExportDvdContainerCommitData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_state_ = 1;
	rygel_media_export_updatable_object_commit_custom ((RygelMediaExportUpdatableObject*) _data_->self, TRUE, rygel_media_export_dvd_container_commit_ready, _data_);
	return FALSE;
	_state_1:
	rygel_media_export_updatable_object_commit_custom_finish ((RygelMediaExportUpdatableObject*) _data_->self, _data_->_res_, &_data_->_inner_error_);
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void
rygel_media_export_dvd_container_real_commit_custom_data_free (gpointer _data)
{
	RygelMediaExportDvdContainerCommitCustomData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelMediaExportDvdContainerCommitCustomData, _data_);
}


static void
rygel_media_export_dvd_container_real_commit_custom_async_ready_wrapper (GObject *source_object,
                                                                         GAsyncResult *res,
                                                                         void *user_data)
{
	RygelMediaExportDvdContainerCommitCustomData* _task_data_;
	_task_data_ = g_task_get_task_data (G_TASK (res));
	if (_task_data_->_callback_ != NULL) {
		_task_data_->_callback_ (source_object, res, user_data);
	}
	_task_data_->_task_complete_ = TRUE;
}


static void
rygel_media_export_dvd_container_real_commit_custom (RygelMediaExportUpdatableObject* base,
                                                     gboolean override_guarded,
                                                     GAsyncReadyCallback _callback_,
                                                     gpointer _user_data_)
{
	RygelMediaExportDVDContainer * self;
	RygelMediaExportDvdContainerCommitCustomData* _data_;
	RygelMediaExportDVDContainer* _tmp0_;
	self = (RygelMediaExportDVDContainer*) base;
	_data_ = g_slice_new0 (RygelMediaExportDvdContainerCommitCustomData);
	_data_->_callback_ = _callback_;
	_data_->_async_result = g_task_new (G_OBJECT (self), NULL, rygel_media_export_dvd_container_real_commit_custom_async_ready_wrapper, _user_data_);
	if (_callback_ == NULL) {
		_data_->_task_complete_ = TRUE;
	}
	g_task_set_task_data (_data_->_async_result, _data_, rygel_media_export_dvd_container_real_commit_custom_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_data_->override_guarded = override_guarded;
	rygel_media_export_dvd_container_real_commit_custom_co (_data_);
}


static void
rygel_media_export_dvd_container_real_commit_custom_finish (RygelMediaExportUpdatableObject* base,
                                                            GAsyncResult* _res_,
                                                            GError** error)
{
	RygelMediaExportDvdContainerCommitCustomData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return;
	}
}


static gboolean
rygel_media_export_dvd_container_real_commit_custom_co (RygelMediaExportDvdContainerCommitCustomData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = rygel_media_export_media_cache_get_default ();
	_data_->_tmp1_ = _data_->_tmp0_;
	rygel_media_export_media_cache_save_container (_data_->_tmp1_, (RygelMediaContainer*) _data_->self, &_data_->_inner_error_);
	_g_object_unref0 (_data_->_tmp1_);
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (_data_->_task_complete_ != TRUE) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}


static void
_vala_array_add1 (gchar** * array,
                  int* length,
                  int* size,
                  gchar* value)
{
	if ((*length) == (*size)) {
		*size = (*size) ? (2 * (*size)) : 4;
		*array = g_renew (gchar*, *array, (*size) + 1);
	}
	(*array)[(*length)++] = value;
	(*array)[*length] = NULL;
}


static gchar*
_vala_g_strjoinv (const gchar* separator,
                  gchar** str_array,
                  int str_array_length1)
{
	gchar* result = NULL;
	gboolean _tmp0_ = FALSE;
	if (separator == NULL) {
		separator = "";
	}
	if (str_array != NULL) {
		gboolean _tmp1_ = FALSE;
		if (str_array_length1 > 0) {
			_tmp1_ = TRUE;
		} else {
			gboolean _tmp2_ = FALSE;
			if (str_array_length1 == -1) {
				const gchar* _tmp3_;
				_tmp3_ = str_array[0];
				_tmp2_ = _tmp3_ != NULL;
			} else {
				_tmp2_ = FALSE;
			}
			_tmp1_ = _tmp2_;
		}
		_tmp0_ = _tmp1_;
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		gint i = 0;
		gsize len = 0UL;
		gint _tmp20_;
		gint _tmp22_;
		gint _tmp23_;
		gsize _tmp24_;
		gint _tmp25_;
		gint _tmp26_;
		gint _tmp27_;
		const gchar* res = NULL;
		gsize _tmp28_;
		void* _tmp29_;
		void* ptr = NULL;
		const gchar* _tmp30_;
		const gchar* _tmp31_;
		void* _tmp32_;
		const gchar* _tmp45_;
		len = (gsize) 1;
		{
			gboolean _tmp4_ = FALSE;
			i = 0;
			_tmp4_ = TRUE;
			while (TRUE) {
				gboolean _tmp6_ = FALSE;
				gboolean _tmp7_ = FALSE;
				gint _tmp12_ = 0;
				gint _tmp13_;
				const gchar* _tmp14_;
				gsize _tmp19_;
				if (!_tmp4_) {
					gint _tmp5_;
					_tmp5_ = i;
					i = _tmp5_ + 1;
				}
				_tmp4_ = FALSE;
				if (str_array_length1 != -1) {
					gint _tmp8_;
					_tmp8_ = i;
					_tmp7_ = _tmp8_ < str_array_length1;
				} else {
					_tmp7_ = FALSE;
				}
				if (_tmp7_) {
					_tmp6_ = TRUE;
				} else {
					gboolean _tmp9_ = FALSE;
					if (str_array_length1 == -1) {
						gint _tmp10_;
						const gchar* _tmp11_;
						_tmp10_ = i;
						_tmp11_ = str_array[_tmp10_];
						_tmp9_ = _tmp11_ != NULL;
					} else {
						_tmp9_ = FALSE;
					}
					_tmp6_ = _tmp9_;
				}
				if (!_tmp6_) {
					break;
				}
				_tmp13_ = i;
				_tmp14_ = str_array[_tmp13_];
				if (_tmp14_ != NULL) {
					gint _tmp15_;
					const gchar* _tmp16_;
					gint _tmp17_;
					gint _tmp18_;
					_tmp15_ = i;
					_tmp16_ = str_array[_tmp15_];
					_tmp17_ = strlen ((const gchar*) _tmp16_);
					_tmp18_ = _tmp17_;
					_tmp12_ = _tmp18_;
				} else {
					_tmp12_ = 0;
				}
				_tmp19_ = len;
				len = _tmp19_ + _tmp12_;
			}
		}
		_tmp20_ = i;
		if (_tmp20_ == 0) {
			gchar* _tmp21_;
			_tmp21_ = g_strdup ("");
			result = _tmp21_;
			return result;
		}
		_tmp22_ = i;
		str_array_length1 = _tmp22_;
		_tmp23_ = str_array_length1;
		_tmp24_ = len;
		_tmp25_ = strlen ((const gchar*) separator);
		_tmp26_ = _tmp25_;
		_tmp27_ = i;
		len = _tmp24_ + (_tmp26_ * (_tmp27_ - 1));
		_tmp28_ = len;
		_tmp29_ = g_malloc (_tmp28_);
		res = _tmp29_;
		_tmp30_ = res;
		_tmp31_ = str_array[0];
		_tmp32_ = g_stpcpy ((void*) _tmp30_, (const gchar*) _tmp31_);
		ptr = _tmp32_;
		{
			gboolean _tmp33_ = FALSE;
			i = 1;
			_tmp33_ = TRUE;
			while (TRUE) {
				gint _tmp35_;
				void* _tmp36_;
				void* _tmp37_;
				const gchar* _tmp38_ = NULL;
				gint _tmp39_;
				const gchar* _tmp40_;
				void* _tmp43_;
				void* _tmp44_;
				if (!_tmp33_) {
					gint _tmp34_;
					_tmp34_ = i;
					i = _tmp34_ + 1;
				}
				_tmp33_ = FALSE;
				_tmp35_ = i;
				if (!(_tmp35_ < str_array_length1)) {
					break;
				}
				_tmp36_ = ptr;
				_tmp37_ = g_stpcpy (_tmp36_, (const gchar*) separator);
				ptr = _tmp37_;
				_tmp39_ = i;
				_tmp40_ = str_array[_tmp39_];
				if (_tmp40_ != NULL) {
					gint _tmp41_;
					const gchar* _tmp42_;
					_tmp41_ = i;
					_tmp42_ = str_array[_tmp41_];
					_tmp38_ = (const gchar*) _tmp42_;
				} else {
					_tmp38_ = "";
				}
				_tmp43_ = ptr;
				_tmp44_ = g_stpcpy (_tmp43_, _tmp38_);
				ptr = _tmp44_;
			}
		}
		_tmp45_ = res;
		res = NULL;
		result = (gchar*) _tmp45_;
		return result;
	} else {
		gchar* _tmp46_;
		_tmp46_ = g_strdup ("");
		result = _tmp46_;
		return result;
	}
}


static gchar*
rygel_media_export_dvd_container_get_track_id (RygelMediaExportDVDContainer* self,
                                               gint track)
{
	gchar* result = NULL;
	gchar** parts = NULL;
	const gchar* _tmp0_;
	const gchar* _tmp1_;
	gchar** _tmp2_;
	gchar** _tmp3_;
	gint parts_length1;
	gint _parts_size_;
	gchar** _tmp4_;
	gint _tmp4__length1;
	gchar* _tmp5_;
	gchar* _tmp6_;
	gchar** _tmp7_;
	gint _tmp7__length1;
	gchar* _tmp8_;
	gchar** _tmp9_;
	gint _tmp9__length1;
	gchar* _tmp10_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = rygel_media_object_get_id ((RygelMediaObject*) self);
	_tmp1_ = _tmp0_;
	_tmp3_ = _tmp2_ = g_strsplit (_tmp1_, ":", 0);
	parts = _tmp3_;
	parts_length1 = _vala_array_length (_tmp2_);
	_parts_size_ = parts_length1;
	_tmp4_ = parts;
	_tmp4__length1 = parts_length1;
	_tmp5_ = g_strdup ("dvd-track");
	_g_free0 (_tmp4_[0]);
	_tmp4_[0] = _tmp5_;
	_tmp6_ = _tmp4_[0];
	_tmp7_ = parts;
	_tmp7__length1 = parts_length1;
	_tmp8_ = g_strdup_printf ("%i", track);
	_vala_array_add1 (&parts, &parts_length1, &_parts_size_, _tmp8_);
	_tmp9_ = parts;
	_tmp9__length1 = parts_length1;
	_tmp10_ = _vala_g_strjoinv (":", _tmp9_, _tmp9__length1);
	result = _tmp10_;
	parts = (_vala_array_free (parts, parts_length1, (GDestroyNotify) g_free), NULL);
	return result;
}


static RygelMediaFileItem*
rygel_media_export_dvd_container_get_item_for_xml (RygelMediaExportDVDContainer* self,
                                                   gint track,
                                                   xmlNode* node)
{
	RygelMediaFileItem* result = NULL;
	RygelMediaExportDVDTrack* item = NULL;
	gchar* _tmp0_;
	gchar* _tmp1_;
	gchar* _tmp2_;
	gchar* _tmp3_;
	RygelMediaExportDVDTrack* _tmp4_;
	RygelMediaExportDVDTrack* _tmp5_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = rygel_media_export_dvd_container_get_track_id (self, track);
	_tmp1_ = _tmp0_;
	_tmp2_ = g_strdup_printf (_ ("Title %d"), track + 1);
	_tmp3_ = _tmp2_;
	_tmp4_ = rygel_media_export_dvd_track_new (_tmp1_, (RygelMediaContainer*) self, _tmp3_, track, node);
	_tmp5_ = _tmp4_;
	_g_free0 (_tmp3_);
	_g_free0 (_tmp1_);
	item = _tmp5_;
	rygel_media_object_set_parent_ref ((RygelMediaObject*) item, (RygelMediaContainer*) self);
	result = (RygelMediaFileItem*) item;
	return result;
}


const gchar*
rygel_media_export_dvd_container_get_path (RygelMediaExportDVDContainer* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_path;
	result = _tmp0_;
	return result;
}


void
rygel_media_export_dvd_container_set_path (RygelMediaExportDVDContainer* self,
                                           const gchar* value)
{
	g_return_if_fail (self != NULL);
	if (g_strcmp0 (value, rygel_media_export_dvd_container_get_path (self)) != 0) {
		gchar* _tmp0_;
		_tmp0_ = g_strdup (value);
		_g_free0 (self->priv->_path);
		self->priv->_path = _tmp0_;
		g_object_notify_by_pspec ((GObject *) self, rygel_media_export_dvd_container_properties[RYGEL_MEDIA_EXPORT_DVD_CONTAINER_PATH_PROPERTY]);
	}
}


static void
rygel_media_export_dvd_container_class_init (RygelMediaExportDVDContainerClass * klass)
{
	rygel_media_export_dvd_container_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RygelMediaExportDVDContainer_private_offset);
	((GObjectClass *) klass)->constructed = (void (*) (GObject *)) rygel_media_export_dvd_container_real_constructed;
	((RygelMediaContainerClass *) klass)->find_object = (void (*) (RygelMediaContainer *, const gchar*, GCancellable*, GAsyncReadyCallback, gpointer)) rygel_media_export_dvd_container_real_find_object;
	((RygelMediaContainerClass *) klass)->find_object_finish = (RygelMediaObject* (*) (RygelMediaContainer *, GAsyncResult*, GError**)) rygel_media_export_dvd_container_real_find_object_finish;
	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_media_export_dvd_container_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_media_export_dvd_container_set_property;
	G_OBJECT_CLASS (klass)->finalize = rygel_media_export_dvd_container_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_MEDIA_EXPORT_DVD_CONTAINER_PATH_PROPERTY, rygel_media_export_dvd_container_properties[RYGEL_MEDIA_EXPORT_DVD_CONTAINER_PATH_PROPERTY] = g_param_spec_string ("path", "path", "path", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE | G_PARAM_CONSTRUCT));
}


static void
rygel_media_export_dvd_container_rygel_media_export_updatable_object_interface_init (RygelMediaExportUpdatableObjectIface * iface)
{
	rygel_media_export_dvd_container_rygel_media_export_updatable_object_parent_iface = g_type_interface_peek_parent (iface);
	iface->commit_custom = (void (*) (RygelMediaExportUpdatableObject *, gboolean, GAsyncReadyCallback, gpointer)) rygel_media_export_dvd_container_real_commit_custom;
	iface->commit_custom_finish = (void (*) (RygelMediaExportUpdatableObject *, GAsyncResult*, GError**)) rygel_media_export_dvd_container_real_commit_custom_finish;
}


static void
rygel_media_export_dvd_container_instance_init (RygelMediaExportDVDContainer * self)
{
	self->priv = rygel_media_export_dvd_container_get_instance_private (self);
}


static void
rygel_media_export_dvd_container_finalize (GObject * obj)
{
	RygelMediaExportDVDContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER, RygelMediaExportDVDContainer);
	_g_free0 (self->priv->_path);
	_g_object_unref0 (self->priv->doc);
	G_OBJECT_CLASS (rygel_media_export_dvd_container_parent_class)->finalize (obj);
}


GType
rygel_media_export_dvd_container_get_type (void)
{
	static volatile gsize rygel_media_export_dvd_container_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_media_export_dvd_container_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelMediaExportDVDContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_media_export_dvd_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelMediaExportDVDContainer), 0, (GInstanceInitFunc) rygel_media_export_dvd_container_instance_init, NULL };
		static const GInterfaceInfo rygel_media_export_updatable_object_info = { (GInterfaceInitFunc) rygel_media_export_dvd_container_rygel_media_export_updatable_object_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType rygel_media_export_dvd_container_type_id;
		rygel_media_export_dvd_container_type_id = g_type_register_static (RYGEL_TYPE_SIMPLE_CONTAINER, "RygelMediaExportDVDContainer", &g_define_type_info, 0);
		g_type_add_interface_static (rygel_media_export_dvd_container_type_id, RYGEL_MEDIA_EXPORT_TYPE_UPDATABLE_OBJECT, &rygel_media_export_updatable_object_info);
		RygelMediaExportDVDContainer_private_offset = g_type_add_instance_private (rygel_media_export_dvd_container_type_id, sizeof (RygelMediaExportDVDContainerPrivate));
		g_once_init_leave (&rygel_media_export_dvd_container_type_id__volatile, rygel_media_export_dvd_container_type_id);
	}
	return rygel_media_export_dvd_container_type_id__volatile;
}


static void
_vala_rygel_media_export_dvd_container_get_property (GObject * object,
                                                     guint property_id,
                                                     GValue * value,
                                                     GParamSpec * pspec)
{
	RygelMediaExportDVDContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER, RygelMediaExportDVDContainer);
	switch (property_id) {
		case RYGEL_MEDIA_EXPORT_DVD_CONTAINER_PATH_PROPERTY:
		g_value_set_string (value, rygel_media_export_dvd_container_get_path (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void
_vala_rygel_media_export_dvd_container_set_property (GObject * object,
                                                     guint property_id,
                                                     const GValue * value,
                                                     GParamSpec * pspec)
{
	RygelMediaExportDVDContainer * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_MEDIA_EXPORT_TYPE_DVD_CONTAINER, RygelMediaExportDVDContainer);
	switch (property_id) {
		case RYGEL_MEDIA_EXPORT_DVD_CONTAINER_PATH_PROPERTY:
		rygel_media_export_dvd_container_set_path (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


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


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


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



