/* rygel-object-creator.c generated by valac 0.25.1.16-16e7a, the Vala compiler
 * generated from rygel-object-creator.vala, do not modify */

/*
 * Copyright (C) 2010-2011 Nokia Corporation.
 * Copyright (C) 2012 Intel Corporation.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *         Jens Georg <jensg@openismus.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 <gio/gio.h>
#include <stdlib.h>
#include <string.h>
#include <gee.h>
#include <libgupnp-av/gupnp-av.h>
#include <glib/gi18n-lib.h>
#include <libsoup/soup.h>
#include <stdio.h>
#include <uuid/uuid.h>


#define RYGEL_TYPE_MEDIA_OBJECT (rygel_media_object_get_type ())
#define RYGEL_MEDIA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_OBJECT, RygelMediaObject))
#define RYGEL_MEDIA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_OBJECT, RygelMediaObjectClass))
#define RYGEL_IS_MEDIA_OBJECT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_OBJECT))
#define RYGEL_IS_MEDIA_OBJECT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_OBJECT))
#define RYGEL_MEDIA_OBJECT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_OBJECT, RygelMediaObjectClass))

typedef struct _RygelMediaObject RygelMediaObject;
typedef struct _RygelMediaObjectClass RygelMediaObjectClass;
typedef struct _RygelMediaObjectPrivate RygelMediaObjectPrivate;

#define RYGEL_TYPE_MEDIA_OBJECTS (rygel_media_objects_get_type ())
#define RYGEL_MEDIA_OBJECTS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_OBJECTS, RygelMediaObjects))
#define RYGEL_MEDIA_OBJECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_OBJECTS, RygelMediaObjectsClass))
#define RYGEL_IS_MEDIA_OBJECTS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_OBJECTS))
#define RYGEL_IS_MEDIA_OBJECTS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_OBJECTS))
#define RYGEL_MEDIA_OBJECTS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_OBJECTS, RygelMediaObjectsClass))

typedef struct _RygelMediaObjects RygelMediaObjects;
typedef struct _RygelMediaObjectsClass RygelMediaObjectsClass;

#define RYGEL_TYPE_MEDIA_CONTAINER (rygel_media_container_get_type ())
#define RYGEL_MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_CONTAINER, RygelMediaContainer))
#define RYGEL_MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_CONTAINER, RygelMediaContainerClass))
#define RYGEL_IS_MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_CONTAINER))
#define RYGEL_IS_MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_CONTAINER))
#define RYGEL_MEDIA_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_CONTAINER, RygelMediaContainerClass))

typedef struct _RygelMediaContainer RygelMediaContainer;
typedef struct _RygelMediaContainerClass RygelMediaContainerClass;
typedef struct _RygelMediaContainerPrivate RygelMediaContainerPrivate;

#define RYGEL_TYPE_BASE_MEDIA_CONTAINER (rygel_base_media_container_get_type ())
#define RYGEL_BASE_MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_BASE_MEDIA_CONTAINER, RygelBaseMediaContainer))
#define RYGEL_BASE_MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_BASE_MEDIA_CONTAINER, RygelBaseMediaContainerClass))
#define RYGEL_IS_BASE_MEDIA_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_BASE_MEDIA_CONTAINER))
#define RYGEL_IS_BASE_MEDIA_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_BASE_MEDIA_CONTAINER))
#define RYGEL_BASE_MEDIA_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_BASE_MEDIA_CONTAINER, RygelBaseMediaContainerClass))

typedef struct _RygelBaseMediaContainer RygelBaseMediaContainer;
typedef struct _RygelBaseMediaContainerClass RygelBaseMediaContainerClass;
typedef struct _RygelBaseMediaContainerPrivate RygelBaseMediaContainerPrivate;
#define _g_free0(var) (var = (g_free (var), NULL))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
typedef struct _RygelBaseMediaContainerGetChildrenData RygelBaseMediaContainerGetChildrenData;
typedef struct _RygelBaseMediaContainerFindObjectData RygelBaseMediaContainerFindObjectData;

#define RYGEL_TYPE_STATE_MACHINE (rygel_state_machine_get_type ())
#define RYGEL_STATE_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_STATE_MACHINE, RygelStateMachine))
#define RYGEL_IS_STATE_MACHINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_STATE_MACHINE))
#define RYGEL_STATE_MACHINE_GET_INTERFACE(obj) (G_TYPE_INSTANCE_GET_INTERFACE ((obj), RYGEL_TYPE_STATE_MACHINE, RygelStateMachineIface))

typedef struct _RygelStateMachine RygelStateMachine;
typedef struct _RygelStateMachineIface RygelStateMachineIface;

#define RYGEL_TYPE_OBJECT_CREATOR (rygel_object_creator_get_type ())
#define RYGEL_OBJECT_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreator))
#define RYGEL_OBJECT_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreatorClass))
#define RYGEL_IS_OBJECT_CREATOR(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_OBJECT_CREATOR))
#define RYGEL_IS_OBJECT_CREATOR_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_OBJECT_CREATOR))
#define RYGEL_OBJECT_CREATOR_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreatorClass))

typedef struct _RygelObjectCreator RygelObjectCreator;
typedef struct _RygelObjectCreatorClass RygelObjectCreatorClass;
typedef struct _RygelObjectCreatorPrivate RygelObjectCreatorPrivate;

#define RYGEL_TYPE_CONTENT_DIRECTORY (rygel_content_directory_get_type ())
#define RYGEL_CONTENT_DIRECTORY(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectory))
#define RYGEL_CONTENT_DIRECTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectoryClass))
#define RYGEL_IS_CONTENT_DIRECTORY(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_CONTENT_DIRECTORY))
#define RYGEL_IS_CONTENT_DIRECTORY_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_CONTENT_DIRECTORY))
#define RYGEL_CONTENT_DIRECTORY_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_CONTENT_DIRECTORY, RygelContentDirectoryClass))

typedef struct _RygelContentDirectory RygelContentDirectory;
typedef struct _RygelContentDirectoryClass RygelContentDirectoryClass;

#define RYGEL_TYPE_SERVICE_ACTION (rygel_service_action_get_type ())
#define RYGEL_SERVICE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SERVICE_ACTION, RygelServiceAction))
#define RYGEL_SERVICE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SERVICE_ACTION, RygelServiceActionClass))
#define RYGEL_IS_SERVICE_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SERVICE_ACTION))
#define RYGEL_IS_SERVICE_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SERVICE_ACTION))
#define RYGEL_SERVICE_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SERVICE_ACTION, RygelServiceActionClass))

typedef struct _RygelServiceAction RygelServiceAction;
typedef struct _RygelServiceActionClass RygelServiceActionClass;

#define RYGEL_TYPE_SERIALIZER (rygel_serializer_get_type ())
#define RYGEL_SERIALIZER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SERIALIZER, RygelSerializer))
#define RYGEL_SERIALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SERIALIZER, RygelSerializerClass))
#define RYGEL_IS_SERIALIZER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SERIALIZER))
#define RYGEL_IS_SERIALIZER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SERIALIZER))
#define RYGEL_SERIALIZER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SERIALIZER, RygelSerializerClass))

typedef struct _RygelSerializer RygelSerializer;
typedef struct _RygelSerializerClass RygelSerializerClass;
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
typedef struct _RygelContentDirectoryPrivate RygelContentDirectoryPrivate;

#define RYGEL_TYPE_HTTP_SERVER (rygel_http_server_get_type ())
#define RYGEL_HTTP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_HTTP_SERVER, RygelHTTPServer))
#define RYGEL_HTTP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_HTTP_SERVER, RygelHTTPServerClass))
#define RYGEL_IS_HTTP_SERVER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_HTTP_SERVER))
#define RYGEL_IS_HTTP_SERVER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_HTTP_SERVER))
#define RYGEL_HTTP_SERVER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_HTTP_SERVER, RygelHTTPServerClass))

typedef struct _RygelHTTPServer RygelHTTPServer;
typedef struct _RygelHTTPServerClass RygelHTTPServerClass;

#define RYGEL_TYPE_ROOT_DEVICE (rygel_root_device_get_type ())
#define RYGEL_ROOT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_ROOT_DEVICE, RygelRootDevice))
#define RYGEL_ROOT_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_ROOT_DEVICE, RygelRootDeviceClass))
#define RYGEL_IS_ROOT_DEVICE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_ROOT_DEVICE))
#define RYGEL_IS_ROOT_DEVICE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_ROOT_DEVICE))
#define RYGEL_ROOT_DEVICE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_ROOT_DEVICE, RygelRootDeviceClass))

typedef struct _RygelRootDevice RygelRootDevice;
typedef struct _RygelRootDeviceClass RygelRootDeviceClass;

#define RYGEL_TYPE_SERIALIZER_TYPE (rygel_serializer_type_get_type ())
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define RYGEL_TYPE_WRITABLE_CONTAINER (rygel_writable_container_get_type ())
#define RYGEL_WRITABLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_WRITABLE_CONTAINER, RygelWritableContainer))
#define RYGEL_WRITABLE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_WRITABLE_CONTAINER, RygelWritableContainerClass))
#define RYGEL_IS_WRITABLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_WRITABLE_CONTAINER))
#define RYGEL_IS_WRITABLE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_WRITABLE_CONTAINER))
#define RYGEL_WRITABLE_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_WRITABLE_CONTAINER, RygelWritableContainerClass))

typedef struct _RygelWritableContainer RygelWritableContainer;
typedef struct _RygelWritableContainerClass RygelWritableContainerClass;

#define RYGEL_TYPE_MEDIA_ITEM (rygel_media_item_get_type ())
#define RYGEL_MEDIA_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_ITEM, RygelMediaItem))
#define RYGEL_MEDIA_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_ITEM, RygelMediaItemClass))
#define RYGEL_IS_MEDIA_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_ITEM))
#define RYGEL_IS_MEDIA_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_ITEM))
#define RYGEL_MEDIA_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_ITEM, RygelMediaItemClass))

typedef struct _RygelMediaItem RygelMediaItem;
typedef struct _RygelMediaItemClass RygelMediaItemClass;
typedef struct _RygelMediaItemPrivate RygelMediaItemPrivate;

#define RYGEL_TYPE_OBJECT_REMOVAL_QUEUE (rygel_object_removal_queue_get_type ())
#define RYGEL_OBJECT_REMOVAL_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE, RygelObjectRemovalQueue))
#define RYGEL_OBJECT_REMOVAL_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE, RygelObjectRemovalQueueClass))
#define RYGEL_IS_OBJECT_REMOVAL_QUEUE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE))
#define RYGEL_IS_OBJECT_REMOVAL_QUEUE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE))
#define RYGEL_OBJECT_REMOVAL_QUEUE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_OBJECT_REMOVAL_QUEUE, RygelObjectRemovalQueueClass))

typedef struct _RygelObjectRemovalQueue RygelObjectRemovalQueue;
typedef struct _RygelObjectRemovalQueueClass RygelObjectRemovalQueueClass;
typedef struct _RygelObjectCreatorRunData RygelObjectCreatorRunData;
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
#define _rygel_search_expression_unref0(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))

#define RYGEL_TYPE_SEARCH_EXPRESSION (rygel_search_expression_get_type ())
#define RYGEL_SEARCH_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SEARCH_EXPRESSION, RygelSearchExpression))
#define RYGEL_SEARCH_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SEARCH_EXPRESSION, RygelSearchExpressionClass))
#define RYGEL_IS_SEARCH_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SEARCH_EXPRESSION))
#define RYGEL_IS_SEARCH_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SEARCH_EXPRESSION))
#define RYGEL_SEARCH_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SEARCH_EXPRESSION, RygelSearchExpressionClass))

typedef struct _RygelSearchExpression RygelSearchExpression;
typedef struct _RygelSearchExpressionClass RygelSearchExpressionClass;
#define __g_list_free__g_free0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_free0_ (var), NULL)))

#define RYGEL_TYPE_SEARCH_CRITERIA_PARSER (rygel_search_criteria_parser_get_type ())
#define RYGEL_SEARCH_CRITERIA_PARSER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SEARCH_CRITERIA_PARSER, RygelSearchCriteriaParser))
#define RYGEL_SEARCH_CRITERIA_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SEARCH_CRITERIA_PARSER, RygelSearchCriteriaParserClass))
#define RYGEL_IS_SEARCH_CRITERIA_PARSER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SEARCH_CRITERIA_PARSER))
#define RYGEL_IS_SEARCH_CRITERIA_PARSER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SEARCH_CRITERIA_PARSER))
#define RYGEL_SEARCH_CRITERIA_PARSER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SEARCH_CRITERIA_PARSER, RygelSearchCriteriaParserClass))

typedef struct _RygelSearchCriteriaParser RygelSearchCriteriaParser;
typedef struct _RygelSearchCriteriaParserClass RygelSearchCriteriaParserClass;

#define RYGEL_TYPE_LOGICAL_EXPRESSION (rygel_logical_expression_get_type ())
#define RYGEL_LOGICAL_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_LOGICAL_EXPRESSION, RygelLogicalExpression))
#define RYGEL_LOGICAL_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_LOGICAL_EXPRESSION, RygelLogicalExpressionClass))
#define RYGEL_IS_LOGICAL_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_LOGICAL_EXPRESSION))
#define RYGEL_IS_LOGICAL_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_LOGICAL_EXPRESSION))
#define RYGEL_LOGICAL_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_LOGICAL_EXPRESSION, RygelLogicalExpressionClass))

typedef struct _RygelLogicalExpression RygelLogicalExpression;
typedef struct _RygelLogicalExpressionClass RygelLogicalExpressionClass;

#define RYGEL_TYPE_LOGICAL_OPERATOR (rygel_logical_operator_get_type ())
typedef struct _RygelSearchExpressionPrivate RygelSearchExpressionPrivate;
typedef struct _RygelSearchCriteriaParserPrivate RygelSearchCriteriaParserPrivate;
#define _g_string_free0(var) ((var == NULL) ? NULL : (var = (g_string_free (var, TRUE), NULL)))
typedef struct _RygelObjectCreatorBuildCreateClassExpressionData RygelObjectCreatorBuildCreateClassExpressionData;

#define RYGEL_TYPE_SEARCHABLE_CONTAINER (rygel_searchable_container_get_type ())
#define RYGEL_SEARCHABLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SEARCHABLE_CONTAINER, RygelSearchableContainer))
#define RYGEL_SEARCHABLE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SEARCHABLE_CONTAINER, RygelSearchableContainerClass))
#define RYGEL_IS_SEARCHABLE_CONTAINER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SEARCHABLE_CONTAINER))
#define RYGEL_IS_SEARCHABLE_CONTAINER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SEARCHABLE_CONTAINER))
#define RYGEL_SEARCHABLE_CONTAINER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SEARCHABLE_CONTAINER, RygelSearchableContainerClass))

typedef struct _RygelSearchableContainer RygelSearchableContainer;
typedef struct _RygelSearchableContainerClass RygelSearchableContainerClass;

#define RYGEL_TYPE_RELATIONAL_EXPRESSION (rygel_relational_expression_get_type ())
#define RYGEL_RELATIONAL_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_RELATIONAL_EXPRESSION, RygelRelationalExpression))
#define RYGEL_RELATIONAL_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_RELATIONAL_EXPRESSION, RygelRelationalExpressionClass))
#define RYGEL_IS_RELATIONAL_EXPRESSION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_RELATIONAL_EXPRESSION))
#define RYGEL_IS_RELATIONAL_EXPRESSION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_RELATIONAL_EXPRESSION))
#define RYGEL_RELATIONAL_EXPRESSION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_RELATIONAL_EXPRESSION, RygelRelationalExpressionClass))

typedef struct _RygelRelationalExpression RygelRelationalExpression;
typedef struct _RygelRelationalExpressionClass RygelRelationalExpressionClass;
typedef struct _RygelObjectCreatorFindAnyContainerData RygelObjectCreatorFindAnyContainerData;
typedef struct _RygelObjectCreatorFetchContainerData RygelObjectCreatorFetchContainerData;

#define RYGEL_TYPE_IMAGE_ITEM (rygel_image_item_get_type ())
#define RYGEL_IMAGE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_IMAGE_ITEM, RygelImageItem))
#define RYGEL_IMAGE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_IMAGE_ITEM, RygelImageItemClass))
#define RYGEL_IS_IMAGE_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_IMAGE_ITEM))
#define RYGEL_IS_IMAGE_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_IMAGE_ITEM))
#define RYGEL_IMAGE_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_IMAGE_ITEM, RygelImageItemClass))

typedef struct _RygelImageItem RygelImageItem;
typedef struct _RygelImageItemClass RygelImageItemClass;

#define RYGEL_TYPE_VIDEO_ITEM (rygel_video_item_get_type ())
#define RYGEL_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_VIDEO_ITEM, RygelVideoItem))
#define RYGEL_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_VIDEO_ITEM, RygelVideoItemClass))
#define RYGEL_IS_VIDEO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_VIDEO_ITEM))
#define RYGEL_IS_VIDEO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_VIDEO_ITEM))
#define RYGEL_VIDEO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_VIDEO_ITEM, RygelVideoItemClass))

typedef struct _RygelVideoItem RygelVideoItem;
typedef struct _RygelVideoItemClass RygelVideoItemClass;
typedef struct _RygelObjectCreatorCreateObjectFromDidlData RygelObjectCreatorCreateObjectFromDidlData;
#define __vala_SoupDate_free0(var) ((var == NULL) ? NULL : (var = (_vala_SoupDate_free (var), NULL)))

#define RYGEL_TYPE_PHOTO_ITEM (rygel_photo_item_get_type ())
#define RYGEL_PHOTO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_PHOTO_ITEM, RygelPhotoItem))
#define RYGEL_PHOTO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_PHOTO_ITEM, RygelPhotoItemClass))
#define RYGEL_IS_PHOTO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_PHOTO_ITEM))
#define RYGEL_IS_PHOTO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_PHOTO_ITEM))
#define RYGEL_PHOTO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_PHOTO_ITEM, RygelPhotoItemClass))

typedef struct _RygelPhotoItem RygelPhotoItem;
typedef struct _RygelPhotoItemClass RygelPhotoItemClass;

#define RYGEL_TYPE_AUDIO_ITEM (rygel_audio_item_get_type ())
#define RYGEL_AUDIO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_AUDIO_ITEM, RygelAudioItem))
#define RYGEL_AUDIO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_AUDIO_ITEM, RygelAudioItemClass))
#define RYGEL_IS_AUDIO_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_AUDIO_ITEM))
#define RYGEL_IS_AUDIO_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_AUDIO_ITEM))
#define RYGEL_AUDIO_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_AUDIO_ITEM, RygelAudioItemClass))

typedef struct _RygelAudioItem RygelAudioItem;
typedef struct _RygelAudioItemClass RygelAudioItemClass;

#define RYGEL_TYPE_MUSIC_ITEM (rygel_music_item_get_type ())
#define RYGEL_MUSIC_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MUSIC_ITEM, RygelMusicItem))
#define RYGEL_MUSIC_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MUSIC_ITEM, RygelMusicItemClass))
#define RYGEL_IS_MUSIC_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MUSIC_ITEM))
#define RYGEL_IS_MUSIC_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MUSIC_ITEM))
#define RYGEL_MUSIC_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MUSIC_ITEM, RygelMusicItemClass))

typedef struct _RygelMusicItem RygelMusicItem;
typedef struct _RygelMusicItemClass RygelMusicItemClass;

#define RYGEL_TYPE_PLAYLIST_ITEM (rygel_playlist_item_get_type ())
#define RYGEL_PLAYLIST_ITEM(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_PLAYLIST_ITEM, RygelPlaylistItem))
#define RYGEL_PLAYLIST_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_PLAYLIST_ITEM, RygelPlaylistItemClass))
#define RYGEL_IS_PLAYLIST_ITEM(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_PLAYLIST_ITEM))
#define RYGEL_IS_PLAYLIST_ITEM_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_PLAYLIST_ITEM))
#define RYGEL_PLAYLIST_ITEM_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_PLAYLIST_ITEM, RygelPlaylistItemClass))

typedef struct _RygelPlaylistItem RygelPlaylistItem;
typedef struct _RygelPlaylistItemClass RygelPlaylistItemClass;
#define __vala_SoupURI_free0(var) ((var == NULL) ? NULL : (var = (_vala_SoupURI_free (var), NULL)))
typedef struct _RygelObjectCreatorCreateUriData RygelObjectCreatorCreateUriData;
typedef struct _Block4Data Block4Data;
typedef struct _Block5Data Block5Data;
typedef struct _RygelObjectCreatorWaitForObjectData RygelObjectCreatorWaitForObjectData;

#define RYGEL_TYPE_DLNA_PROFILE (rygel_dlna_profile_get_type ())
#define RYGEL_DLNA_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_DLNA_PROFILE, RygelDLNAProfile))
#define RYGEL_DLNA_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_DLNA_PROFILE, RygelDLNAProfileClass))
#define RYGEL_IS_DLNA_PROFILE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_DLNA_PROFILE))
#define RYGEL_IS_DLNA_PROFILE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_DLNA_PROFILE))
#define RYGEL_DLNA_PROFILE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_DLNA_PROFILE, RygelDLNAProfileClass))

typedef struct _RygelDLNAProfile RygelDLNAProfile;
typedef struct _RygelDLNAProfileClass RygelDLNAProfileClass;

#define RYGEL_TYPE_MEDIA_SERVER_PLUGIN (rygel_media_server_plugin_get_type ())
#define RYGEL_MEDIA_SERVER_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_SERVER_PLUGIN, RygelMediaServerPlugin))
#define RYGEL_MEDIA_SERVER_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_SERVER_PLUGIN, RygelMediaServerPluginClass))
#define RYGEL_IS_MEDIA_SERVER_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_SERVER_PLUGIN))
#define RYGEL_IS_MEDIA_SERVER_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_SERVER_PLUGIN))
#define RYGEL_MEDIA_SERVER_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_SERVER_PLUGIN, RygelMediaServerPluginClass))

typedef struct _RygelMediaServerPlugin RygelMediaServerPlugin;
typedef struct _RygelMediaServerPluginClass RygelMediaServerPluginClass;
typedef struct _RygelRootDevicePrivate RygelRootDevicePrivate;
typedef struct _RygelMediaServerPluginPrivate RygelMediaServerPluginPrivate;
#define _rygel_dlna_profile_unref0(var) ((var == NULL) ? NULL : (var = (rygel_dlna_profile_unref (var), NULL)))

struct _RygelMediaObject {
	GObject parent_instance;
	RygelMediaObjectPrivate * priv;
	gchar* ref_id;
	gchar* upnp_class;
	GUPnPOCMFlags ocm_flags;
	GeeArrayList* uris;
	guint object_update_id;
};

struct _RygelMediaObjectClass {
	GObjectClass parent_class;
	void (*get_children) (RygelMediaObject* self, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	RygelMediaObjects* (*get_children_finish) (RygelMediaObject* self, GAsyncResult* _res_, GError** error);
	void (*find_object) (RygelMediaObject* self, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	RygelMediaObject* (*find_object_finish) (RygelMediaObject* self, GAsyncResult* _res_, GError** error);
};

struct _RygelMediaContainer {
	RygelMediaObject parent_instance;
	RygelMediaContainerPrivate * priv;
	GeeArrayList* create_classes;
	gchar* sort_criteria;
	guint update_id;
	RygelMediaObject* found_object;
};

struct _RygelMediaContainerClass {
	RygelMediaObjectClass parent_class;
};

struct _RygelBaseMediaContainer {
	RygelMediaContainer parent_instance;
	RygelBaseMediaContainerPrivate * priv;
};

struct _RygelBaseMediaContainerClass {
	RygelMediaContainerClass parent_class;
};

struct _RygelBaseMediaContainerGetChildrenData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelBaseMediaContainer* self;
	guint offset;
	guint max_count;
	gchar* sort_criteria;
	GCancellable* cancellable;
	RygelMediaObjects* result;
};

struct _RygelBaseMediaContainerFindObjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelBaseMediaContainer* self;
	gchar* id;
	GCancellable* cancellable;
	RygelMediaObject* result;
};

struct _RygelStateMachineIface {
	GTypeInterface parent_iface;
	void (*run) (RygelStateMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
	void (*run_finish) (RygelStateMachine* self, GAsyncResult* _res_);
	GCancellable* (*get_cancellable) (RygelStateMachine* self);
	void (*set_cancellable) (RygelStateMachine* self, GCancellable* value);
};

struct _RygelObjectCreator {
	GObject parent_instance;
	RygelObjectCreatorPrivate * priv;
};

struct _RygelObjectCreatorClass {
	GObjectClass parent_class;
};

struct _RygelObjectCreatorPrivate {
	gchar* container_id;
	gchar* elements;
	GUPnPDIDLLiteObject* didl_object;
	RygelMediaObject* object;
	RygelContentDirectory* content_dir;
	RygelServiceAction* action;
	RygelSerializer* serializer;
	GUPnPDIDLLiteParser* didl_parser;
	GRegex* title_regex;
	GCancellable* _cancellable;
};

struct _RygelContentDirectory {
	GObject parent_instance;
	RygelContentDirectoryPrivate * priv;
	GCancellable* cancellable;
	RygelMediaContainer* root_container;
	RygelHTTPServer* http_server;
	RygelRootDevice* root_device;
};

struct _RygelContentDirectoryClass {
	GObjectClass parent_class;
};

typedef enum  {
	RYGEL_SERIALIZER_TYPE_GENERIC_DIDL,
	RYGEL_SERIALIZER_TYPE_DIDL_S,
	RYGEL_SERIALIZER_TYPE_M3UEXT
} RygelSerializerType;

typedef enum  {
	RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA,
	RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_OBJECT,
	RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_CONTAINER,
	RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_ARGS,
	RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_PARENT,
	RYGEL_CONTENT_DIRECTORY_ERROR_ERROR
} RygelContentDirectoryError;
#define RYGEL_CONTENT_DIRECTORY_ERROR rygel_content_directory_error_quark ()
struct _RygelMediaItem {
	RygelMediaObject parent_instance;
	RygelMediaItemPrivate * priv;
	gchar* dlna_profile;
	gchar* mime_type;
	glong size;
	gboolean place_holder;
	gchar* date;
};

struct _RygelMediaItemClass {
	RygelMediaObjectClass parent_class;
};

struct _RygelObjectCreatorRunData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelObjectCreator* self;
	RygelWritableContainer* container;
	RygelWritableContainer* _tmp0_;
	gboolean _tmp1_;
	RygelWritableContainer* _tmp2_;
	GUPnPDIDLLiteObject* _tmp3_;
	const gchar* _tmp4_;
	const gchar* _tmp5_;
	gboolean _tmp6_;
	const gchar* _tmp7_;
	GUPnPDIDLLiteObject* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	RygelWritableContainer* _tmp11_;
	const gchar* _tmp12_;
	const gchar* _tmp13_;
	GError* _tmp14_;
	gboolean _tmp15_;
	GUPnPDIDLLiteObject* _tmp16_;
	RygelWritableContainer* _tmp17_;
	gboolean _tmp18_;
	const gchar* _tmp19_;
	GError* _tmp20_;
	RygelWritableContainer* _tmp21_;
	RygelMediaObject* _tmp22_;
	RygelWritableContainer* _tmp23_;
	RygelMediaObject* _tmp24_;
	GCancellable* _tmp25_;
	GCancellable* _tmp26_;
	RygelWritableContainer* _tmp27_;
	RygelMediaObject* _tmp28_;
	GCancellable* _tmp29_;
	GCancellable* _tmp30_;
	RygelWritableContainer* _tmp31_;
	RygelMediaObject* _tmp32_;
	RygelSerializer* _tmp33_;
	RygelContentDirectory* _tmp34_;
	RygelHTTPServer* _tmp35_;
	gboolean _tmp36_;
	const gchar* _tmp37_;
	gboolean _tmp38_;
	RygelMediaObject* _tmp39_;
	RygelMediaObject* _tmp40_;
	gboolean _tmp41_;
	RygelObjectRemovalQueue* queue;
	RygelObjectRemovalQueue* _tmp42_;
	RygelObjectRemovalQueue* _tmp43_;
	RygelMediaObject* _tmp44_;
	GCancellable* _tmp45_;
	GCancellable* _tmp46_;
	GError* err;
	GError* _tmp47_;
	GError * _inner_error_;
};

typedef enum  {
	RYGEL_LOGICAL_OPERATOR_AND,
	RYGEL_LOGICAL_OPERATOR_OR
} RygelLogicalOperator;

struct _RygelSearchExpression {
	GTypeInstance parent_instance;
	volatile int ref_count;
	RygelSearchExpressionPrivate * priv;
	gpointer op;
	gpointer operand1;
	gpointer operand2;
};

struct _RygelSearchExpressionClass {
	GTypeClass parent_class;
	void (*finalize) (RygelSearchExpression *self);
	gboolean (*satisfied_by) (RygelSearchExpression* self, RygelMediaObject* media_object);
	gchar* (*to_string) (RygelSearchExpression* self);
};

struct _RygelSearchCriteriaParser {
	GObject parent_instance;
	RygelSearchCriteriaParserPrivate * priv;
	gchar* str;
	RygelSearchExpression* expression;
	GError* err;
};

struct _RygelSearchCriteriaParserClass {
	GObjectClass parent_class;
};

struct _RygelObjectCreatorBuildCreateClassExpressionData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelObjectCreator* self;
	RygelSearchExpression* expression;
	RygelSearchExpression* result;
	GUPnPDIDLLiteObject* _tmp0_;
	RygelSearchExpression* _tmp1_;
	RygelSearchExpression* _tmp2_;
	GUPnPDIDLLiteContainer* didl_container;
	GUPnPDIDLLiteObject* _tmp3_;
	GUPnPDIDLLiteContainer* _tmp4_;
	GList* create_classes;
	GUPnPDIDLLiteContainer* _tmp5_;
	GList* _tmp6_;
	GList* _tmp7_;
	RygelSearchExpression* _tmp8_;
	RygelSearchExpression* _tmp9_;
	GString* builder;
	GString* _tmp10_;
	GList* _tmp11_;
	GList* create_class_collection;
	GList* create_class_it;
	gchar* _tmp12_;
	gchar* create_class;
	GString* _tmp13_;
	const gchar* _tmp14_;
	GString* _tmp15_;
	GString* _tmp16_;
	gssize _tmp17_;
	GString* _tmp18_;
	RygelSearchCriteriaParser* parser;
	GString* _tmp19_;
	const gchar* _tmp20_;
	RygelSearchCriteriaParser* _tmp21_;
	RygelSearchCriteriaParser* _tmp22_;
	RygelLogicalExpression* rel;
	RygelLogicalExpression* _tmp23_;
	RygelLogicalExpression* _tmp24_;
	RygelSearchExpression* _tmp25_;
	RygelSearchExpression* _tmp26_;
	RygelLogicalExpression* _tmp27_;
	RygelLogicalExpression* _tmp28_;
	RygelSearchCriteriaParser* _tmp29_;
	RygelSearchExpression* _tmp30_;
	RygelSearchExpression* _tmp31_;
	GError* _error_;
	GError * _inner_error_;
};

struct _RygelObjectCreatorFindAnyContainerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelObjectCreator* self;
	RygelMediaObject* result;
	RygelSearchableContainer* root_container;
	RygelContentDirectory* _tmp0_;
	RygelMediaContainer* _tmp1_;
	RygelSearchableContainer* _tmp2_;
	RygelSearchableContainer* _tmp3_;
	gchar* upnp_class;
	GUPnPDIDLLiteObject* _tmp4_;
	const gchar* _tmp5_;
	const gchar* _tmp6_;
	gchar* _tmp7_;
	RygelRelationalExpression* expression;
	RygelRelationalExpression* _tmp8_;
	RygelRelationalExpression* _tmp9_;
	RygelRelationalExpression* _tmp10_;
	gchar* _tmp11_;
	RygelSearchExpression* search_expression;
	RygelRelationalExpression* _tmp12_;
	RygelSearchExpression* _tmp13_;
	const gchar* _tmp14_;
	RygelRelationalExpression* _tmp15_;
	const gchar* _tmp16_;
	gchar* _tmp17_;
	guint total_matches;
	RygelMediaObjects* _result_;
	RygelSearchableContainer* _tmp18_;
	RygelSearchExpression* _tmp19_;
	RygelSearchableContainer* _tmp20_;
	const gchar* _tmp21_;
	GCancellable* _tmp22_;
	GCancellable* _tmp23_;
	gint _tmp24_;
	RygelMediaObjects* _tmp25_;
	RygelMediaObjects* _tmp26_;
	gint _tmp27_;
	gint _tmp28_;
	GUPnPDIDLLiteObject* _tmp29_;
	const gchar* _tmp30_;
	RygelMediaObjects* _tmp31_;
	gpointer _tmp32_;
	const gchar* _tmp33_;
	const gchar* _tmp34_;
	GUPnPDIDLLiteObject* _tmp35_;
	const gchar* _tmp36_;
	const gchar* _tmp37_;
	GError* _tmp38_;
	GError * _inner_error_;
};

struct _RygelObjectCreatorFetchContainerData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelObjectCreator* self;
	RygelWritableContainer* result;
	RygelMediaObject* media_object;
	const gchar* _tmp0_;
	RygelMediaObject* _tmp1_;
	RygelMediaObject* _tmp2_;
	RygelMediaObject* _tmp3_;
	RygelMediaObject* _tmp4_;
	RygelContentDirectory* _tmp5_;
	RygelMediaContainer* _tmp6_;
	const gchar* _tmp7_;
	GCancellable* _tmp8_;
	GCancellable* _tmp9_;
	RygelMediaObject* _tmp10_;
	RygelMediaObject* _tmp11_;
	gboolean _tmp12_;
	RygelMediaObject* _tmp13_;
	RygelMediaObject* _tmp14_;
	const gchar* _tmp15_;
	GError* _tmp16_;
	RygelMediaObject* _tmp17_;
	const gchar* _tmp18_;
	RygelMediaObject* _tmp19_;
	const gchar* _tmp20_;
	const gchar* _tmp21_;
	GError* _tmp22_;
	gboolean _tmp23_;
	gboolean _tmp24_;
	GUPnPDIDLLiteObject* _tmp25_;
	RygelMediaObject* _tmp26_;
	GUPnPOCMFlags _tmp27_;
	gboolean _tmp28_;
	GUPnPDIDLLiteObject* _tmp29_;
	RygelMediaObject* _tmp30_;
	GUPnPOCMFlags _tmp31_;
	const gchar* _tmp32_;
	RygelMediaObject* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	GError* _tmp36_;
	RygelMediaObject* _tmp37_;
	RygelWritableContainer* _tmp38_;
	GError * _inner_error_;
};

struct _RygelObjectCreatorCreateObjectFromDidlData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelObjectCreator* self;
	RygelWritableContainer* container;
	RygelMediaObject* _tmp0_;
	GUPnPDIDLLiteObject* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	RygelWritableContainer* _tmp4_;
	GUPnPDIDLLiteObject* _tmp5_;
	const gchar* _tmp6_;
	const gchar* _tmp7_;
	GUPnPDIDLLiteObject* _tmp8_;
	const gchar* _tmp9_;
	const gchar* _tmp10_;
	RygelMediaObject* _tmp11_;
	RygelMediaObject* _tmp12_;
	RygelMediaObject* _tmp13_;
	GUPnPDIDLLiteObject* _tmp14_;
	RygelMediaObject* _tmp15_;
	RygelMediaObject* _tmp16_;
	GeeArrayList* _tmp17_;
	GeeArrayList* _tmp18_;
	gboolean _tmp19_;
	gboolean _tmp20_;
	gboolean _tmp21_;
	gchar* uri;
	RygelWritableContainer* _tmp22_;
	RygelMediaObject* _tmp23_;
	const gchar* _tmp24_;
	const gchar* _tmp25_;
	gchar* _tmp26_;
	RygelMediaObject* _tmp27_;
	const gchar* _tmp28_;
	RygelMediaObject* _tmp29_;
	RygelMediaObject* _tmp30_;
	RygelMediaObject* _tmp31_;
	GFile* file;
	RygelMediaObject* _tmp32_;
	gchar* _tmp33_;
	gchar* _tmp34_;
	GFile* _tmp35_;
	GFile* _tmp36_;
	RygelMediaObject* _tmp37_;
	GFile* _tmp38_;
	gboolean _tmp39_;
	RygelMediaObject* _tmp40_;
	RygelMediaObject* _tmp41_;
	gchar* _tmp42_;
	gchar* _tmp43_;
	GError * _inner_error_;
};

struct _RygelObjectCreatorCreateUriData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelObjectCreator* self;
	RygelWritableContainer* container;
	gchar* title;
	gchar* result;
	GFile* dir;
	RygelWritableContainer* _tmp0_;
	GCancellable* _tmp1_;
	GCancellable* _tmp2_;
	GFile* _tmp3_;
	GFile* _tmp4_;
	const gchar* _tmp5_;
	RygelWritableContainer* _tmp6_;
	const gchar* _tmp7_;
	const gchar* _tmp8_;
	GError* _tmp9_;
	gchar* _tmp10_;
	const gchar* _tmp11_;
	gchar* _tmp12_;
	GFile* file;
	GFile* _tmp13_;
	GFile* _tmp14_;
	GFile* _tmp15_;
	gchar* _tmp16_;
	GError * _inner_error_;
};

struct _Block4Data {
	int _ref_count_;
	RygelObjectCreator* self;
	RygelWritableContainer* container;
	gpointer _async_data_;
};

struct _Block5Data {
	int _ref_count_;
	Block4Data * _data4_;
	guint timeout;
};

struct _RygelObjectCreatorWaitForObjectData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GSimpleAsyncResult* _async_result;
	RygelObjectCreator* self;
	RygelWritableContainer* container;
	Block4Data* _data4_;
	RygelWritableContainer* _tmp0_;
	RygelWritableContainer* _tmp1_;
	const gchar* _tmp2_;
	const gchar* _tmp3_;
	RygelMediaObject* object;
	RygelMediaObject* _tmp4_;
	RygelMediaObject* _tmp5_;
	RygelWritableContainer* _tmp6_;
	RygelMediaObject* _tmp7_;
	const gchar* _tmp8_;
	const gchar* _tmp9_;
	GCancellable* _tmp10_;
	GCancellable* _tmp11_;
	RygelMediaObject* _tmp12_;
	RygelMediaObject* _tmp13_;
	GError* _error_;
	gchar* msg;
	const gchar* _tmp14_;
	gchar* _tmp15_;
	const gchar* _tmp16_;
	RygelWritableContainer* _tmp17_;
	const gchar* _tmp18_;
	const gchar* _tmp19_;
	RygelMediaObject* _tmp20_;
	const gchar* _tmp21_;
	const gchar* _tmp22_;
	GError* _tmp23_;
	const gchar* _tmp24_;
	RygelMediaObject* _tmp25_;
	Block5Data* _data5_;
	gulong id;
	RygelWritableContainer* _tmp26_;
	gulong _tmp27_;
	guint _tmp28_;
	RygelWritableContainer* _tmp29_;
	gulong _tmp30_;
	guint _tmp31_;
	guint _tmp32_;
	RygelWritableContainer* _tmp33_;
	const gchar* _tmp34_;
	const gchar* _tmp35_;
	RygelMediaObject* _tmp36_;
	RygelMediaObject* _tmp37_;
	GError * _inner_error_;
};

struct _RygelRootDevice {
	GObject parent_instance;
	RygelRootDevicePrivate * priv;
	RygelMediaServerPlugin* resource_factory;
};

struct _RygelRootDeviceClass {
	GObjectClass parent_class;
};

struct _RygelMediaServerPlugin {
	GObject parent_instance;
	RygelMediaServerPluginPrivate * priv;
	GList* upload_profiles;
};

struct _RygelMediaServerPluginClass {
	GObjectClass parent_class;
};


static gpointer rygel_base_media_container_parent_class = NULL;
static gpointer rygel_object_creator_parent_class = NULL;
static GPatternSpec* rygel_object_creator_comment_pattern;
static GPatternSpec* rygel_object_creator_comment_pattern = NULL;
static RygelStateMachineIface* rygel_object_creator_rygel_state_machine_parent_iface = NULL;

GType rygel_media_object_get_type (void) G_GNUC_CONST;
GType rygel_media_objects_get_type (void) G_GNUC_CONST;
GType rygel_media_container_get_type (void) G_GNUC_CONST;
GType rygel_base_media_container_get_type (void) G_GNUC_CONST;
enum  {
	RYGEL_BASE_MEDIA_CONTAINER_DUMMY_PROPERTY
};
RygelBaseMediaContainer* rygel_base_media_container_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, gint child_count);
RygelBaseMediaContainer* rygel_base_media_container_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, gint child_count);
static void rygel_base_media_container_real_get_children_data_free (gpointer _data);
static void rygel_base_media_container_real_get_children (RygelMediaObject* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean rygel_base_media_container_real_get_children_co (RygelBaseMediaContainerGetChildrenData* _data_);
static void rygel_base_media_container_real_find_object_data_free (gpointer _data);
static void rygel_base_media_container_real_find_object (RygelMediaObject* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean rygel_base_media_container_real_find_object_co (RygelBaseMediaContainerFindObjectData* _data_);
GType rygel_state_machine_get_type (void) G_GNUC_CONST;
GType rygel_object_creator_get_type (void) G_GNUC_CONST;
GType rygel_content_directory_get_type (void) G_GNUC_CONST;
GType rygel_service_action_get_type (void) G_GNUC_CONST;
GType rygel_serializer_get_type (void) G_GNUC_CONST;
#define RYGEL_OBJECT_CREATOR_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreatorPrivate))
enum  {
	RYGEL_OBJECT_CREATOR_DUMMY_PROPERTY,
	RYGEL_OBJECT_CREATOR_CANCELLABLE
};
#define RYGEL_OBJECT_CREATOR_INVALID_CHARS "/?<>\\:*|\""
RygelObjectCreator* rygel_object_creator_new (RygelContentDirectory* content_dir, RygelServiceAction* action);
RygelObjectCreator* rygel_object_creator_construct (GType object_type, RygelContentDirectory* content_dir, RygelServiceAction* action);
GType rygel_http_server_get_type (void) G_GNUC_CONST;
GType rygel_root_device_get_type (void) G_GNUC_CONST;
void rygel_state_machine_set_cancellable (RygelStateMachine* self, GCancellable* value);
GType rygel_serializer_type_get_type (void) G_GNUC_CONST;
RygelSerializer* rygel_serializer_new (RygelSerializerType type);
RygelSerializer* rygel_serializer_construct (GType object_type, RygelSerializerType type);
static void rygel_object_creator_real_run_data_free (gpointer _data);
static void rygel_object_creator_real_run (RygelStateMachine* base, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gboolean rygel_object_creator_real_run_co (RygelObjectCreatorRunData* _data_);
static void rygel_object_creator_parse_args (RygelObjectCreator* self, GError** error);
static void rygel_object_creator_parse_didl (RygelObjectCreator* self, GError** error);
GType rygel_writable_container_get_type (void) G_GNUC_CONST;
static void rygel_object_creator_fetch_container (RygelObjectCreator* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static RygelWritableContainer* rygel_object_creator_fetch_container_finish (RygelObjectCreator* self, GAsyncResult* _res_, GError** error);
static void rygel_object_creator_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
gboolean rygel_writable_container_can_create (RygelWritableContainer* self, const gchar* upnp_class);
#define RYGEL_MEDIA_CONTAINER_ANY "DLNA.ORG_AnyContainer"
const gchar* rygel_media_object_get_id (RygelMediaObject* self);
GQuark rygel_content_directory_error_quark (void);
static gboolean rygel_object_creator_validate_create_class (RygelObjectCreator* self, RygelWritableContainer* container);
static void rygel_object_creator_create_object_from_didl (RygelObjectCreator* self, RygelWritableContainer* container, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void rygel_object_creator_create_object_from_didl_finish (RygelObjectCreator* self, GAsyncResult* _res_, GError** error);
GType rygel_media_item_get_type (void) G_GNUC_CONST;
void rygel_writable_container_add_item (RygelWritableContainer* self, RygelMediaItem* item, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
void rygel_writable_container_add_item_finish (RygelWritableContainer* self, GAsyncResult* _res_);
GCancellable* rygel_state_machine_get_cancellable (RygelStateMachine* self);
void rygel_writable_container_add_container (RygelWritableContainer* self, RygelMediaContainer* container, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
void rygel_writable_container_add_container_finish (RygelWritableContainer* self, GAsyncResult* _res_);
static void rygel_object_creator_wait_for_object (RygelObjectCreator* self, RygelWritableContainer* container, GAsyncReadyCallback _callback_, gpointer _user_data_);
static void rygel_object_creator_wait_for_object_finish (RygelObjectCreator* self, GAsyncResult* _res_);
void rygel_media_object_serialize (RygelMediaObject* self, RygelSerializer* serializer, RygelHTTPServer* server);
static void rygel_object_creator_conclude (RygelObjectCreator* self);
GType rygel_object_removal_queue_get_type (void) G_GNUC_CONST;
RygelObjectRemovalQueue* rygel_object_removal_queue_get_default (void);
void rygel_object_removal_queue_queue (RygelObjectRemovalQueue* self, RygelMediaObject* object, GCancellable* cancellable);
static void rygel_object_creator_handle_error (RygelObjectCreator* self, GError* _error_);
void rygel_service_action_get (RygelServiceAction* self, const gchar* arg1_name, GType arg1_type, gchar** arg1_val, const gchar* arg2_name, GType arg2_type, gchar** arg2_val);
static void __lambda6_ (RygelObjectCreator* self, GUPnPDIDLLiteObject* didl_object);
static void ___lambda6__gupnp_didl_lite_parser_object_available (GUPnPDIDLLiteParser* _sender, GUPnPDIDLLiteObject* object, gpointer self);
#define RYGEL_PLAYLIST_ITEM_UPNP_CLASS "object.item.playlistItem"
static void _g_object_unref0_ (gpointer var);
static void _g_list_free__g_object_unref0_ (GList* self);
static void rygel_object_creator_generalize_upnp_class (RygelObjectCreator* self, gchar** upnp_class);
static void rygel_object_creator_build_create_class_expression_data_free (gpointer _data);
gpointer rygel_search_expression_ref (gpointer instance);
void rygel_search_expression_unref (gpointer instance);
GParamSpec* rygel_param_spec_search_expression (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void rygel_value_set_search_expression (GValue* value, gpointer v_object);
void rygel_value_take_search_expression (GValue* value, gpointer v_object);
gpointer rygel_value_get_search_expression (const GValue* value);
GType rygel_search_expression_get_type (void) G_GNUC_CONST;
static void rygel_object_creator_build_create_class_expression (RygelObjectCreator* self, RygelSearchExpression* expression, GAsyncReadyCallback _callback_, gpointer _user_data_);
static RygelSearchExpression* rygel_object_creator_build_create_class_expression_finish (RygelObjectCreator* self, GAsyncResult* _res_);
static gboolean rygel_object_creator_build_create_class_expression_co (RygelObjectCreatorBuildCreateClassExpressionData* _data_);
static void _g_free0_ (gpointer var);
static void _g_list_free__g_free0_ (GList* self);
GType rygel_search_criteria_parser_get_type (void) G_GNUC_CONST;
RygelSearchCriteriaParser* rygel_search_criteria_parser_new (const gchar* str, GError** error);
RygelSearchCriteriaParser* rygel_search_criteria_parser_construct (GType object_type, const gchar* str, GError** error);
void rygel_state_machine_run (RygelStateMachine* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
void rygel_state_machine_run_finish (RygelStateMachine* self, GAsyncResult* _res_);
static void rygel_object_creator_build_create_class_expression_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
GType rygel_logical_expression_get_type (void) G_GNUC_CONST;
RygelLogicalExpression* rygel_logical_expression_new (void);
RygelLogicalExpression* rygel_logical_expression_construct (GType object_type);
GType rygel_logical_operator_get_type (void) G_GNUC_CONST;
static void rygel_object_creator_find_any_container_data_free (gpointer _data);
static void rygel_object_creator_find_any_container (RygelObjectCreator* self, GAsyncReadyCallback _callback_, gpointer _user_data_);
static RygelMediaObject* rygel_object_creator_find_any_container_finish (RygelObjectCreator* self, GAsyncResult* _res_, GError** error);
static gboolean rygel_object_creator_find_any_container_co (RygelObjectCreatorFindAnyContainerData* _data_);
GType rygel_searchable_container_get_type (void) G_GNUC_CONST;
GType rygel_relational_expression_get_type (void) G_GNUC_CONST;
RygelRelationalExpression* rygel_relational_expression_new (void);
RygelRelationalExpression* rygel_relational_expression_construct (GType object_type);
static void rygel_object_creator_find_any_container_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void rygel_searchable_container_search (RygelSearchableContainer* self, RygelSearchExpression* expression, gint offset, gint count, const gchar* soer_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
RygelMediaObjects* rygel_searchable_container_search_finish (RygelSearchableContainer* self, GAsyncResult* _res_, gint* total_matches);
static void rygel_object_creator_fetch_container_data_free (gpointer _data);
static gboolean rygel_object_creator_fetch_container_co (RygelObjectCreatorFetchContainerData* _data_);
static void rygel_object_creator_fetch_container_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void rygel_media_object_find_object (RygelMediaObject* self, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
RygelMediaObject* rygel_media_object_find_object_finish (RygelMediaObject* self, GAsyncResult* _res_, GError** error);
gchar* rygel_serializer_get_string (RygelSerializer* self);
void rygel_service_action_set (RygelServiceAction* self, const gchar* arg1_name, GType arg1_type, const gchar* arg1_val, const gchar* arg2_name, GType arg2_type, const gchar* arg2_val);
void rygel_service_action_return (RygelServiceAction* self);
void rygel_service_action_return_error (RygelServiceAction* self, gint code, const gchar* message);
static gchar* rygel_object_creator_get_generic_mime_type (RygelObjectCreator* self);
GType rygel_image_item_get_type (void) G_GNUC_CONST;
GType rygel_video_item_get_type (void) G_GNUC_CONST;
static void rygel_object_creator_create_object_from_didl_data_free (gpointer _data);
static gboolean rygel_object_creator_create_object_from_didl_co (RygelObjectCreatorCreateObjectFromDidlData* _data_);
static RygelMediaObject* rygel_object_creator_create_object (RygelObjectCreator* self, const gchar* id, RygelWritableContainer* parent, const gchar* title, const gchar* upnp_class, GError** error);
void rygel_media_object_apply_didl_lite (RygelMediaObject* self, GUPnPDIDLLiteObject* object);
static void rygel_object_creator_extract_item_parameters (RygelObjectCreator* self, GError** error);
GeeArrayList* rygel_media_object_get_uris (RygelMediaObject* self);
static void rygel_object_creator_create_uri (RygelObjectCreator* self, RygelWritableContainer* container, const gchar* title, GAsyncReadyCallback _callback_, gpointer _user_data_);
static gchar* rygel_object_creator_create_uri_finish (RygelObjectCreator* self, GAsyncResult* _res_, GError** error);
const gchar* rygel_media_object_get_title (RygelMediaObject* self);
static void rygel_object_creator_create_object_from_didl_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
void rygel_media_object_add_uri (RygelMediaObject* self, const gchar* uri);
gchar* rygel_media_object_get_primary_uri (RygelMediaObject* self);
void rygel_media_object_set_id (RygelMediaObject* self, const gchar* value);
static void rygel_object_creator_parse_and_verify_didl_date (RygelObjectCreator* self, GError** error);
static gboolean rygel_object_creator_is_profile_valid (RygelObjectCreator* self, const gchar* profile);
static gboolean rygel_object_creator_is_valid_uri (RygelObjectCreator* self, const gchar* uri, gchar** sanitized_uri);
static void _vala_SoupDate_free (SoupDate* self);
#define RYGEL_IMAGE_ITEM_UPNP_CLASS "object.item.imageItem"
#define RYGEL_PHOTO_ITEM_UPNP_CLASS "object.item.imageItem.photo"
#define RYGEL_VIDEO_ITEM_UPNP_CLASS "object.item.videoItem"
#define RYGEL_AUDIO_ITEM_UPNP_CLASS "object.item.audioItem"
#define RYGEL_MUSIC_ITEM_UPNP_CLASS "object.item.audioItem.musicTrack"
#define RYGEL_MEDIA_CONTAINER_UPNP_CLASS "object.container"
#define RYGEL_MEDIA_CONTAINER_STORAGE_FOLDER "object.container.storageFolder"
#define RYGEL_MEDIA_CONTAINER_PLAYLIST "object.container.playlistContainer"
RygelImageItem* rygel_image_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelImageItem* rygel_image_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelPhotoItem* rygel_photo_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelPhotoItem* rygel_photo_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title);
GType rygel_photo_item_get_type (void) G_GNUC_CONST;
RygelVideoItem* rygel_video_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelVideoItem* rygel_video_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelAudioItem* rygel_audio_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelAudioItem* rygel_audio_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title);
GType rygel_audio_item_get_type (void) G_GNUC_CONST;
RygelMusicItem* rygel_music_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelMusicItem* rygel_music_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title);
GType rygel_music_item_get_type (void) G_GNUC_CONST;
RygelPlaylistItem* rygel_playlist_item_new (const gchar* id, RygelMediaContainer* parent, const gchar* title);
RygelPlaylistItem* rygel_playlist_item_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title);
GType rygel_playlist_item_get_type (void) G_GNUC_CONST;
static void _vala_SoupURI_free (SoupURI* self);
static gchar* rygel_object_creator_mangle_title (RygelObjectCreator* self, const gchar* title, GError** error);
static void rygel_object_creator_create_uri_data_free (gpointer _data);
static gboolean rygel_object_creator_create_uri_co (RygelObjectCreatorCreateUriData* _data_);
void rygel_writable_container_get_writable (RygelWritableContainer* self, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
GFile* rygel_writable_container_get_writable_finish (RygelWritableContainer* self, GAsyncResult* _res_);
static void rygel_object_creator_create_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static void rygel_object_creator_wait_for_object_data_free (gpointer _data);
static gboolean rygel_object_creator_wait_for_object_co (RygelObjectCreatorWaitForObjectData* _data_);
static Block4Data* block4_data_ref (Block4Data* _data4_);
static void block4_data_unref (void * _userdata_);
static void rygel_object_creator_wait_for_object_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_);
static Block5Data* block5_data_ref (Block5Data* _data5_);
static void block5_data_unref (void * _userdata_);
static void ____lambda7_ (Block5Data* _data5_, RygelMediaContainer* container);
static void _____lambda7__rygel_media_container_container_updated (RygelMediaContainer* _sender, RygelMediaContainer* container, gpointer self);
static gboolean ____lambda8_ (Block5Data* _data5_);
static gboolean _____lambda8__gsource_func (gpointer self);
gpointer rygel_dlna_profile_ref (gpointer instance);
void rygel_dlna_profile_unref (gpointer instance);
GParamSpec* rygel_param_spec_dlna_profile (const gchar* name, const gchar* nick, const gchar* blurb, GType object_type, GParamFlags flags);
void rygel_value_set_dlna_profile (GValue* value, gpointer v_object);
void rygel_value_take_dlna_profile (GValue* value, gpointer v_object);
gpointer rygel_value_get_dlna_profile (const GValue* value);
GType rygel_dlna_profile_get_type (void) G_GNUC_CONST;
GType rygel_media_server_plugin_get_type (void) G_GNUC_CONST;
RygelDLNAProfile* rygel_dlna_profile_new (const gchar* name, const gchar* mime);
RygelDLNAProfile* rygel_dlna_profile_construct (GType object_type, const gchar* name, const gchar* mime);
gint rygel_dlna_profile_compare_by_name (RygelDLNAProfile* a, RygelDLNAProfile* b);
static gint _rygel_dlna_profile_compare_by_name_gcompare_func (gconstpointer a, gconstpointer b);
static void rygel_object_creator_finalize (GObject* obj);
static void _vala_rygel_object_creator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec);
static void _vala_rygel_object_creator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec);


/**
     * Create a media container with the specified details.
     *
     * @param id See the id property of the #RygelMediaObject class.
     * @param parent The parent container, if any.
     * @param title See the title property of the #RygelMediaObject class.
     * @param child_count The initially-known number of child items.
     */
RygelBaseMediaContainer* rygel_base_media_container_construct (GType object_type, const gchar* id, RygelMediaContainer* parent, const gchar* title, gint child_count) {
	RygelBaseMediaContainer * self = NULL;
	const gchar* _tmp0_ = NULL;
	RygelMediaContainer* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	gint _tmp3_ = 0;
	g_return_val_if_fail (id != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = id;
	_tmp1_ = parent;
	_tmp2_ = title;
	_tmp3_ = child_count;
	self = (RygelBaseMediaContainer*) g_object_new (object_type, "id", _tmp0_, "parent", _tmp1_, "title", _tmp2_, "child-count", _tmp3_, NULL);
	return self;
}


RygelBaseMediaContainer* rygel_base_media_container_new (const gchar* id, RygelMediaContainer* parent, const gchar* title, gint child_count) {
	return rygel_base_media_container_construct (RYGEL_TYPE_BASE_MEDIA_CONTAINER, id, parent, title, child_count);
}


static void rygel_base_media_container_real_get_children_data_free (gpointer _data) {
	RygelBaseMediaContainerGetChildrenData* _data_;
	_data_ = _data;
	_g_free0 (_data_->sort_criteria);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelBaseMediaContainerGetChildrenData, _data_);
}


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


static void rygel_base_media_container_real_get_children (RygelMediaObject* base, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelBaseMediaContainer * self;
	RygelBaseMediaContainerGetChildrenData* _data_;
	RygelBaseMediaContainer* _tmp0_ = NULL;
	guint _tmp1_ = 0U;
	guint _tmp2_ = 0U;
	const gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	GCancellable* _tmp5_ = NULL;
	GCancellable* _tmp6_ = NULL;
	self = (RygelBaseMediaContainer*) base;
	_data_ = g_slice_new0 (RygelBaseMediaContainerGetChildrenData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_base_media_container_real_get_children);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_base_media_container_real_get_children_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = offset;
	_data_->offset = _tmp1_;
	_tmp2_ = max_count;
	_data_->max_count = _tmp2_;
	_tmp3_ = sort_criteria;
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (_data_->sort_criteria);
	_data_->sort_criteria = _tmp4_;
	_tmp5_ = cancellable;
	_tmp6_ = _g_object_ref0 (_tmp5_);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp6_;
	rygel_base_media_container_real_get_children_co (_data_);
}


static RygelMediaObjects* rygel_base_media_container_real_get_children_finish (RygelMediaObject* base, GAsyncResult* _res_, GError** error) {
	RygelMediaObjects* result;
	RygelBaseMediaContainerGetChildrenData* _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;
}


/**
     * Fetches the list of media objects directly under this container.
     *
     * @param offset zero-based index of the first item to return
     * @param max_count maximum number of objects to return
     * @param sort_criteria sorting order of objects to return
     * @param cancellable optional cancellable for this operation
     *
     * @return A list of media objects.
     */
static gboolean rygel_base_media_container_real_get_children_co (RygelBaseMediaContainerGetChildrenData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->result = 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;
	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 void rygel_base_media_container_real_find_object_data_free (gpointer _data) {
	RygelBaseMediaContainerFindObjectData* _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 (RygelBaseMediaContainerFindObjectData, _data_);
}


static void rygel_base_media_container_real_find_object (RygelMediaObject* base, const gchar* id, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelBaseMediaContainer * self;
	RygelBaseMediaContainerFindObjectData* _data_;
	RygelBaseMediaContainer* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	GCancellable* _tmp3_ = NULL;
	GCancellable* _tmp4_ = NULL;
	self = (RygelBaseMediaContainer*) base;
	_data_ = g_slice_new0 (RygelBaseMediaContainerFindObjectData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_base_media_container_real_find_object);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_base_media_container_real_find_object_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = id;
	_tmp2_ = g_strdup (_tmp1_);
	_g_free0 (_data_->id);
	_data_->id = _tmp2_;
	_tmp3_ = cancellable;
	_tmp4_ = _g_object_ref0 (_tmp3_);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp4_;
	rygel_base_media_container_real_find_object_co (_data_);
}


static RygelMediaObject* rygel_base_media_container_real_find_object_finish (RygelMediaObject* base, GAsyncResult* _res_, GError** error) {
	RygelMediaObject* result;
	RygelBaseMediaContainerFindObjectData* _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;
}


/**
     * Recursively searches this container for a media object with the given ID.
     *
     * @param id ID of the media object to search for
     * @param cancellable optional cancellable for this operation
     *
     * @return the found media object.
     */
static gboolean rygel_base_media_container_real_find_object_co (RygelBaseMediaContainerFindObjectData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->result = 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;
	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 void rygel_base_media_container_class_init (RygelBaseMediaContainerClass * klass) {
	rygel_base_media_container_parent_class = g_type_class_peek_parent (klass);
	((RygelMediaObjectClass *) klass)->get_children = rygel_base_media_container_real_get_children;
	((RygelMediaObjectClass *) klass)->get_children_finish = rygel_base_media_container_real_get_children_finish;
	((RygelMediaObjectClass *) klass)->find_object = rygel_base_media_container_real_find_object;
	((RygelMediaObjectClass *) klass)->find_object_finish = rygel_base_media_container_real_find_object_finish;
}


static void rygel_base_media_container_instance_init (RygelBaseMediaContainer * self) {
}


/**
 * Dummy implementation of Rygel.MediaContainer to pass on to
 * Rygel.WritableContianer for creation.
 */
GType rygel_base_media_container_get_type (void) {
	static volatile gsize rygel_base_media_container_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_base_media_container_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelBaseMediaContainerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_base_media_container_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelBaseMediaContainer), 0, (GInstanceInitFunc) rygel_base_media_container_instance_init, NULL };
		GType rygel_base_media_container_type_id;
		rygel_base_media_container_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_CONTAINER, "RygelBaseMediaContainer", &g_define_type_info, 0);
		g_once_init_leave (&rygel_base_media_container_type_id__volatile, rygel_base_media_container_type_id);
	}
	return rygel_base_media_container_type_id__volatile;
}


RygelObjectCreator* rygel_object_creator_construct (GType object_type, RygelContentDirectory* content_dir, RygelServiceAction* action) {
	RygelObjectCreator * self = NULL;
	RygelContentDirectory* _tmp0_ = NULL;
	RygelContentDirectory* _tmp1_ = NULL;
	RygelContentDirectory* _tmp2_ = NULL;
	GCancellable* _tmp3_ = NULL;
	RygelServiceAction* _tmp4_ = NULL;
	RygelSerializer* _tmp5_ = NULL;
	GUPnPDIDLLiteParser* _tmp6_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (content_dir != NULL, NULL);
	g_return_val_if_fail (action != NULL, NULL);
	self = (RygelObjectCreator*) g_object_new (object_type, NULL);
	_tmp0_ = content_dir;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->content_dir);
	self->priv->content_dir = _tmp1_;
	_tmp2_ = content_dir;
	_tmp3_ = _tmp2_->cancellable;
	rygel_state_machine_set_cancellable ((RygelStateMachine*) self, _tmp3_);
	_tmp4_ = action;
	action = NULL;
	_g_object_unref0 (self->priv->action);
	self->priv->action = _tmp4_;
	_tmp5_ = rygel_serializer_new (RYGEL_SERIALIZER_TYPE_GENERIC_DIDL);
	_g_object_unref0 (self->priv->serializer);
	self->priv->serializer = _tmp5_;
	_tmp6_ = gupnp_didl_lite_parser_new ();
	_g_object_unref0 (self->priv->didl_parser);
	self->priv->didl_parser = _tmp6_;
	{
		gchar* pattern = NULL;
		gchar* _tmp7_ = NULL;
		gchar* _tmp8_ = NULL;
		gchar* _tmp9_ = NULL;
		gchar* _tmp10_ = NULL;
		gchar* _tmp11_ = NULL;
		gchar* _tmp12_ = NULL;
		GRegex* _tmp13_ = NULL;
		GRegex* _tmp14_ = NULL;
		GRegex* _tmp15_ = NULL;
		_tmp7_ = g_regex_escape_string (RYGEL_OBJECT_CREATOR_INVALID_CHARS, -1);
		_tmp8_ = _tmp7_;
		_tmp9_ = g_strconcat ("[", _tmp8_, NULL);
		_tmp10_ = _tmp9_;
		_tmp11_ = g_strconcat (_tmp10_, "]", NULL);
		_tmp12_ = _tmp11_;
		_g_free0 (_tmp10_);
		_g_free0 (_tmp8_);
		pattern = _tmp12_;
		_tmp14_ = g_regex_new (pattern, G_REGEX_OPTIMIZE, G_REGEX_MATCH_NOTEMPTY, &_inner_error_);
		_tmp13_ = _tmp14_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			_g_free0 (pattern);
			goto __catch0_g_error;
		}
		_tmp15_ = _tmp13_;
		_tmp13_ = NULL;
		_g_regex_unref0 (self->priv->title_regex);
		self->priv->title_regex = _tmp15_;
		_g_regex_unref0 (_tmp13_);
		_g_free0 (pattern);
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* _error_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (_error_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		_g_object_unref0 (action);
		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 NULL;
	}
	_g_object_unref0 (action);
	return self;
}


RygelObjectCreator* rygel_object_creator_new (RygelContentDirectory* content_dir, RygelServiceAction* action) {
	return rygel_object_creator_construct (RYGEL_TYPE_OBJECT_CREATOR, content_dir, action);
}


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


static void rygel_object_creator_real_run (RygelStateMachine* base, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelObjectCreator * self;
	RygelObjectCreatorRunData* _data_;
	RygelObjectCreator* _tmp0_ = NULL;
	self = (RygelObjectCreator*) base;
	_data_ = g_slice_new0 (RygelObjectCreatorRunData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_object_creator_real_run);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_object_creator_real_run_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_object_creator_real_run_co (_data_);
}


static void rygel_object_creator_real_run_finish (RygelStateMachine* base, GAsyncResult* _res_) {
	RygelObjectCreatorRunData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


static void rygel_object_creator_run_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelObjectCreatorRunData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_object_creator_real_run_co (_data_);
}


static gboolean rygel_object_creator_real_run_co (RygelObjectCreatorRunData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		case 3:
		goto _state_3;
		case 4:
		goto _state_4;
		case 5:
		goto _state_5;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	{
		rygel_object_creator_parse_args (_data_->self, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch1_g_error;
		}
		rygel_object_creator_parse_didl (_data_->self, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch1_g_error;
		}
		_data_->_state_ = 1;
		rygel_object_creator_fetch_container (_data_->self, rygel_object_creator_run_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp0_ = NULL;
		_data_->_tmp0_ = rygel_object_creator_fetch_container_finish (_data_->self, _data_->_res_, &_data_->_inner_error_);
		_data_->container = _data_->_tmp0_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch1_g_error;
		}
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = _data_->container;
		_data_->_tmp3_ = NULL;
		_data_->_tmp3_ = _data_->self->priv->didl_object;
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = gupnp_didl_lite_object_get_upnp_class (_data_->_tmp3_);
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _data_->_tmp4_;
		_data_->_tmp6_ = FALSE;
		_data_->_tmp6_ = rygel_writable_container_can_create (_data_->_tmp2_, _data_->_tmp5_);
		if (!_data_->_tmp6_) {
			_data_->_tmp7_ = NULL;
			_data_->_tmp7_ = _data_->self->priv->container_id;
			_data_->_tmp1_ = g_strcmp0 (_data_->_tmp7_, RYGEL_MEDIA_CONTAINER_ANY) != 0;
		} else {
			_data_->_tmp1_ = FALSE;
		}
		if (_data_->_tmp1_) {
			_data_->_tmp8_ = NULL;
			_data_->_tmp8_ = _data_->self->priv->didl_object;
			_data_->_tmp9_ = NULL;
			_data_->_tmp9_ = gupnp_didl_lite_object_get_upnp_class (_data_->_tmp8_);
			_data_->_tmp10_ = NULL;
			_data_->_tmp10_ = _data_->_tmp9_;
			_data_->_tmp11_ = NULL;
			_data_->_tmp11_ = _data_->container;
			_data_->_tmp12_ = NULL;
			_data_->_tmp12_ = rygel_media_object_get_id ((RygelMediaObject*) _data_->_tmp11_);
			_data_->_tmp13_ = NULL;
			_data_->_tmp13_ = _data_->_tmp12_;
			_data_->_tmp14_ = NULL;
			_data_->_tmp14_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, "Creating of objects with class %s " "is not supported in %s", _data_->_tmp10_, _data_->_tmp13_);
			_data_->_inner_error_ = _data_->_tmp14_;
			_g_object_unref0 (_data_->container);
			goto __catch1_g_error;
		}
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = _data_->self->priv->didl_object;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp16_, gupnp_didl_lite_container_get_type ())) {
			_data_->_tmp17_ = NULL;
			_data_->_tmp17_ = _data_->container;
			_data_->_tmp18_ = FALSE;
			_data_->_tmp18_ = rygel_object_creator_validate_create_class (_data_->self, _data_->_tmp17_);
			_data_->_tmp15_ = !_data_->_tmp18_;
		} else {
			_data_->_tmp15_ = FALSE;
		}
		if (_data_->_tmp15_) {
			_data_->_tmp19_ = NULL;
			_data_->_tmp19_ = _ ("upnp:createClass value not supported");
			_data_->_tmp20_ = NULL;
			_data_->_tmp20_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _data_->_tmp19_);
			_data_->_inner_error_ = _data_->_tmp20_;
			_g_object_unref0 (_data_->container);
			goto __catch1_g_error;
		}
		_data_->_tmp21_ = NULL;
		_data_->_tmp21_ = _data_->container;
		_data_->_state_ = 2;
		rygel_object_creator_create_object_from_didl (_data_->self, _data_->_tmp21_, rygel_object_creator_run_ready, _data_);
		return FALSE;
		_state_2:
		rygel_object_creator_create_object_from_didl_finish (_data_->self, _data_->_res_, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->container);
			goto __catch1_g_error;
		}
		_data_->_tmp22_ = NULL;
		_data_->_tmp22_ = _data_->self->priv->object;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp22_, RYGEL_TYPE_MEDIA_ITEM)) {
			_data_->_tmp23_ = NULL;
			_data_->_tmp23_ = _data_->container;
			_data_->_tmp24_ = NULL;
			_data_->_tmp24_ = _data_->self->priv->object;
			_data_->_tmp25_ = NULL;
			_data_->_tmp25_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
			_data_->_tmp26_ = NULL;
			_data_->_tmp26_ = _data_->_tmp25_;
			_data_->_state_ = 3;
			rygel_writable_container_add_item (_data_->_tmp23_, G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp24_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _data_->_tmp24_) : NULL, _data_->_tmp26_, rygel_object_creator_run_ready, _data_);
			return FALSE;
			_state_3:
			rygel_writable_container_add_item_finish (_data_->_tmp23_, _data_->_res_);
		} else {
			_data_->_tmp27_ = NULL;
			_data_->_tmp27_ = _data_->container;
			_data_->_tmp28_ = NULL;
			_data_->_tmp28_ = _data_->self->priv->object;
			_data_->_tmp29_ = NULL;
			_data_->_tmp29_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
			_data_->_tmp30_ = NULL;
			_data_->_tmp30_ = _data_->_tmp29_;
			_data_->_state_ = 4;
			rygel_writable_container_add_container (_data_->_tmp27_, G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp28_, RYGEL_TYPE_MEDIA_CONTAINER) ? ((RygelMediaContainer*) _data_->_tmp28_) : NULL, _data_->_tmp30_, rygel_object_creator_run_ready, _data_);
			return FALSE;
			_state_4:
			rygel_writable_container_add_container_finish (_data_->_tmp27_, _data_->_res_);
		}
		_data_->_tmp31_ = NULL;
		_data_->_tmp31_ = _data_->container;
		_data_->_state_ = 5;
		rygel_object_creator_wait_for_object (_data_->self, _data_->_tmp31_, rygel_object_creator_run_ready, _data_);
		return FALSE;
		_state_5:
		rygel_object_creator_wait_for_object_finish (_data_->self, _data_->_res_);
		_data_->_tmp32_ = NULL;
		_data_->_tmp32_ = _data_->self->priv->object;
		_data_->_tmp33_ = NULL;
		_data_->_tmp33_ = _data_->self->priv->serializer;
		_data_->_tmp34_ = NULL;
		_data_->_tmp34_ = _data_->self->priv->content_dir;
		_data_->_tmp35_ = NULL;
		_data_->_tmp35_ = _data_->_tmp34_->http_server;
		rygel_media_object_serialize (_data_->_tmp32_, _data_->_tmp33_, _data_->_tmp35_);
		rygel_object_creator_conclude (_data_->self);
		_data_->_tmp37_ = NULL;
		_data_->_tmp37_ = _data_->self->priv->container_id;
		if (g_strcmp0 (_data_->_tmp37_, RYGEL_MEDIA_CONTAINER_ANY) == 0) {
			_data_->_tmp39_ = NULL;
			_data_->_tmp39_ = _data_->self->priv->object;
			if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp39_, RYGEL_TYPE_MEDIA_ITEM)) {
				_data_->_tmp40_ = NULL;
				_data_->_tmp40_ = _data_->self->priv->object;
				_data_->_tmp41_ = FALSE;
				_data_->_tmp41_ = (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp40_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _data_->_tmp40_) : NULL)->place_holder;
				_data_->_tmp38_ = _data_->_tmp41_;
			} else {
				_data_->_tmp38_ = FALSE;
			}
			_data_->_tmp36_ = _data_->_tmp38_;
		} else {
			_data_->_tmp36_ = FALSE;
		}
		if (_data_->_tmp36_) {
			_data_->_tmp42_ = NULL;
			_data_->_tmp42_ = rygel_object_removal_queue_get_default ();
			_data_->queue = _data_->_tmp42_;
			_data_->_tmp43_ = NULL;
			_data_->_tmp43_ = _data_->queue;
			_data_->_tmp44_ = NULL;
			_data_->_tmp44_ = _data_->self->priv->object;
			_data_->_tmp45_ = NULL;
			_data_->_tmp45_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
			_data_->_tmp46_ = NULL;
			_data_->_tmp46_ = _data_->_tmp45_;
			rygel_object_removal_queue_queue (_data_->_tmp43_, _data_->_tmp44_, _data_->_tmp46_);
			_g_object_unref0 (_data_->queue);
		}
		_g_object_unref0 (_data_->container);
	}
	goto __finally1;
	__catch1_g_error:
	{
		_data_->err = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		_data_->_tmp47_ = NULL;
		_data_->_tmp47_ = _data_->err;
		rygel_object_creator_handle_error (_data_->self, _data_->_tmp47_);
		_g_error_free0 (_data_->err);
	}
	__finally1:
	if (G_UNLIKELY (_data_->_inner_error_ != 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;
	}
	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;
}


/**
     * Check the supplied input parameters.
     */
static void rygel_object_creator_parse_args (RygelObjectCreator* self, GError** error) {
	RygelServiceAction* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	const gchar* _tmp11_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->action;
	rygel_service_action_get (_tmp0_, "ContainerID", G_TYPE_STRING, &_tmp1_, "Elements", G_TYPE_STRING, &_tmp2_);
	_g_free0 (self->priv->container_id);
	self->priv->container_id = _tmp1_;
	_g_free0 (self->priv->elements);
	self->priv->elements = _tmp2_;
	_tmp3_ = self->priv->elements;
	if (_tmp3_ == NULL) {
		const gchar* _tmp4_ = NULL;
		GError* _tmp5_ = NULL;
		_tmp4_ = _ ("'Elements' argument missing.");
		_tmp5_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp4_);
		_inner_error_ = _tmp5_;
		g_propagate_error (error, _inner_error_);
		return;
	} else {
		GPatternSpec* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		gboolean _tmp8_ = FALSE;
		_tmp6_ = rygel_object_creator_comment_pattern;
		_tmp7_ = self->priv->elements;
		_tmp8_ = g_pattern_match_string (_tmp6_, _tmp7_);
		if (_tmp8_) {
			const gchar* _tmp9_ = NULL;
			GError* _tmp10_ = NULL;
			_tmp9_ = _ ("Comments not allowed in XML");
			_tmp10_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp9_);
			_inner_error_ = _tmp10_;
			g_propagate_error (error, _inner_error_);
			return;
		}
	}
	_tmp11_ = self->priv->container_id;
	if (_tmp11_ == NULL) {
		const gchar* _tmp12_ = NULL;
		GError* _tmp13_ = NULL;
		_tmp12_ = _ ("Missing ContainerID argument");
		_tmp13_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_INVALID_ARGS, _tmp12_);
		_inner_error_ = _tmp13_;
		g_propagate_error (error, _inner_error_);
		return;
	}
}


/**
     * Parse the given DIDL-Lite snippet.
     *
     * Parses the DIDL-Lite and performs checking of the passed meta-data
     * according to UPnP and DLNA guidelines.
     */
static void __lambda6_ (RygelObjectCreator* self, GUPnPDIDLLiteObject* didl_object) {
	GUPnPDIDLLiteObject* _tmp0_ = NULL;
	GUPnPDIDLLiteObject* _tmp1_ = NULL;
	g_return_if_fail (didl_object != NULL);
	_tmp0_ = didl_object;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->didl_object);
	self->priv->didl_object = _tmp1_;
}


static void ___lambda6__gupnp_didl_lite_parser_object_available (GUPnPDIDLLiteParser* _sender, GUPnPDIDLLiteObject* object, gpointer self) {
	__lambda6_ ((RygelObjectCreator*) self, object);
}


static void _g_object_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (g_object_unref (var), NULL));
}


static void _g_list_free__g_object_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_object_unref0_, NULL);
	g_list_free (self);
}


static void rygel_object_creator_parse_didl (RygelObjectCreator* self, GError** error) {
	GUPnPDIDLLiteParser* _tmp0_ = NULL;
	GUPnPDIDLLiteObject* _tmp4_ = NULL;
	gboolean _tmp10_ = FALSE;
	GUPnPDIDLLiteObject* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	const gchar* _tmp13_ = NULL;
	GUPnPDIDLLiteObject* _tmp21_ = NULL;
	const gchar* _tmp22_ = NULL;
	const gchar* _tmp23_ = NULL;
	gboolean _tmp28_ = FALSE;
	GUPnPDIDLLiteObject* _tmp29_ = NULL;
	gboolean _tmp37_ = FALSE;
	gboolean _tmp38_ = FALSE;
	GUPnPDIDLLiteObject* _tmp39_ = NULL;
	const gchar* _tmp40_ = NULL;
	const gchar* _tmp41_ = NULL;
	GUPnPDIDLLiteObject* _tmp51_ = NULL;
	gboolean _tmp52_ = FALSE;
	gboolean _tmp53_ = FALSE;
	GUPnPDIDLLiteObject* _tmp56_ = NULL;
	const gchar* _tmp57_ = NULL;
	const gchar* _tmp58_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->didl_parser;
	g_signal_connect_object (_tmp0_, "object-available", (GCallback) ___lambda6__gupnp_didl_lite_parser_object_available, self, 0);
	{
		GUPnPDIDLLiteParser* _tmp1_ = NULL;
		const gchar* _tmp2_ = NULL;
		_tmp1_ = self->priv->didl_parser;
		_tmp2_ = self->priv->elements;
		gupnp_didl_lite_parser_parse_didl (_tmp1_, _tmp2_, &_inner_error_);
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch2_g_error;
		}
	}
	goto __finally2;
	__catch2_g_error:
	{
		GError* parse_err = NULL;
		GError* _tmp3_ = NULL;
		parse_err = _inner_error_;
		_inner_error_ = NULL;
		_tmp3_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, "Bad metadata");
		_inner_error_ = _tmp3_;
		_g_error_free0 (parse_err);
		goto __finally2;
	}
	__finally2:
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		return;
	}
	_tmp4_ = self->priv->didl_object;
	if (_tmp4_ == NULL) {
		gchar* message = NULL;
		const gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		const gchar* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		GError* _tmp9_ = NULL;
		_tmp5_ = _ ("No objects in DIDL-Lite from client: '%s'");
		_tmp6_ = g_strdup (_tmp5_);
		message = _tmp6_;
		_tmp7_ = message;
		_tmp8_ = self->priv->elements;
		_tmp9_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp7_, _tmp8_);
		_inner_error_ = _tmp9_;
		g_propagate_error (error, _inner_error_);
		_g_free0 (message);
		return;
	}
	_tmp11_ = self->priv->didl_object;
	_tmp12_ = gupnp_didl_lite_object_get_id (_tmp11_);
	_tmp13_ = _tmp12_;
	if (_tmp13_ == NULL) {
		_tmp10_ = TRUE;
	} else {
		GUPnPDIDLLiteObject* _tmp14_ = NULL;
		const gchar* _tmp15_ = NULL;
		const gchar* _tmp16_ = NULL;
		_tmp14_ = self->priv->didl_object;
		_tmp15_ = gupnp_didl_lite_object_get_id (_tmp14_);
		_tmp16_ = _tmp15_;
		_tmp10_ = g_strcmp0 (_tmp16_, "") != 0;
	}
	if (_tmp10_) {
		gchar* msg = NULL;
		const gchar* _tmp17_ = NULL;
		gchar* _tmp18_ = NULL;
		const gchar* _tmp19_ = NULL;
		GError* _tmp20_ = NULL;
		_tmp17_ = _ ("@id must be set to \"\" in CreateObject call");
		_tmp18_ = g_strdup (_tmp17_);
		msg = _tmp18_;
		_tmp19_ = msg;
		_tmp20_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp19_);
		_inner_error_ = _tmp20_;
		g_propagate_error (error, _inner_error_);
		_g_free0 (msg);
		return;
	}
	_tmp21_ = self->priv->didl_object;
	_tmp22_ = gupnp_didl_lite_object_get_title (_tmp21_);
	_tmp23_ = _tmp22_;
	if (_tmp23_ == NULL) {
		gchar* msg = NULL;
		const gchar* _tmp24_ = NULL;
		gchar* _tmp25_ = NULL;
		const gchar* _tmp26_ = NULL;
		GError* _tmp27_ = NULL;
		_tmp24_ = _ ("dc:title must not be empty in CreateObject call");
		_tmp25_ = g_strdup (_tmp24_);
		msg = _tmp25_;
		_tmp26_ = msg;
		_tmp27_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp26_);
		_inner_error_ = _tmp27_;
		g_propagate_error (error, _inner_error_);
		_g_free0 (msg);
		return;
	}
	_tmp29_ = self->priv->didl_object;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp29_, gupnp_didl_lite_item_get_type ())) {
		GUPnPDIDLLiteObject* _tmp30_ = NULL;
		GUPnPOCMFlags _tmp31_ = 0;
		GUPnPOCMFlags _tmp32_ = 0;
		_tmp30_ = self->priv->didl_object;
		_tmp31_ = gupnp_didl_lite_object_get_dlna_managed (_tmp30_);
		_tmp32_ = _tmp31_;
		_tmp28_ = (_tmp32_ & ((GUPNP_OCM_FLAGS_UPLOAD | GUPNP_OCM_FLAGS_CREATE_CONTAINER) | GUPNP_OCM_FLAGS_UPLOAD_DESTROYABLE)) != 0;
	} else {
		_tmp28_ = FALSE;
	}
	if (_tmp28_) {
		gchar* msg = NULL;
		const gchar* _tmp33_ = NULL;
		gchar* _tmp34_ = NULL;
		const gchar* _tmp35_ = NULL;
		GError* _tmp36_ = NULL;
		_tmp33_ = _ ("Flags that must not be set were found in 'dlnaManaged'");
		_tmp34_ = g_strdup (_tmp33_);
		msg = _tmp34_;
		_tmp35_ = msg;
		_tmp36_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp35_);
		_inner_error_ = _tmp36_;
		g_propagate_error (error, _inner_error_);
		_g_free0 (msg);
		return;
	}
	_tmp39_ = self->priv->didl_object;
	_tmp40_ = gupnp_didl_lite_object_get_upnp_class (_tmp39_);
	_tmp41_ = _tmp40_;
	if (_tmp41_ == NULL) {
		_tmp38_ = TRUE;
	} else {
		GUPnPDIDLLiteObject* _tmp42_ = NULL;
		const gchar* _tmp43_ = NULL;
		const gchar* _tmp44_ = NULL;
		_tmp42_ = self->priv->didl_object;
		_tmp43_ = gupnp_didl_lite_object_get_upnp_class (_tmp42_);
		_tmp44_ = _tmp43_;
		_tmp38_ = g_strcmp0 (_tmp44_, "") == 0;
	}
	if (_tmp38_) {
		_tmp37_ = TRUE;
	} else {
		GUPnPDIDLLiteObject* _tmp45_ = NULL;
		const gchar* _tmp46_ = NULL;
		const gchar* _tmp47_ = NULL;
		gboolean _tmp48_ = FALSE;
		_tmp45_ = self->priv->didl_object;
		_tmp46_ = gupnp_didl_lite_object_get_upnp_class (_tmp45_);
		_tmp47_ = _tmp46_;
		_tmp48_ = g_str_has_prefix (_tmp47_, "object");
		_tmp37_ = !_tmp48_;
	}
	if (_tmp37_) {
		const gchar* _tmp49_ = NULL;
		GError* _tmp50_ = NULL;
		_tmp49_ = _ ("Invalid upnp:class given in CreateObject");
		_tmp50_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp49_);
		_inner_error_ = _tmp50_;
		g_propagate_error (error, _inner_error_);
		return;
	}
	_tmp51_ = self->priv->didl_object;
	_tmp52_ = gupnp_didl_lite_object_get_restricted (_tmp51_);
	_tmp53_ = _tmp52_;
	if (_tmp53_) {
		const gchar* _tmp54_ = NULL;
		GError* _tmp55_ = NULL;
		_tmp54_ = _ ("Cannot create restricted item");
		_tmp55_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp54_);
		_inner_error_ = _tmp55_;
		g_propagate_error (error, _inner_error_);
		return;
	}
	_tmp56_ = self->priv->didl_object;
	_tmp57_ = gupnp_didl_lite_object_get_upnp_class (_tmp56_);
	_tmp58_ = _tmp57_;
	if (g_strcmp0 (_tmp58_, "object.item") == 0) {
		GList* resources = NULL;
		GUPnPDIDLLiteObject* _tmp59_ = NULL;
		GList* _tmp60_ = NULL;
		gboolean _tmp61_ = FALSE;
		GList* _tmp62_ = NULL;
		_tmp59_ = self->priv->didl_object;
		_tmp60_ = gupnp_didl_lite_object_get_resources (_tmp59_);
		resources = _tmp60_;
		_tmp62_ = resources;
		if (_tmp62_ != NULL) {
			GList* _tmp63_ = NULL;
			gconstpointer _tmp64_ = NULL;
			GUPnPProtocolInfo* _tmp65_ = NULL;
			GUPnPProtocolInfo* _tmp66_ = NULL;
			const gchar* _tmp67_ = NULL;
			const gchar* _tmp68_ = NULL;
			_tmp63_ = resources;
			_tmp64_ = _tmp63_->data;
			_tmp65_ = gupnp_didl_lite_resource_get_protocol_info ((GUPnPDIDLLiteResource*) _tmp64_);
			_tmp66_ = _tmp65_;
			_tmp67_ = gupnp_protocol_info_get_dlna_profile (_tmp66_);
			_tmp68_ = _tmp67_;
			_tmp61_ = g_strcmp0 (_tmp68_, "DIDL_S") == 0;
		} else {
			_tmp61_ = FALSE;
		}
		if (_tmp61_) {
			GUPnPDIDLLiteObject* _tmp69_ = NULL;
			_tmp69_ = self->priv->didl_object;
			gupnp_didl_lite_object_set_upnp_class (_tmp69_, RYGEL_PLAYLIST_ITEM_UPNP_CLASS);
		}
		__g_list_free__g_object_unref0_0 (resources);
	}
}


/**
     * Modify the give UPnP class to be a more general one.
     *
     * Used to simplify the search for a valid container in the
     * DLNA.ORG_AnyContainer use-case.
     * Example: object.item.videoItem.videoBroadcast → object.item.videoItem
     *
     * @param upnp_class the current UPnP class which will be modified in-place.
     */
static void rygel_object_creator_generalize_upnp_class (RygelObjectCreator* self, gchar** upnp_class) {
	gchar* needle = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gchar* _tmp2_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (*upnp_class != NULL);
	_tmp0_ = *upnp_class;
	_tmp1_ = g_strrstr_len (_tmp0_, (gssize) (-1), ".");
	needle = _tmp1_;
	_tmp2_ = needle;
	if (_tmp2_ != NULL) {
		gchar* _tmp3_ = NULL;
		gchar _tmp4_ = '\0';
		_tmp3_ = needle;
		*_tmp3_ = '\0';
		_tmp4_ = *_tmp3_;
	}
}


static void rygel_object_creator_build_create_class_expression_data_free (gpointer _data) {
	RygelObjectCreatorBuildCreateClassExpressionData* _data_;
	_data_ = _data;
	_rygel_search_expression_unref0 (_data_->expression);
	_rygel_search_expression_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelObjectCreatorBuildCreateClassExpressionData, _data_);
}


static gpointer _rygel_search_expression_ref0 (gpointer self) {
	return self ? rygel_search_expression_ref (self) : NULL;
}


static void rygel_object_creator_build_create_class_expression (RygelObjectCreator* self, RygelSearchExpression* expression, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelObjectCreatorBuildCreateClassExpressionData* _data_;
	RygelObjectCreator* _tmp0_ = NULL;
	RygelSearchExpression* _tmp1_ = NULL;
	RygelSearchExpression* _tmp2_ = NULL;
	_data_ = g_slice_new0 (RygelObjectCreatorBuildCreateClassExpressionData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_object_creator_build_create_class_expression);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_object_creator_build_create_class_expression_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = expression;
	_tmp2_ = _rygel_search_expression_ref0 (_tmp1_);
	_rygel_search_expression_unref0 (_data_->expression);
	_data_->expression = _tmp2_;
	rygel_object_creator_build_create_class_expression_co (_data_);
}


static RygelSearchExpression* rygel_object_creator_build_create_class_expression_finish (RygelObjectCreator* self, GAsyncResult* _res_) {
	RygelSearchExpression* result;
	RygelObjectCreatorBuildCreateClassExpressionData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
	result = _data_->result;
	_data_->result = NULL;
	return result;
}


static void _g_free0_ (gpointer var) {
	var = (g_free (var), NULL);
}


static void _g_list_free__g_free0_ (GList* self) {
	g_list_foreach (self, (GFunc) _g_free0_, NULL);
	g_list_free (self);
}


static void rygel_object_creator_build_create_class_expression_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelObjectCreatorBuildCreateClassExpressionData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_object_creator_build_create_class_expression_co (_data_);
}


static gboolean rygel_object_creator_build_create_class_expression_co (RygelObjectCreatorBuildCreateClassExpressionData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->self->priv->didl_object;
	if (!G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp0_, gupnp_didl_lite_container_get_type ())) {
		_data_->_tmp1_ = NULL;
		_data_->_tmp1_ = _data_->expression;
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = _rygel_search_expression_ref0 (_data_->_tmp1_);
		_data_->result = _data_->_tmp2_;
		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_->_tmp3_ = NULL;
	_data_->_tmp3_ = _data_->self->priv->didl_object;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp3_, gupnp_didl_lite_container_get_type ()) ? ((GUPnPDIDLLiteContainer*) _data_->_tmp3_) : NULL);
	_data_->didl_container = _data_->_tmp4_;
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = _data_->didl_container;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = gupnp_didl_lite_container_get_create_classes (_data_->_tmp5_);
	_data_->create_classes = _data_->_tmp6_;
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = _data_->create_classes;
	if (_data_->_tmp7_ == NULL) {
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = _data_->expression;
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = _rygel_search_expression_ref0 (_data_->_tmp8_);
		_data_->result = _data_->_tmp9_;
		__g_list_free__g_free0_0 (_data_->create_classes);
		_g_object_unref0 (_data_->didl_container);
		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_->_tmp10_ = NULL;
	_data_->_tmp10_ = g_string_new ("(");
	_data_->builder = _data_->_tmp10_;
	_data_->_tmp11_ = NULL;
	_data_->_tmp11_ = _data_->create_classes;
	{
		_data_->create_class_collection = _data_->_tmp11_;
		for (_data_->create_class_it = _data_->create_class_collection; _data_->create_class_it != NULL; _data_->create_class_it = _data_->create_class_it->next) {
			_data_->_tmp12_ = NULL;
			_data_->_tmp12_ = g_strdup ((const gchar*) _data_->create_class_it->data);
			_data_->create_class = _data_->_tmp12_;
			{
				_data_->_tmp13_ = NULL;
				_data_->_tmp13_ = _data_->builder;
				_data_->_tmp14_ = NULL;
				_data_->_tmp14_ = _data_->create_class;
				g_string_append_printf (_data_->_tmp13_, "(upnp:createClass derivedfrom \"%s\") AND", _data_->_tmp14_);
				_g_free0 (_data_->create_class);
			}
		}
	}
	_data_->_tmp15_ = NULL;
	_data_->_tmp15_ = _data_->builder;
	_data_->_tmp16_ = NULL;
	_data_->_tmp16_ = _data_->builder;
	_data_->_tmp17_ = 0L;
	_data_->_tmp17_ = _data_->_tmp16_->len;
	g_string_truncate (_data_->_tmp15_, (gsize) (_data_->_tmp17_ - 3));
	_data_->_tmp18_ = NULL;
	_data_->_tmp18_ = _data_->builder;
	g_string_append (_data_->_tmp18_, ")");
	{
		_data_->_tmp19_ = NULL;
		_data_->_tmp19_ = _data_->builder;
		_data_->_tmp20_ = NULL;
		_data_->_tmp20_ = _data_->_tmp19_->str;
		_data_->_tmp21_ = NULL;
		_data_->_tmp21_ = rygel_search_criteria_parser_new (_data_->_tmp20_, &_data_->_inner_error_);
		_data_->parser = _data_->_tmp21_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			goto __catch3_g_error;
		}
		_data_->_tmp22_ = NULL;
		_data_->_tmp22_ = _data_->parser;
		_data_->_state_ = 1;
		rygel_state_machine_run ((RygelStateMachine*) _data_->_tmp22_, rygel_object_creator_build_create_class_expression_ready, _data_);
		return FALSE;
		_state_1:
		rygel_state_machine_run_finish ((RygelStateMachine*) _data_->_tmp22_, _data_->_res_);
		_data_->_tmp23_ = NULL;
		_data_->_tmp23_ = rygel_logical_expression_new ();
		_data_->rel = _data_->_tmp23_;
		_data_->_tmp24_ = NULL;
		_data_->_tmp24_ = _data_->rel;
		_data_->_tmp25_ = NULL;
		_data_->_tmp25_ = _data_->expression;
		_data_->_tmp26_ = NULL;
		_data_->_tmp26_ = _rygel_search_expression_ref0 (_data_->_tmp25_);
		_rygel_search_expression_unref0 (((RygelSearchExpression*) _data_->_tmp24_)->operand1);
		((RygelSearchExpression*) _data_->_tmp24_)->operand1 = _data_->_tmp26_;
		_data_->_tmp27_ = NULL;
		_data_->_tmp27_ = _data_->rel;
		((RygelSearchExpression*) _data_->_tmp27_)->op = (gpointer) ((gintptr) RYGEL_LOGICAL_OPERATOR_AND);
		_data_->_tmp28_ = NULL;
		_data_->_tmp28_ = _data_->rel;
		_data_->_tmp29_ = NULL;
		_data_->_tmp29_ = _data_->parser;
		_data_->_tmp30_ = NULL;
		_data_->_tmp30_ = _data_->_tmp29_->expression;
		_data_->_tmp31_ = NULL;
		_data_->_tmp31_ = _rygel_search_expression_ref0 (_data_->_tmp30_);
		_rygel_search_expression_unref0 (((RygelSearchExpression*) _data_->_tmp28_)->operand2);
		((RygelSearchExpression*) _data_->_tmp28_)->operand2 = _data_->_tmp31_;
		_data_->result = (RygelSearchExpression*) _data_->rel;
		_g_object_unref0 (_data_->parser);
		_g_string_free0 (_data_->builder);
		__g_list_free__g_free0_0 (_data_->create_classes);
		_g_object_unref0 (_data_->didl_container);
		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;
	}
	goto __finally3;
	__catch3_g_error:
	{
		_data_->_error_ = _data_->_inner_error_;
		_data_->_inner_error_ = NULL;
		g_assert_not_reached ();
		_g_error_free0 (_data_->_error_);
	}
	__finally3:
	_g_string_free0 (_data_->builder);
	__g_list_free__g_free0_0 (_data_->create_classes);
	_g_object_unref0 (_data_->didl_container);
	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;
	_g_string_free0 (_data_->builder);
	__g_list_free__g_free0_0 (_data_->create_classes);
	_g_object_unref0 (_data_->didl_container);
	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 void rygel_object_creator_find_any_container_data_free (gpointer _data) {
	RygelObjectCreatorFindAnyContainerData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelObjectCreatorFindAnyContainerData, _data_);
}


static void rygel_object_creator_find_any_container (RygelObjectCreator* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelObjectCreatorFindAnyContainerData* _data_;
	RygelObjectCreator* _tmp0_ = NULL;
	_data_ = g_slice_new0 (RygelObjectCreatorFindAnyContainerData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_object_creator_find_any_container);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_object_creator_find_any_container_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_object_creator_find_any_container_co (_data_);
}


static RygelMediaObject* rygel_object_creator_find_any_container_finish (RygelObjectCreator* self, GAsyncResult* _res_, GError** error) {
	RygelMediaObject* result;
	RygelObjectCreatorFindAnyContainerData* _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;
}


/**
     * Find a container that can create items matching the UPnP class of the
     * requested item.
     *
     * If the item's UPnP class cannot be found, generalize the UPnP class until
     * we reach object.item according to DLNA guideline 7.3.120.4.
     *
     * @returns a container able to create the item or null if no such container
     *          can be found.
     */
static void rygel_object_creator_find_any_container_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelObjectCreatorFindAnyContainerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_object_creator_find_any_container_co (_data_);
}


static gboolean rygel_object_creator_find_any_container_co (RygelObjectCreatorFindAnyContainerData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->self->priv->content_dir;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->_tmp0_->root_container;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp1_, RYGEL_TYPE_SEARCHABLE_CONTAINER) ? ((RygelSearchableContainer*) _data_->_tmp1_) : NULL);
	_data_->root_container = _data_->_tmp2_;
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = _data_->root_container;
	if (_data_->_tmp3_ == NULL) {
		_data_->result = NULL;
		_g_object_unref0 (_data_->root_container);
		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_->_tmp4_ = NULL;
	_data_->_tmp4_ = _data_->self->priv->didl_object;
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = gupnp_didl_lite_object_get_upnp_class (_data_->_tmp4_);
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = _data_->_tmp5_;
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = g_strdup (_data_->_tmp6_);
	_data_->upnp_class = _data_->_tmp7_;
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = rygel_relational_expression_new ();
	_data_->expression = _data_->_tmp8_;
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = _data_->expression;
	((RygelSearchExpression*) _data_->_tmp9_)->op = (gpointer) ((gintptr) GUPNP_SEARCH_CRITERIA_OP_DERIVED_FROM);
	_data_->_tmp10_ = NULL;
	_data_->_tmp10_ = _data_->expression;
	_data_->_tmp11_ = NULL;
	_data_->_tmp11_ = g_strdup ("upnp:createClass");
	_g_free0 (((RygelSearchExpression*) _data_->_tmp10_)->operand1);
	((RygelSearchExpression*) _data_->_tmp10_)->operand1 = _data_->_tmp11_;
	_data_->_tmp12_ = NULL;
	_data_->_tmp12_ = _data_->expression;
	_data_->_state_ = 1;
	rygel_object_creator_build_create_class_expression (_data_->self, (RygelSearchExpression*) _data_->_tmp12_, rygel_object_creator_find_any_container_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp13_ = NULL;
	_data_->_tmp13_ = rygel_object_creator_build_create_class_expression_finish (_data_->self, _data_->_res_);
	_data_->search_expression = _data_->_tmp13_;
	while (TRUE) {
		_data_->_tmp14_ = NULL;
		_data_->_tmp14_ = _data_->upnp_class;
		if (!(g_strcmp0 (_data_->_tmp14_, "object") != 0)) {
			break;
		}
		_data_->_tmp15_ = NULL;
		_data_->_tmp15_ = _data_->expression;
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = _data_->upnp_class;
		_data_->_tmp17_ = NULL;
		_data_->_tmp17_ = g_strdup (_data_->_tmp16_);
		_g_free0 (((RygelSearchExpression*) _data_->_tmp15_)->operand2);
		((RygelSearchExpression*) _data_->_tmp15_)->operand2 = _data_->_tmp17_;
		_data_->_tmp18_ = NULL;
		_data_->_tmp18_ = _data_->root_container;
		_data_->_tmp19_ = NULL;
		_data_->_tmp19_ = _data_->search_expression;
		_data_->_tmp20_ = NULL;
		_data_->_tmp20_ = _data_->root_container;
		_data_->_tmp21_ = NULL;
		_data_->_tmp21_ = ((RygelMediaContainer*) _data_->_tmp20_)->sort_criteria;
		_data_->_tmp22_ = NULL;
		_data_->_tmp22_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
		_data_->_tmp23_ = NULL;
		_data_->_tmp23_ = _data_->_tmp22_;
		_data_->_tmp24_ = 0;
		_data_->_state_ = 2;
		rygel_searchable_container_search (_data_->_tmp18_, _data_->_tmp19_, 0, 1, _data_->_tmp21_, _data_->_tmp23_, rygel_object_creator_find_any_container_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp25_ = NULL;
		_data_->_tmp25_ = rygel_searchable_container_search_finish (_data_->_tmp18_, _data_->_res_, &_data_->_tmp24_);
		_data_->total_matches = (guint) _data_->_tmp24_;
		_data_->_result_ = _data_->_tmp25_;
		_data_->_tmp26_ = NULL;
		_data_->_tmp26_ = _data_->_result_;
		_data_->_tmp27_ = 0;
		_data_->_tmp27_ = gee_abstract_collection_get_size ((GeeCollection*) _data_->_tmp26_);
		_data_->_tmp28_ = 0;
		_data_->_tmp28_ = _data_->_tmp27_;
		if (_data_->_tmp28_ > 0) {
			_data_->_tmp29_ = NULL;
			_data_->_tmp29_ = _data_->self->priv->didl_object;
			_data_->_tmp30_ = NULL;
			_data_->_tmp30_ = _data_->upnp_class;
			gupnp_didl_lite_object_set_upnp_class (_data_->_tmp29_, _data_->_tmp30_);
			_data_->_tmp31_ = NULL;
			_data_->_tmp31_ = _data_->_result_;
			_data_->_tmp32_ = NULL;
			_data_->_tmp32_ = gee_abstract_list_get ((GeeAbstractList*) _data_->_tmp31_, 0);
			_data_->result = (RygelMediaObject*) _data_->_tmp32_;
			_g_object_unref0 (_data_->_result_);
			_rygel_search_expression_unref0 (_data_->search_expression);
			_rygel_search_expression_unref0 (_data_->expression);
			_g_free0 (_data_->upnp_class);
			_g_object_unref0 (_data_->root_container);
			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 {
			rygel_object_creator_generalize_upnp_class (_data_->self, &_data_->upnp_class);
		}
		_g_object_unref0 (_data_->_result_);
	}
	_data_->_tmp33_ = NULL;
	_data_->_tmp33_ = _data_->upnp_class;
	if (g_strcmp0 (_data_->_tmp33_, "object") == 0) {
		_data_->_tmp34_ = NULL;
		_data_->_tmp34_ = _ ("UPnP class '%s' not supported");
		_data_->_tmp35_ = NULL;
		_data_->_tmp35_ = _data_->self->priv->didl_object;
		_data_->_tmp36_ = NULL;
		_data_->_tmp36_ = gupnp_didl_lite_object_get_upnp_class (_data_->_tmp35_);
		_data_->_tmp37_ = NULL;
		_data_->_tmp37_ = _data_->_tmp36_;
		_data_->_tmp38_ = NULL;
		_data_->_tmp38_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _data_->_tmp34_, _data_->_tmp37_);
		_data_->_inner_error_ = _data_->_tmp38_;
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_rygel_search_expression_unref0 (_data_->search_expression);
		_rygel_search_expression_unref0 (_data_->expression);
		_g_free0 (_data_->upnp_class);
		_g_object_unref0 (_data_->root_container);
		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_->result = NULL;
	_rygel_search_expression_unref0 (_data_->search_expression);
	_rygel_search_expression_unref0 (_data_->expression);
	_g_free0 (_data_->upnp_class);
	_g_object_unref0 (_data_->root_container);
	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;
	_rygel_search_expression_unref0 (_data_->search_expression);
	_rygel_search_expression_unref0 (_data_->expression);
	_g_free0 (_data_->upnp_class);
	_g_object_unref0 (_data_->root_container);
	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 void rygel_object_creator_fetch_container_data_free (gpointer _data) {
	RygelObjectCreatorFetchContainerData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelObjectCreatorFetchContainerData, _data_);
}


static void rygel_object_creator_fetch_container (RygelObjectCreator* self, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelObjectCreatorFetchContainerData* _data_;
	RygelObjectCreator* _tmp0_ = NULL;
	_data_ = g_slice_new0 (RygelObjectCreatorFetchContainerData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_object_creator_fetch_container);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_object_creator_fetch_container_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	rygel_object_creator_fetch_container_co (_data_);
}


static RygelWritableContainer* rygel_object_creator_fetch_container_finish (RygelObjectCreator* self, GAsyncResult* _res_, GError** error) {
	RygelWritableContainer* result;
	RygelObjectCreatorFetchContainerData* _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;
}


/**
     * Get the container to create the item in.
     *
     * This will either try to fetch the container supplied by the caller or
     * search for a container if the caller supplied the "DLNA.ORG_AnyContainer"
     * id.
     *
     * @return an instance of WritableContainer matching the criteria
     * @throws ContentDirectoryError for various problems
     */
static void rygel_object_creator_fetch_container_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelObjectCreatorFetchContainerData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_object_creator_fetch_container_co (_data_);
}


static gboolean rygel_object_creator_fetch_container_co (RygelObjectCreatorFetchContainerData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->media_object = NULL;
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->self->priv->container_id;
	if (g_strcmp0 (_data_->_tmp0_, RYGEL_MEDIA_CONTAINER_ANY) == 0) {
		_data_->_state_ = 1;
		rygel_object_creator_find_any_container (_data_->self, rygel_object_creator_fetch_container_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp2_ = NULL;
		_data_->_tmp2_ = rygel_object_creator_find_any_container_finish (_data_->self, _data_->_res_, &_data_->_inner_error_);
		_data_->_tmp1_ = _data_->_tmp2_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->media_object);
			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_->_tmp3_ = NULL;
		_data_->_tmp3_ = _data_->_tmp1_;
		_data_->_tmp1_ = NULL;
		_g_object_unref0 (_data_->media_object);
		_data_->media_object = _data_->_tmp3_;
		_g_object_unref0 (_data_->_tmp1_);
	} else {
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _data_->self->priv->content_dir;
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = _data_->_tmp5_->root_container;
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = _data_->self->priv->container_id;
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = _data_->_tmp8_;
		_data_->_state_ = 2;
		rygel_media_object_find_object ((RygelMediaObject*) _data_->_tmp6_, _data_->_tmp7_, _data_->_tmp9_, rygel_object_creator_fetch_container_ready, _data_);
		return FALSE;
		_state_2:
		_data_->_tmp10_ = NULL;
		_data_->_tmp10_ = rygel_media_object_find_object_finish ((RygelMediaObject*) _data_->_tmp6_, _data_->_res_, &_data_->_inner_error_);
		_data_->_tmp4_ = _data_->_tmp10_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->media_object);
			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_->_tmp11_ = NULL;
		_data_->_tmp11_ = _data_->_tmp4_;
		_data_->_tmp4_ = NULL;
		_g_object_unref0 (_data_->media_object);
		_data_->media_object = _data_->_tmp11_;
		_g_object_unref0 (_data_->_tmp4_);
	}
	_data_->_tmp13_ = NULL;
	_data_->_tmp13_ = _data_->media_object;
	if (_data_->_tmp13_ == NULL) {
		_data_->_tmp12_ = TRUE;
	} else {
		_data_->_tmp14_ = NULL;
		_data_->_tmp14_ = _data_->media_object;
		_data_->_tmp12_ = !G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp14_, RYGEL_TYPE_MEDIA_CONTAINER);
	}
	if (_data_->_tmp12_) {
		_data_->_tmp15_ = NULL;
		_data_->_tmp15_ = _ ("No such container");
		_data_->_tmp16_ = NULL;
		_data_->_tmp16_ = g_error_new_literal (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_NO_SUCH_CONTAINER, _data_->_tmp15_);
		_data_->_inner_error_ = _data_->_tmp16_;
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->media_object);
		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_->_tmp17_ = NULL;
	_data_->_tmp17_ = _data_->media_object;
	if (!G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp17_, RYGEL_TYPE_WRITABLE_CONTAINER)) {
		_data_->_tmp18_ = NULL;
		_data_->_tmp18_ = _ ("Object creation in %s not allowed");
		_data_->_tmp19_ = NULL;
		_data_->_tmp19_ = _data_->media_object;
		_data_->_tmp20_ = NULL;
		_data_->_tmp20_ = rygel_media_object_get_id (_data_->_tmp19_);
		_data_->_tmp21_ = NULL;
		_data_->_tmp21_ = _data_->_tmp20_;
		_data_->_tmp22_ = NULL;
		_data_->_tmp22_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_PARENT, _data_->_tmp18_, _data_->_tmp21_);
		_data_->_inner_error_ = _data_->_tmp22_;
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->media_object);
		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_->_tmp25_ = NULL;
	_data_->_tmp25_ = _data_->self->priv->didl_object;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp25_, gupnp_didl_lite_item_get_type ())) {
		_data_->_tmp26_ = NULL;
		_data_->_tmp26_ = _data_->media_object;
		_data_->_tmp27_ = 0;
		_data_->_tmp27_ = _data_->_tmp26_->ocm_flags;
		_data_->_tmp24_ = (_data_->_tmp27_ & GUPNP_OCM_FLAGS_UPLOAD) == GUPNP_OCM_FLAGS_UPLOAD;
	} else {
		_data_->_tmp24_ = FALSE;
	}
	if (_data_->_tmp24_) {
		_data_->_tmp23_ = TRUE;
	} else {
		_data_->_tmp29_ = NULL;
		_data_->_tmp29_ = _data_->self->priv->didl_object;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp29_, gupnp_didl_lite_container_get_type ())) {
			_data_->_tmp30_ = NULL;
			_data_->_tmp30_ = _data_->media_object;
			_data_->_tmp31_ = 0;
			_data_->_tmp31_ = _data_->_tmp30_->ocm_flags;
			_data_->_tmp28_ = (_data_->_tmp31_ & GUPNP_OCM_FLAGS_CREATE_CONTAINER) == GUPNP_OCM_FLAGS_CREATE_CONTAINER;
		} else {
			_data_->_tmp28_ = FALSE;
		}
		_data_->_tmp23_ = _data_->_tmp28_;
	}
	if (!_data_->_tmp23_) {
		_data_->_tmp32_ = NULL;
		_data_->_tmp32_ = _ ("Object creation in %s not allowed");
		_data_->_tmp33_ = NULL;
		_data_->_tmp33_ = _data_->media_object;
		_data_->_tmp34_ = NULL;
		_data_->_tmp34_ = rygel_media_object_get_id (_data_->_tmp33_);
		_data_->_tmp35_ = NULL;
		_data_->_tmp35_ = _data_->_tmp34_;
		_data_->_tmp36_ = NULL;
		_data_->_tmp36_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_PARENT, _data_->_tmp32_, _data_->_tmp35_);
		_data_->_inner_error_ = _data_->_tmp36_;
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->media_object);
		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_->_tmp37_ = NULL;
	_data_->_tmp37_ = _data_->media_object;
	_data_->_tmp38_ = NULL;
	_data_->_tmp38_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp37_, RYGEL_TYPE_WRITABLE_CONTAINER) ? ((RygelWritableContainer*) _data_->_tmp37_) : NULL);
	_data_->result = _data_->_tmp38_;
	_g_object_unref0 (_data_->media_object);
	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_object_unref0 (_data_->media_object);
	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 void rygel_object_creator_conclude (RygelObjectCreator* self) {
	gchar* didl = NULL;
	RygelSerializer* _tmp0_ = NULL;
	gchar* _tmp1_ = NULL;
	RygelServiceAction* _tmp2_ = NULL;
	RygelMediaObject* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	RygelServiceAction* _tmp6_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->serializer;
	_tmp1_ = rygel_serializer_get_string (_tmp0_);
	didl = _tmp1_;
	_tmp2_ = self->priv->action;
	_tmp3_ = self->priv->object;
	_tmp4_ = rygel_media_object_get_id (_tmp3_);
	_tmp5_ = _tmp4_;
	rygel_service_action_set (_tmp2_, "ObjectID", G_TYPE_STRING, _tmp5_, "Result", G_TYPE_STRING, didl);
	_tmp6_ = self->priv->action;
	rygel_service_action_return (_tmp6_);
	g_signal_emit_by_name ((RygelStateMachine*) self, "completed");
	_g_free0 (didl);
}


static gboolean rygel_object_creator_validate_create_class (RygelObjectCreator* self, RygelWritableContainer* container) {
	gboolean result = FALSE;
	GUPnPDIDLLiteContainer* didl_cont = NULL;
	GUPnPDIDLLiteObject* _tmp0_ = NULL;
	GUPnPDIDLLiteContainer* _tmp1_ = NULL;
	GList* create_classes = NULL;
	GUPnPDIDLLiteContainer* _tmp2_ = NULL;
	GList* _tmp3_ = NULL;
	GList* _tmp4_ = NULL;
	GList* _tmp5_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (container != NULL, FALSE);
	_tmp0_ = self->priv->didl_object;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gupnp_didl_lite_container_get_type ()) ? ((GUPnPDIDLLiteContainer*) _tmp0_) : NULL);
	didl_cont = _tmp1_;
	_tmp2_ = didl_cont;
	_tmp3_ = gupnp_didl_lite_container_get_create_classes (_tmp2_);
	create_classes = _tmp3_;
	_tmp4_ = create_classes;
	if (_tmp4_ == NULL) {
		result = TRUE;
		__g_list_free__g_free0_0 (create_classes);
		_g_object_unref0 (didl_cont);
		return result;
	}
	_tmp5_ = create_classes;
	{
		GList* create_class_collection = NULL;
		GList* create_class_it = NULL;
		create_class_collection = _tmp5_;
		for (create_class_it = create_class_collection; create_class_it != NULL; create_class_it = create_class_it->next) {
			gchar* _tmp6_ = NULL;
			gchar* create_class = NULL;
			_tmp6_ = g_strdup ((const gchar*) create_class_it->data);
			create_class = _tmp6_;
			{
				RygelWritableContainer* _tmp7_ = NULL;
				const gchar* _tmp8_ = NULL;
				gboolean _tmp9_ = FALSE;
				_tmp7_ = container;
				_tmp8_ = create_class;
				_tmp9_ = rygel_writable_container_can_create (_tmp7_, _tmp8_);
				if (!_tmp9_) {
					result = FALSE;
					_g_free0 (create_class);
					__g_list_free__g_free0_0 (create_classes);
					_g_object_unref0 (didl_cont);
					return result;
				}
				_g_free0 (create_class);
			}
		}
	}
	result = TRUE;
	__g_list_free__g_free0_0 (create_classes);
	_g_object_unref0 (didl_cont);
	return result;
}


static void rygel_object_creator_handle_error (RygelObjectCreator* self, GError* _error_) {
	GError* _tmp0_ = NULL;
	const gchar* _tmp9_ = NULL;
	const gchar* _tmp10_ = NULL;
	GError* _tmp11_ = NULL;
	const gchar* _tmp12_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = _error_;
	if (_tmp0_->domain == RYGEL_CONTENT_DIRECTORY_ERROR) {
		RygelServiceAction* _tmp1_ = NULL;
		GError* _tmp2_ = NULL;
		gint _tmp3_ = 0;
		GError* _tmp4_ = NULL;
		const gchar* _tmp5_ = NULL;
		_tmp1_ = self->priv->action;
		_tmp2_ = _error_;
		_tmp3_ = _tmp2_->code;
		_tmp4_ = _error_;
		_tmp5_ = _tmp4_->message;
		rygel_service_action_return_error (_tmp1_, _tmp3_, _tmp5_);
	} else {
		RygelServiceAction* _tmp6_ = NULL;
		GError* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		_tmp6_ = self->priv->action;
		_tmp7_ = _error_;
		_tmp8_ = _tmp7_->message;
		rygel_service_action_return_error (_tmp6_, 701, _tmp8_);
	}
	_tmp9_ = _ ("Failed to create item under '%s': %s");
	_tmp10_ = self->priv->container_id;
	_tmp11_ = _error_;
	_tmp12_ = _tmp11_->message;
	g_warning (_tmp9_, _tmp10_, _tmp12_);
	g_signal_emit_by_name ((RygelStateMachine*) self, "completed");
}


static gchar* rygel_object_creator_get_generic_mime_type (RygelObjectCreator* self) {
	gchar* result = NULL;
	RygelMediaObject* _tmp0_ = NULL;
	RygelMediaItem* item = NULL;
	RygelMediaObject* _tmp2_ = NULL;
	RygelMediaItem* _tmp3_ = NULL;
	RygelMediaItem* _tmp4_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->object;
	if (!G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, RYGEL_TYPE_MEDIA_ITEM)) {
		gchar* _tmp1_ = NULL;
		_tmp1_ = g_strdup ("");
		result = _tmp1_;
		return result;
	}
	_tmp2_ = self->priv->object;
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _tmp2_) : NULL);
	item = _tmp3_;
	_tmp4_ = item;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp4_, RYGEL_TYPE_IMAGE_ITEM)) {
		gchar* _tmp5_ = NULL;
		_tmp5_ = g_strdup ("image");
		result = _tmp5_;
		_g_object_unref0 (item);
		return result;
	} else {
		RygelMediaItem* _tmp6_ = NULL;
		_tmp6_ = item;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_tmp6_, RYGEL_TYPE_VIDEO_ITEM)) {
			gchar* _tmp7_ = NULL;
			_tmp7_ = g_strdup ("video");
			result = _tmp7_;
			_g_object_unref0 (item);
			return result;
		} else {
			gchar* _tmp8_ = NULL;
			_tmp8_ = g_strdup ("audio");
			result = _tmp8_;
			_g_object_unref0 (item);
			return result;
		}
	}
	_g_object_unref0 (item);
}


static void rygel_object_creator_create_object_from_didl_data_free (gpointer _data) {
	RygelObjectCreatorCreateObjectFromDidlData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->container);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelObjectCreatorCreateObjectFromDidlData, _data_);
}


static void rygel_object_creator_create_object_from_didl (RygelObjectCreator* self, RygelWritableContainer* container, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelObjectCreatorCreateObjectFromDidlData* _data_;
	RygelObjectCreator* _tmp0_ = NULL;
	RygelWritableContainer* _tmp1_ = NULL;
	RygelWritableContainer* _tmp2_ = NULL;
	_data_ = g_slice_new0 (RygelObjectCreatorCreateObjectFromDidlData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_object_creator_create_object_from_didl);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_object_creator_create_object_from_didl_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = container;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->container);
	_data_->container = _tmp2_;
	rygel_object_creator_create_object_from_didl_co (_data_);
}


static void rygel_object_creator_create_object_from_didl_finish (RygelObjectCreator* self, GAsyncResult* _res_, GError** error) {
	RygelObjectCreatorCreateObjectFromDidlData* _data_;
	if (g_simple_async_result_propagate_error (G_SIMPLE_ASYNC_RESULT (_res_), error)) {
		return;
	}
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


/**
     * Transfer information passed by caller to a MediaObject.
     *
     * WritableContainer works on MediaObject so we transfer the supplied data
     * to one. Additionally some checks are performed (e.g. whether the DLNA
     * profile is supported or not) or sanitize the supplied title for use as
     * part of the on-disk filename.
     *
     * This function fills ObjectCreator.object.
     */
static void rygel_object_creator_create_object_from_didl_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelObjectCreatorCreateObjectFromDidlData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_object_creator_create_object_from_didl_co (_data_);
}


static gboolean rygel_object_creator_create_object_from_didl_co (RygelObjectCreatorCreateObjectFromDidlData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->self->priv->didl_object;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = gupnp_didl_lite_object_get_id (_data_->_tmp1_);
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = _data_->_tmp2_;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = _data_->container;
	_data_->_tmp5_ = NULL;
	_data_->_tmp5_ = _data_->self->priv->didl_object;
	_data_->_tmp6_ = NULL;
	_data_->_tmp6_ = gupnp_didl_lite_object_get_title (_data_->_tmp5_);
	_data_->_tmp7_ = NULL;
	_data_->_tmp7_ = _data_->_tmp6_;
	_data_->_tmp8_ = NULL;
	_data_->_tmp8_ = _data_->self->priv->didl_object;
	_data_->_tmp9_ = NULL;
	_data_->_tmp9_ = gupnp_didl_lite_object_get_upnp_class (_data_->_tmp8_);
	_data_->_tmp10_ = NULL;
	_data_->_tmp10_ = _data_->_tmp9_;
	_data_->_tmp11_ = NULL;
	_data_->_tmp11_ = rygel_object_creator_create_object (_data_->self, _data_->_tmp3_, _data_->_tmp4_, _data_->_tmp7_, _data_->_tmp10_, &_data_->_inner_error_);
	_data_->_tmp0_ = _data_->_tmp11_;
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		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_->_tmp12_ = NULL;
	_data_->_tmp12_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_g_object_unref0 (_data_->self->priv->object);
	_data_->self->priv->object = _data_->_tmp12_;
	_data_->_tmp13_ = NULL;
	_data_->_tmp13_ = _data_->self->priv->object;
	_data_->_tmp14_ = NULL;
	_data_->_tmp14_ = _data_->self->priv->didl_object;
	rygel_media_object_apply_didl_lite (_data_->_tmp13_, _data_->_tmp14_);
	_data_->_tmp15_ = NULL;
	_data_->_tmp15_ = _data_->self->priv->object;
	if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp15_, RYGEL_TYPE_MEDIA_ITEM)) {
		rygel_object_creator_extract_item_parameters (_data_->self, &_data_->_inner_error_);
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->_tmp0_);
			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_->_tmp16_ = NULL;
	_data_->_tmp16_ = _data_->self->priv->object;
	_data_->_tmp17_ = NULL;
	_data_->_tmp17_ = rygel_media_object_get_uris (_data_->_tmp16_);
	_data_->_tmp18_ = NULL;
	_data_->_tmp18_ = _data_->_tmp17_;
	_data_->_tmp19_ = FALSE;
	_data_->_tmp19_ = gee_collection_get_is_empty ((GeeCollection*) _data_->_tmp18_);
	_data_->_tmp20_ = FALSE;
	_data_->_tmp20_ = _data_->_tmp19_;
	_data_->_tmp21_ = FALSE;
	_data_->_tmp21_ = _data_->_tmp20_;
	_g_object_unref0 (_data_->_tmp18_);
	if (_data_->_tmp21_) {
		_data_->_tmp22_ = NULL;
		_data_->_tmp22_ = _data_->container;
		_data_->_tmp23_ = NULL;
		_data_->_tmp23_ = _data_->self->priv->object;
		_data_->_tmp24_ = NULL;
		_data_->_tmp24_ = rygel_media_object_get_title (_data_->_tmp23_);
		_data_->_tmp25_ = NULL;
		_data_->_tmp25_ = _data_->_tmp24_;
		_data_->_state_ = 1;
		rygel_object_creator_create_uri (_data_->self, _data_->_tmp22_, _data_->_tmp25_, rygel_object_creator_create_object_from_didl_ready, _data_);
		return FALSE;
		_state_1:
		_data_->_tmp26_ = NULL;
		_data_->_tmp26_ = rygel_object_creator_create_uri_finish (_data_->self, _data_->_res_, &_data_->_inner_error_);
		_data_->uri = _data_->_tmp26_;
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
			g_error_free (_data_->_inner_error_);
			_g_object_unref0 (_data_->_tmp0_);
			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_->_tmp27_ = NULL;
		_data_->_tmp27_ = _data_->self->priv->object;
		_data_->_tmp28_ = NULL;
		_data_->_tmp28_ = _data_->uri;
		rygel_media_object_add_uri (_data_->_tmp27_, _data_->_tmp28_);
		_data_->_tmp29_ = NULL;
		_data_->_tmp29_ = _data_->self->priv->object;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp29_, RYGEL_TYPE_MEDIA_ITEM)) {
			_data_->_tmp30_ = NULL;
			_data_->_tmp30_ = _data_->self->priv->object;
			(G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp30_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _data_->_tmp30_) : NULL)->place_holder = TRUE;
		}
		_g_free0 (_data_->uri);
	} else {
		_data_->_tmp31_ = NULL;
		_data_->_tmp31_ = _data_->self->priv->object;
		if (G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp31_, RYGEL_TYPE_MEDIA_ITEM)) {
			_data_->_tmp32_ = NULL;
			_data_->_tmp32_ = _data_->self->priv->object;
			_data_->_tmp33_ = NULL;
			_data_->_tmp33_ = rygel_media_object_get_primary_uri (_data_->_tmp32_);
			_data_->_tmp34_ = NULL;
			_data_->_tmp34_ = _data_->_tmp33_;
			_data_->_tmp35_ = NULL;
			_data_->_tmp35_ = g_file_new_for_uri (_data_->_tmp34_);
			_data_->_tmp36_ = NULL;
			_data_->_tmp36_ = _data_->_tmp35_;
			_g_free0 (_data_->_tmp34_);
			_data_->file = _data_->_tmp36_;
			_data_->_tmp37_ = NULL;
			_data_->_tmp37_ = _data_->self->priv->object;
			_data_->_tmp38_ = NULL;
			_data_->_tmp38_ = _data_->file;
			_data_->_tmp39_ = FALSE;
			_data_->_tmp39_ = g_file_is_native (_data_->_tmp38_);
			(G_TYPE_CHECK_INSTANCE_TYPE (_data_->_tmp37_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _data_->_tmp37_) : NULL)->place_holder = !_data_->_tmp39_;
			_g_object_unref0 (_data_->file);
		}
	}
	_data_->_tmp40_ = NULL;
	_data_->_tmp40_ = _data_->self->priv->object;
	_data_->_tmp41_ = NULL;
	_data_->_tmp41_ = _data_->self->priv->object;
	_data_->_tmp42_ = NULL;
	_data_->_tmp42_ = rygel_media_object_get_primary_uri (_data_->_tmp41_);
	_data_->_tmp43_ = NULL;
	_data_->_tmp43_ = _data_->_tmp42_;
	rygel_media_object_set_id (_data_->_tmp40_, _data_->_tmp43_);
	_g_free0 (_data_->_tmp43_);
	rygel_object_creator_parse_and_verify_didl_date (_data_->self, &_data_->_inner_error_);
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->_tmp0_);
		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_object_unref0 (_data_->_tmp0_);
	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 void rygel_object_creator_extract_item_parameters (RygelObjectCreator* self, GError** error) {
	RygelMediaItem* item = NULL;
	RygelMediaObject* _tmp0_ = NULL;
	RygelMediaItem* _tmp1_ = NULL;
	GUPnPDIDLLiteObject* _tmp2_ = NULL;
	GList* _tmp3_ = NULL;
	RygelMediaItem* _tmp51_ = NULL;
	const gchar* _tmp52_ = NULL;
	RygelMediaItem* _tmp55_ = NULL;
	glong _tmp56_ = 0L;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->object;
	_tmp1_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _tmp0_) : NULL);
	item = _tmp1_;
	_tmp2_ = self->priv->didl_object;
	_tmp3_ = gupnp_didl_lite_object_get_resources (_tmp2_);
	{
		GList* resource_collection = NULL;
		GList* resource_it = NULL;
		resource_collection = _tmp3_;
		for (resource_it = resource_collection; resource_it != NULL; resource_it = resource_it->next) {
			GUPnPDIDLLiteResource* _tmp4_ = NULL;
			GUPnPDIDLLiteResource* resource = NULL;
			_tmp4_ = _g_object_ref0 ((GUPnPDIDLLiteResource*) resource_it->data);
			resource = _tmp4_;
			{
				GUPnPProtocolInfo* info = NULL;
				GUPnPDIDLLiteResource* _tmp5_ = NULL;
				GUPnPProtocolInfo* _tmp6_ = NULL;
				GUPnPProtocolInfo* _tmp7_ = NULL;
				GUPnPProtocolInfo* _tmp8_ = NULL;
				GUPnPProtocolInfo* _tmp9_ = NULL;
				gchar* sanitized_uri = NULL;
				GUPnPDIDLLiteResource* _tmp37_ = NULL;
				const gchar* _tmp38_ = NULL;
				const gchar* _tmp39_ = NULL;
				gchar* _tmp40_ = NULL;
				gboolean _tmp41_ = FALSE;
				GUPnPDIDLLiteResource* _tmp44_ = NULL;
				glong _tmp45_ = 0L;
				glong _tmp46_ = 0L;
				_tmp5_ = resource;
				_tmp6_ = gupnp_didl_lite_resource_get_protocol_info (_tmp5_);
				_tmp7_ = _tmp6_;
				_tmp8_ = _g_object_ref0 (_tmp7_);
				info = _tmp8_;
				_tmp9_ = info;
				if (_tmp9_ != NULL) {
					GUPnPProtocolInfo* _tmp10_ = NULL;
					const gchar* _tmp11_ = NULL;
					const gchar* _tmp12_ = NULL;
					GUPnPProtocolInfo* _tmp29_ = NULL;
					const gchar* _tmp30_ = NULL;
					const gchar* _tmp31_ = NULL;
					_tmp10_ = info;
					_tmp11_ = gupnp_protocol_info_get_dlna_profile (_tmp10_);
					_tmp12_ = _tmp11_;
					if (_tmp12_ != NULL) {
						GUPnPProtocolInfo* _tmp13_ = NULL;
						const gchar* _tmp14_ = NULL;
						const gchar* _tmp15_ = NULL;
						gboolean _tmp16_ = FALSE;
						RygelMediaItem* _tmp24_ = NULL;
						GUPnPProtocolInfo* _tmp25_ = NULL;
						const gchar* _tmp26_ = NULL;
						const gchar* _tmp27_ = NULL;
						gchar* _tmp28_ = NULL;
						_tmp13_ = info;
						_tmp14_ = gupnp_protocol_info_get_dlna_profile (_tmp13_);
						_tmp15_ = _tmp14_;
						_tmp16_ = rygel_object_creator_is_profile_valid (self, _tmp15_);
						if (!_tmp16_) {
							gchar* msg = NULL;
							const gchar* _tmp17_ = NULL;
							gchar* _tmp18_ = NULL;
							const gchar* _tmp19_ = NULL;
							GUPnPProtocolInfo* _tmp20_ = NULL;
							const gchar* _tmp21_ = NULL;
							const gchar* _tmp22_ = NULL;
							GError* _tmp23_ = NULL;
							_tmp17_ = _ ("DLNA profile '%s' not supported");
							_tmp18_ = g_strdup (_tmp17_);
							msg = _tmp18_;
							_tmp19_ = msg;
							_tmp20_ = info;
							_tmp21_ = gupnp_protocol_info_get_dlna_profile (_tmp20_);
							_tmp22_ = _tmp21_;
							_tmp23_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp19_, _tmp22_);
							_inner_error_ = _tmp23_;
							g_propagate_error (error, _inner_error_);
							_g_free0 (msg);
							_g_object_unref0 (info);
							_g_object_unref0 (resource);
							__g_list_free__g_object_unref0_0 (resource_collection);
							_g_object_unref0 (item);
							return;
						}
						_tmp24_ = item;
						_tmp25_ = info;
						_tmp26_ = gupnp_protocol_info_get_dlna_profile (_tmp25_);
						_tmp27_ = _tmp26_;
						_tmp28_ = g_strdup (_tmp27_);
						_g_free0 (_tmp24_->dlna_profile);
						_tmp24_->dlna_profile = _tmp28_;
					}
					_tmp29_ = info;
					_tmp30_ = gupnp_protocol_info_get_mime_type (_tmp29_);
					_tmp31_ = _tmp30_;
					if (_tmp31_ != NULL) {
						RygelMediaItem* _tmp32_ = NULL;
						GUPnPProtocolInfo* _tmp33_ = NULL;
						const gchar* _tmp34_ = NULL;
						const gchar* _tmp35_ = NULL;
						gchar* _tmp36_ = NULL;
						_tmp32_ = item;
						_tmp33_ = info;
						_tmp34_ = gupnp_protocol_info_get_mime_type (_tmp33_);
						_tmp35_ = _tmp34_;
						_tmp36_ = g_strdup (_tmp35_);
						_g_free0 (_tmp32_->mime_type);
						_tmp32_->mime_type = _tmp36_;
					}
				}
				sanitized_uri = NULL;
				_tmp37_ = resource;
				_tmp38_ = gupnp_didl_lite_resource_get_uri (_tmp37_);
				_tmp39_ = _tmp38_;
				_tmp41_ = rygel_object_creator_is_valid_uri (self, _tmp39_, &_tmp40_);
				_g_free0 (sanitized_uri);
				sanitized_uri = _tmp40_;
				if (_tmp41_) {
					RygelMediaItem* _tmp42_ = NULL;
					const gchar* _tmp43_ = NULL;
					_tmp42_ = item;
					_tmp43_ = sanitized_uri;
					rygel_media_object_add_uri ((RygelMediaObject*) _tmp42_, _tmp43_);
				}
				_tmp44_ = resource;
				_tmp45_ = gupnp_didl_lite_resource_get_size (_tmp44_);
				_tmp46_ = _tmp45_;
				if (_tmp46_ >= ((glong) 0)) {
					RygelMediaItem* _tmp47_ = NULL;
					GUPnPDIDLLiteResource* _tmp48_ = NULL;
					glong _tmp49_ = 0L;
					glong _tmp50_ = 0L;
					_tmp47_ = item;
					_tmp48_ = resource;
					_tmp49_ = gupnp_didl_lite_resource_get_size (_tmp48_);
					_tmp50_ = _tmp49_;
					_tmp47_->size = _tmp50_;
				}
				_g_free0 (sanitized_uri);
				_g_object_unref0 (info);
				_g_object_unref0 (resource);
			}
		}
		__g_list_free__g_object_unref0_0 (resource_collection);
	}
	_tmp51_ = item;
	_tmp52_ = _tmp51_->mime_type;
	if (_tmp52_ == NULL) {
		RygelMediaItem* _tmp53_ = NULL;
		gchar* _tmp54_ = NULL;
		_tmp53_ = item;
		_tmp54_ = rygel_object_creator_get_generic_mime_type (self);
		_g_free0 (_tmp53_->mime_type);
		_tmp53_->mime_type = _tmp54_;
	}
	_tmp55_ = item;
	_tmp56_ = _tmp55_->size;
	if (_tmp56_ < ((glong) 0)) {
		RygelMediaItem* _tmp57_ = NULL;
		_tmp57_ = item;
		_tmp57_->size = (glong) 0;
	}
	_g_object_unref0 (item);
}


static void _vala_SoupDate_free (SoupDate* self) {
	g_boxed_free (soup_date_get_type (), self);
}


static void rygel_object_creator_parse_and_verify_didl_date (RygelObjectCreator* self, GError** error) {
	GUPnPDIDLLiteObject* _tmp0_ = NULL;
	GUPnPDIDLLiteItem* didl_item = NULL;
	GUPnPDIDLLiteObject* _tmp1_ = NULL;
	GUPnPDIDLLiteItem* _tmp2_ = NULL;
	GUPnPDIDLLiteItem* _tmp3_ = NULL;
	const gchar* _tmp4_ = NULL;
	const gchar* _tmp5_ = NULL;
	SoupDate* parsed_date = NULL;
	GUPnPDIDLLiteItem* _tmp6_ = NULL;
	const gchar* _tmp7_ = NULL;
	const gchar* _tmp8_ = NULL;
	SoupDate* _tmp9_ = NULL;
	SoupDate* _tmp10_ = NULL;
	gint year = 0;
	gint month = 0;
	gint day = 0;
	GUPnPDIDLLiteItem* _tmp14_ = NULL;
	const gchar* _tmp15_ = NULL;
	const gchar* _tmp16_ = NULL;
	gint _tmp17_ = 0;
	GDate date = {0};
	gint _tmp23_ = 0;
	gint _tmp24_ = 0;
	gint _tmp25_ = 0;
	gboolean _tmp26_ = FALSE;
	RygelMediaObject* _tmp32_ = NULL;
	GUPnPDIDLLiteItem* _tmp33_ = NULL;
	const gchar* _tmp34_ = NULL;
	const gchar* _tmp35_ = NULL;
	gchar* _tmp36_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_if_fail (self != NULL);
	_tmp0_ = self->priv->didl_object;
	if (!G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, gupnp_didl_lite_item_get_type ())) {
		return;
	}
	_tmp1_ = self->priv->didl_object;
	_tmp2_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp1_, gupnp_didl_lite_item_get_type ()) ? ((GUPnPDIDLLiteItem*) _tmp1_) : NULL);
	didl_item = _tmp2_;
	_tmp3_ = didl_item;
	_tmp4_ = gupnp_didl_lite_object_get_date ((GUPnPDIDLLiteObject*) _tmp3_);
	_tmp5_ = _tmp4_;
	if (_tmp5_ == NULL) {
		_g_object_unref0 (didl_item);
		return;
	}
	_tmp6_ = didl_item;
	_tmp7_ = gupnp_didl_lite_object_get_date ((GUPnPDIDLLiteObject*) _tmp6_);
	_tmp8_ = _tmp7_;
	_tmp9_ = soup_date_new_from_string (_tmp8_);
	parsed_date = _tmp9_;
	_tmp10_ = parsed_date;
	if (_tmp10_ != NULL) {
		RygelMediaObject* _tmp11_ = NULL;
		SoupDate* _tmp12_ = NULL;
		gchar* _tmp13_ = NULL;
		_tmp11_ = self->priv->object;
		_tmp12_ = parsed_date;
		_tmp13_ = soup_date_to_string (_tmp12_, SOUP_DATE_ISO8601);
		_g_free0 ((G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _tmp11_) : NULL)->date);
		(G_TYPE_CHECK_INSTANCE_TYPE (_tmp11_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _tmp11_) : NULL)->date = _tmp13_;
		__vala_SoupDate_free0 (parsed_date);
		_g_object_unref0 (didl_item);
		return;
	}
	year = 0;
	month = 0;
	day = 0;
	_tmp14_ = didl_item;
	_tmp15_ = gupnp_didl_lite_object_get_date ((GUPnPDIDLLiteObject*) _tmp14_);
	_tmp16_ = _tmp15_;
	_tmp17_ = sscanf (_tmp16_, "%4d-%02d-%02d", &year, &month, &day);
	if (_tmp17_ != 3) {
		const gchar* _tmp18_ = NULL;
		GUPnPDIDLLiteItem* _tmp19_ = NULL;
		const gchar* _tmp20_ = NULL;
		const gchar* _tmp21_ = NULL;
		GError* _tmp22_ = NULL;
		_tmp18_ = _ ("Invalid date format: %s");
		_tmp19_ = didl_item;
		_tmp20_ = gupnp_didl_lite_object_get_date ((GUPnPDIDLLiteObject*) _tmp19_);
		_tmp21_ = _tmp20_;
		_tmp22_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp18_, _tmp21_);
		_inner_error_ = _tmp22_;
		g_propagate_error (error, _inner_error_);
		__vala_SoupDate_free0 (parsed_date);
		_g_object_unref0 (didl_item);
		return;
	}
	memset (&date, 0, sizeof (GDate));
	_tmp23_ = day;
	_tmp24_ = month;
	_tmp25_ = year;
	g_date_set_dmy (&date, (GDateDay) _tmp23_, (gint) ((GDateMonth) _tmp24_), (GDateYear) _tmp25_);
	_tmp26_ = g_date_valid (&date);
	if (!_tmp26_) {
		const gchar* _tmp27_ = NULL;
		GUPnPDIDLLiteItem* _tmp28_ = NULL;
		const gchar* _tmp29_ = NULL;
		const gchar* _tmp30_ = NULL;
		GError* _tmp31_ = NULL;
		_tmp27_ = _ ("Invalid date: %s");
		_tmp28_ = didl_item;
		_tmp29_ = gupnp_didl_lite_object_get_date ((GUPnPDIDLLiteObject*) _tmp28_);
		_tmp30_ = _tmp29_;
		_tmp31_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp27_, _tmp30_);
		_inner_error_ = _tmp31_;
		g_propagate_error (error, _inner_error_);
		__vala_SoupDate_free0 (parsed_date);
		_g_object_unref0 (didl_item);
		return;
	}
	_tmp32_ = self->priv->object;
	_tmp33_ = didl_item;
	_tmp34_ = gupnp_didl_lite_object_get_date ((GUPnPDIDLLiteObject*) _tmp33_);
	_tmp35_ = _tmp34_;
	_tmp36_ = g_strconcat (_tmp35_, "T00:00:00", NULL);
	_g_free0 ((G_TYPE_CHECK_INSTANCE_TYPE (_tmp32_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _tmp32_) : NULL)->date);
	(G_TYPE_CHECK_INSTANCE_TYPE (_tmp32_, RYGEL_TYPE_MEDIA_ITEM) ? ((RygelMediaItem*) _tmp32_) : NULL)->date = _tmp36_;
	__vala_SoupDate_free0 (parsed_date);
	_g_object_unref0 (didl_item);
}


static RygelMediaObject* rygel_object_creator_create_object (RygelObjectCreator* self, const gchar* id, RygelWritableContainer* parent, const gchar* title, const gchar* upnp_class, GError** error) {
	RygelMediaObject* result = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	GQuark _tmp3_ = 0U;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, 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);
	g_return_val_if_fail (upnp_class != NULL, NULL);
	_tmp0_ = upnp_class;
	_tmp1_ = _tmp0_;
	_tmp3_ = (NULL == _tmp1_) ? 0 : g_quark_from_string (_tmp1_);
	if (_tmp3_ == g_quark_from_string (RYGEL_IMAGE_ITEM_UPNP_CLASS)) {
		switch (0) {
			default:
			{
				const gchar* _tmp4_ = NULL;
				RygelWritableContainer* _tmp5_ = NULL;
				const gchar* _tmp6_ = NULL;
				RygelImageItem* _tmp7_ = NULL;
				_tmp4_ = id;
				_tmp5_ = parent;
				_tmp6_ = title;
				_tmp7_ = rygel_image_item_new (_tmp4_, (RygelMediaContainer*) _tmp5_, _tmp6_);
				result = (RygelMediaObject*) _tmp7_;
				return result;
			}
		}
	} else if (_tmp3_ == g_quark_from_string (RYGEL_PHOTO_ITEM_UPNP_CLASS)) {
		switch (0) {
			default:
			{
				const gchar* _tmp8_ = NULL;
				RygelWritableContainer* _tmp9_ = NULL;
				const gchar* _tmp10_ = NULL;
				RygelPhotoItem* _tmp11_ = NULL;
				_tmp8_ = id;
				_tmp9_ = parent;
				_tmp10_ = title;
				_tmp11_ = rygel_photo_item_new (_tmp8_, (RygelMediaContainer*) _tmp9_, _tmp10_);
				result = (RygelMediaObject*) _tmp11_;
				return result;
			}
		}
	} else if (_tmp3_ == g_quark_from_string (RYGEL_VIDEO_ITEM_UPNP_CLASS)) {
		switch (0) {
			default:
			{
				const gchar* _tmp12_ = NULL;
				RygelWritableContainer* _tmp13_ = NULL;
				const gchar* _tmp14_ = NULL;
				RygelVideoItem* _tmp15_ = NULL;
				_tmp12_ = id;
				_tmp13_ = parent;
				_tmp14_ = title;
				_tmp15_ = rygel_video_item_new (_tmp12_, (RygelMediaContainer*) _tmp13_, _tmp14_);
				result = (RygelMediaObject*) _tmp15_;
				return result;
			}
		}
	} else if (_tmp3_ == g_quark_from_string (RYGEL_AUDIO_ITEM_UPNP_CLASS)) {
		switch (0) {
			default:
			{
				const gchar* _tmp16_ = NULL;
				RygelWritableContainer* _tmp17_ = NULL;
				const gchar* _tmp18_ = NULL;
				RygelAudioItem* _tmp19_ = NULL;
				_tmp16_ = id;
				_tmp17_ = parent;
				_tmp18_ = title;
				_tmp19_ = rygel_audio_item_new (_tmp16_, (RygelMediaContainer*) _tmp17_, _tmp18_);
				result = (RygelMediaObject*) _tmp19_;
				return result;
			}
		}
	} else if (_tmp3_ == g_quark_from_string (RYGEL_MUSIC_ITEM_UPNP_CLASS)) {
		switch (0) {
			default:
			{
				const gchar* _tmp20_ = NULL;
				RygelWritableContainer* _tmp21_ = NULL;
				const gchar* _tmp22_ = NULL;
				RygelMusicItem* _tmp23_ = NULL;
				_tmp20_ = id;
				_tmp21_ = parent;
				_tmp22_ = title;
				_tmp23_ = rygel_music_item_new (_tmp20_, (RygelMediaContainer*) _tmp21_, _tmp22_);
				result = (RygelMediaObject*) _tmp23_;
				return result;
			}
		}
	} else if (_tmp3_ == g_quark_from_string (RYGEL_PLAYLIST_ITEM_UPNP_CLASS)) {
		switch (0) {
			default:
			{
				const gchar* _tmp24_ = NULL;
				RygelWritableContainer* _tmp25_ = NULL;
				const gchar* _tmp26_ = NULL;
				RygelPlaylistItem* _tmp27_ = NULL;
				_tmp24_ = id;
				_tmp25_ = parent;
				_tmp26_ = title;
				_tmp27_ = rygel_playlist_item_new (_tmp24_, (RygelMediaContainer*) _tmp25_, _tmp26_);
				result = (RygelMediaObject*) _tmp27_;
				return result;
			}
		}
	} else if ((_tmp3_ == g_quark_from_string (RYGEL_MEDIA_CONTAINER_UPNP_CLASS)) || (_tmp3_ == g_quark_from_string (RYGEL_MEDIA_CONTAINER_STORAGE_FOLDER))) {
		switch (0) {
			default:
			{
				const gchar* _tmp28_ = NULL;
				RygelWritableContainer* _tmp29_ = NULL;
				const gchar* _tmp30_ = NULL;
				RygelBaseMediaContainer* _tmp31_ = NULL;
				_tmp28_ = id;
				_tmp29_ = parent;
				_tmp30_ = title;
				_tmp31_ = rygel_base_media_container_new (_tmp28_, (RygelMediaContainer*) _tmp29_, _tmp30_, 0);
				result = (RygelMediaObject*) _tmp31_;
				return result;
			}
		}
	} else if (_tmp3_ == g_quark_from_string (RYGEL_MEDIA_CONTAINER_PLAYLIST)) {
		switch (0) {
			default:
			{
				RygelBaseMediaContainer* container = NULL;
				const gchar* _tmp32_ = NULL;
				RygelWritableContainer* _tmp33_ = NULL;
				const gchar* _tmp34_ = NULL;
				RygelBaseMediaContainer* _tmp35_ = NULL;
				RygelBaseMediaContainer* _tmp36_ = NULL;
				const gchar* _tmp37_ = NULL;
				gchar* _tmp38_ = NULL;
				_tmp32_ = id;
				_tmp33_ = parent;
				_tmp34_ = title;
				_tmp35_ = rygel_base_media_container_new (_tmp32_, (RygelMediaContainer*) _tmp33_, _tmp34_, 0);
				container = _tmp35_;
				_tmp36_ = container;
				_tmp37_ = upnp_class;
				_tmp38_ = g_strdup (_tmp37_);
				_g_free0 (((RygelMediaObject*) _tmp36_)->upnp_class);
				((RygelMediaObject*) _tmp36_)->upnp_class = _tmp38_;
				result = (RygelMediaObject*) container;
				return result;
			}
		}
	} else {
		switch (0) {
			default:
			{
				gchar* msg = NULL;
				const gchar* _tmp39_ = NULL;
				gchar* _tmp40_ = NULL;
				const gchar* _tmp41_ = NULL;
				const gchar* _tmp42_ = NULL;
				GError* _tmp43_ = NULL;
				_tmp39_ = _ ("Cannot create object of class '%s': Not supported");
				_tmp40_ = g_strdup (_tmp39_);
				msg = _tmp40_;
				_tmp41_ = msg;
				_tmp42_ = upnp_class;
				_tmp43_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_BAD_METADATA, _tmp41_, _tmp42_);
				_inner_error_ = _tmp43_;
				g_propagate_error (error, _inner_error_);
				_g_free0 (msg);
				return NULL;
			}
		}
	}
}


/**
     * Simple check for the validity of an URI.
     *
     * Check is done by parsing the URI with soup. Additionaly a cleaned-up
     * version of the URI is returned in sanitized_uri.
     *
     * @param uri the input URI
     * @param sanitized_uri containes a sanitized version of the URI on return
     * @returns true if the URI is valid, false otherwise.
     */
static void _vala_SoupURI_free (SoupURI* self) {
	g_boxed_free (soup_uri_get_type (), self);
}


static gboolean rygel_object_creator_is_valid_uri (RygelObjectCreator* self, const gchar* uri, gchar** sanitized_uri) {
	gchar* _vala_sanitized_uri = NULL;
	gboolean result = FALSE;
	gboolean _tmp0_ = FALSE;
	const gchar* _tmp1_ = NULL;
	SoupURI* soup_uri = NULL;
	const gchar* _tmp3_ = NULL;
	SoupURI* _tmp4_ = NULL;
	gboolean _tmp5_ = FALSE;
	SoupURI* _tmp6_ = NULL;
	SoupURI* _tmp9_ = NULL;
	gchar* _tmp10_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	_g_free0 (_vala_sanitized_uri);
	_vala_sanitized_uri = NULL;
	_tmp1_ = uri;
	if (_tmp1_ == NULL) {
		_tmp0_ = TRUE;
	} else {
		const gchar* _tmp2_ = NULL;
		_tmp2_ = uri;
		_tmp0_ = g_strcmp0 (_tmp2_, "") == 0;
	}
	if (_tmp0_) {
		result = FALSE;
		if (sanitized_uri) {
			*sanitized_uri = _vala_sanitized_uri;
		} else {
			_g_free0 (_vala_sanitized_uri);
		}
		return result;
	}
	_tmp3_ = uri;
	_tmp4_ = soup_uri_new (_tmp3_);
	soup_uri = _tmp4_;
	_tmp6_ = soup_uri;
	if (_tmp6_ == NULL) {
		_tmp5_ = TRUE;
	} else {
		SoupURI* _tmp7_ = NULL;
		const gchar* _tmp8_ = NULL;
		_tmp7_ = soup_uri;
		_tmp8_ = _tmp7_->scheme;
		_tmp5_ = _tmp8_ == NULL;
	}
	if (_tmp5_) {
		result = FALSE;
		__vala_SoupURI_free0 (soup_uri);
		if (sanitized_uri) {
			*sanitized_uri = _vala_sanitized_uri;
		} else {
			_g_free0 (_vala_sanitized_uri);
		}
		return result;
	}
	_tmp9_ = soup_uri;
	_tmp10_ = soup_uri_to_string (_tmp9_, FALSE);
	_g_free0 (_vala_sanitized_uri);
	_vala_sanitized_uri = _tmp10_;
	result = TRUE;
	__vala_SoupURI_free0 (soup_uri);
	if (sanitized_uri) {
		*sanitized_uri = _vala_sanitized_uri;
	} else {
		_g_free0 (_vala_sanitized_uri);
	}
	return result;
}


/**
     * Transform the title to be usable on legacy file-systems such as FAT32.
     *
     * The function trims down the title to 205 chars (leaving room for an UUID)
     * and replaces all special characters.
     *
     * @param title of the the media item
     * @return the cleaned and shortened title
     */
static glong string_strnlen (gchar* str, glong maxlen) {
	glong result = 0L;
	gchar* end = NULL;
	gchar* _tmp0_ = NULL;
	glong _tmp1_ = 0L;
	gchar* _tmp2_ = NULL;
	gchar* _tmp3_ = NULL;
	_tmp0_ = str;
	_tmp1_ = maxlen;
	_tmp2_ = memchr (_tmp0_, 0, (gsize) _tmp1_);
	end = _tmp2_;
	_tmp3_ = end;
	if (_tmp3_ == NULL) {
		glong _tmp4_ = 0L;
		_tmp4_ = maxlen;
		result = _tmp4_;
		return result;
	} else {
		gchar* _tmp5_ = NULL;
		gchar* _tmp6_ = NULL;
		_tmp5_ = end;
		_tmp6_ = str;
		result = (glong) (_tmp5_ - _tmp6_);
		return result;
	}
}


static gchar* string_substring (const gchar* self, glong offset, glong len) {
	gchar* result = NULL;
	glong string_length = 0L;
	gboolean _tmp0_ = FALSE;
	glong _tmp1_ = 0L;
	glong _tmp8_ = 0L;
	glong _tmp14_ = 0L;
	glong _tmp17_ = 0L;
	glong _tmp18_ = 0L;
	glong _tmp19_ = 0L;
	glong _tmp20_ = 0L;
	glong _tmp21_ = 0L;
	gchar* _tmp22_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp1_ = offset;
	if (_tmp1_ >= ((glong) 0)) {
		glong _tmp2_ = 0L;
		_tmp2_ = len;
		_tmp0_ = _tmp2_ >= ((glong) 0);
	} else {
		_tmp0_ = FALSE;
	}
	if (_tmp0_) {
		glong _tmp3_ = 0L;
		glong _tmp4_ = 0L;
		glong _tmp5_ = 0L;
		_tmp3_ = offset;
		_tmp4_ = len;
		_tmp5_ = string_strnlen ((gchar*) self, _tmp3_ + _tmp4_);
		string_length = _tmp5_;
	} else {
		gint _tmp6_ = 0;
		gint _tmp7_ = 0;
		_tmp6_ = strlen (self);
		_tmp7_ = _tmp6_;
		string_length = (glong) _tmp7_;
	}
	_tmp8_ = offset;
	if (_tmp8_ < ((glong) 0)) {
		glong _tmp9_ = 0L;
		glong _tmp10_ = 0L;
		glong _tmp11_ = 0L;
		_tmp9_ = string_length;
		_tmp10_ = offset;
		offset = _tmp9_ + _tmp10_;
		_tmp11_ = offset;
		g_return_val_if_fail (_tmp11_ >= ((glong) 0), NULL);
	} else {
		glong _tmp12_ = 0L;
		glong _tmp13_ = 0L;
		_tmp12_ = offset;
		_tmp13_ = string_length;
		g_return_val_if_fail (_tmp12_ <= _tmp13_, NULL);
	}
	_tmp14_ = len;
	if (_tmp14_ < ((glong) 0)) {
		glong _tmp15_ = 0L;
		glong _tmp16_ = 0L;
		_tmp15_ = string_length;
		_tmp16_ = offset;
		len = _tmp15_ - _tmp16_;
	}
	_tmp17_ = offset;
	_tmp18_ = len;
	_tmp19_ = string_length;
	g_return_val_if_fail ((_tmp17_ + _tmp18_) <= _tmp19_, NULL);
	_tmp20_ = offset;
	_tmp21_ = len;
	_tmp22_ = g_strndup (((gchar*) self) + _tmp20_, (gsize) _tmp21_);
	result = _tmp22_;
	return result;
}


static gchar* uuid_get (void) {
	gchar* result = NULL;
	guchar* id = NULL;
	guchar* _tmp0_ = NULL;
	gint id_length1 = 0;
	gint _id_size_ = 0;
	guchar* unparsed = NULL;
	guchar* _tmp1_ = NULL;
	gint unparsed_length1 = 0;
	gint _unparsed_size_ = 0;
	guchar* _tmp2_ = NULL;
	gint _tmp2__length1 = 0;
	guchar* _tmp3_ = NULL;
	gint _tmp3__length1 = 0;
	guchar* _tmp4_ = NULL;
	gint _tmp4__length1 = 0;
	guchar* _tmp5_ = NULL;
	gint _tmp5__length1 = 0;
	guchar _tmp6_ = '\0';
	guchar* _tmp7_ = NULL;
	gint _tmp7__length1 = 0;
	gchar* _tmp8_ = NULL;
	_tmp0_ = g_new0 (guchar, 16);
	id = _tmp0_;
	id_length1 = 16;
	_id_size_ = id_length1;
	_tmp1_ = g_new0 (guchar, 51);
	unparsed = _tmp1_;
	unparsed_length1 = 51;
	_unparsed_size_ = unparsed_length1;
	_tmp2_ = id;
	_tmp2__length1 = id_length1;
	uuid_generate (_tmp2_);
	_tmp3_ = id;
	_tmp3__length1 = id_length1;
	_tmp4_ = unparsed;
	_tmp4__length1 = unparsed_length1;
	uuid_unparse (_tmp3_, _tmp4_);
	_tmp5_ = unparsed;
	_tmp5__length1 = unparsed_length1;
	_tmp5_[50] = (guchar) '\0';
	_tmp6_ = _tmp5_[50];
	_tmp7_ = unparsed;
	_tmp7__length1 = unparsed_length1;
	_tmp8_ = g_strdup ((const gchar*) _tmp7_);
	result = _tmp8_;
	unparsed = (g_free (unparsed), NULL);
	id = (g_free (id), NULL);
	return result;
}


static gchar* rygel_object_creator_mangle_title (RygelObjectCreator* self, const gchar* title, GError** error) {
	gchar* result = NULL;
	gchar* mangled = NULL;
	const gchar* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	gint _tmp2_ = 0;
	gint _tmp3_ = 0;
	gint _tmp4_ = 0;
	gchar* _tmp5_ = NULL;
	gchar* _tmp6_ = NULL;
	GRegex* _tmp7_ = NULL;
	const gchar* _tmp8_ = NULL;
	gchar* _tmp9_ = NULL;
	gchar* _tmp10_ = NULL;
	gchar* _tmp11_ = NULL;
	gchar* _tmp12_ = NULL;
	gchar* _tmp13_ = NULL;
	gchar* _tmp14_ = NULL;
	const gchar* _tmp15_ = NULL;
	gchar* _tmp16_ = NULL;
	gchar* _tmp17_ = NULL;
	GError * _inner_error_ = NULL;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (title != NULL, NULL);
	_tmp0_ = title;
	_tmp1_ = title;
	_tmp2_ = strlen (_tmp1_);
	_tmp3_ = _tmp2_;
	_tmp4_ = MIN (_tmp3_, 205);
	_tmp5_ = string_substring (_tmp0_, (glong) 0, (glong) _tmp4_);
	mangled = _tmp5_;
	_tmp7_ = self->priv->title_regex;
	_tmp8_ = mangled;
	_tmp9_ = g_regex_replace_literal (_tmp7_, _tmp8_, (gssize) (-1), 0, "_", G_REGEX_MATCH_NOTEMPTY, &_inner_error_);
	_tmp6_ = _tmp9_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_free0 (mangled);
		return NULL;
	}
	_tmp10_ = _tmp6_;
	_tmp6_ = NULL;
	_g_free0 (mangled);
	mangled = _tmp10_;
	_tmp11_ = uuid_get ();
	_tmp12_ = _tmp11_;
	_tmp13_ = g_strconcat (_tmp12_, "-", NULL);
	_tmp14_ = _tmp13_;
	_tmp15_ = mangled;
	_tmp16_ = g_strconcat (_tmp14_, _tmp15_, NULL);
	_tmp17_ = _tmp16_;
	_g_free0 (_tmp14_);
	_g_free0 (_tmp12_);
	result = _tmp17_;
	_g_free0 (_tmp6_);
	_g_free0 (mangled);
	return result;
}


static void rygel_object_creator_create_uri_data_free (gpointer _data) {
	RygelObjectCreatorCreateUriData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->container);
	_g_free0 (_data_->title);
	_g_free0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelObjectCreatorCreateUriData, _data_);
}


static void rygel_object_creator_create_uri (RygelObjectCreator* self, RygelWritableContainer* container, const gchar* title, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelObjectCreatorCreateUriData* _data_;
	RygelObjectCreator* _tmp0_ = NULL;
	RygelWritableContainer* _tmp1_ = NULL;
	RygelWritableContainer* _tmp2_ = NULL;
	const gchar* _tmp3_ = NULL;
	gchar* _tmp4_ = NULL;
	_data_ = g_slice_new0 (RygelObjectCreatorCreateUriData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_object_creator_create_uri);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_object_creator_create_uri_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = container;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->container);
	_data_->container = _tmp2_;
	_tmp3_ = title;
	_tmp4_ = g_strdup (_tmp3_);
	_g_free0 (_data_->title);
	_data_->title = _tmp4_;
	rygel_object_creator_create_uri_co (_data_);
}


static gchar* rygel_object_creator_create_uri_finish (RygelObjectCreator* self, GAsyncResult* _res_, GError** error) {
	gchar* result;
	RygelObjectCreatorCreateUriData* _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;
}


/**
     * Create an URI from the item's title.
     *
     * Create an unique URI from the supplied title by cleaning it from
     * unwanted characters, shortening it and adding an UUID.
     *
     * @param container to create the item in
     * @param title of the item to base the name on
     * @returns an URI for the newly created item
     */
static void rygel_object_creator_create_uri_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelObjectCreatorCreateUriData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_object_creator_create_uri_co (_data_);
}


static gboolean rygel_object_creator_create_uri_co (RygelObjectCreatorCreateUriData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->container;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = _data_->_tmp1_;
	_data_->_state_ = 1;
	rygel_writable_container_get_writable (_data_->_tmp0_, _data_->_tmp2_, rygel_object_creator_create_uri_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = rygel_writable_container_get_writable_finish (_data_->_tmp0_, _data_->_res_);
	_data_->dir = _data_->_tmp3_;
	_data_->_tmp4_ = NULL;
	_data_->_tmp4_ = _data_->dir;
	if (_data_->_tmp4_ == NULL) {
		_data_->_tmp5_ = NULL;
		_data_->_tmp5_ = _ ("Object creation in %s not allowed");
		_data_->_tmp6_ = NULL;
		_data_->_tmp6_ = _data_->container;
		_data_->_tmp7_ = NULL;
		_data_->_tmp7_ = rygel_media_object_get_id ((RygelMediaObject*) _data_->_tmp6_);
		_data_->_tmp8_ = NULL;
		_data_->_tmp8_ = _data_->_tmp7_;
		_data_->_tmp9_ = NULL;
		_data_->_tmp9_ = g_error_new (RYGEL_CONTENT_DIRECTORY_ERROR, RYGEL_CONTENT_DIRECTORY_ERROR_RESTRICTED_PARENT, _data_->_tmp5_, _data_->_tmp8_);
		_data_->_inner_error_ = _data_->_tmp9_;
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->dir);
		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_->_tmp11_ = NULL;
	_data_->_tmp11_ = _data_->title;
	_data_->_tmp12_ = NULL;
	_data_->_tmp12_ = rygel_object_creator_mangle_title (_data_->self, _data_->_tmp11_, &_data_->_inner_error_);
	_data_->_tmp10_ = _data_->_tmp12_;
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_object_unref0 (_data_->dir);
		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_->dir;
	_data_->_tmp14_ = NULL;
	_data_->_tmp14_ = g_file_get_child_for_display_name (_data_->_tmp13_, _data_->_tmp10_, &_data_->_inner_error_);
	_data_->file = _data_->_tmp14_;
	if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
		g_simple_async_result_set_from_error (_data_->_async_result, _data_->_inner_error_);
		g_error_free (_data_->_inner_error_);
		_g_free0 (_data_->_tmp10_);
		_g_object_unref0 (_data_->dir);
		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_->_tmp15_ = NULL;
	_data_->_tmp15_ = _data_->file;
	_data_->_tmp16_ = NULL;
	_data_->_tmp16_ = g_file_get_uri (_data_->_tmp15_);
	_data_->result = _data_->_tmp16_;
	_g_object_unref0 (_data_->file);
	_g_free0 (_data_->_tmp10_);
	_g_object_unref0 (_data_->dir);
	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_object_unref0 (_data_->file);
	_g_free0 (_data_->_tmp10_);
	_g_object_unref0 (_data_->dir);
	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 void rygel_object_creator_wait_for_object_data_free (gpointer _data) {
	RygelObjectCreatorWaitForObjectData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelObjectCreatorWaitForObjectData, _data_);
}


static void rygel_object_creator_wait_for_object (RygelObjectCreator* self, RygelWritableContainer* container, GAsyncReadyCallback _callback_, gpointer _user_data_) {
	RygelObjectCreatorWaitForObjectData* _data_;
	RygelObjectCreator* _tmp0_ = NULL;
	RygelWritableContainer* _tmp1_ = NULL;
	RygelWritableContainer* _tmp2_ = NULL;
	_data_ = g_slice_new0 (RygelObjectCreatorWaitForObjectData);
	_data_->_async_result = g_simple_async_result_new (G_OBJECT (self), _callback_, _user_data_, rygel_object_creator_wait_for_object);
	g_simple_async_result_set_op_res_gpointer (_data_->_async_result, _data_, rygel_object_creator_wait_for_object_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = container;
	_tmp2_ = _g_object_ref0 (_tmp1_);
	_g_object_unref0 (_data_->container);
	_data_->container = _tmp2_;
	rygel_object_creator_wait_for_object_co (_data_);
}


static void rygel_object_creator_wait_for_object_finish (RygelObjectCreator* self, GAsyncResult* _res_) {
	RygelObjectCreatorWaitForObjectData* _data_;
	_data_ = g_simple_async_result_get_op_res_gpointer (G_SIMPLE_ASYNC_RESULT (_res_));
}


/**
     * Wait for the new object
     *
     * When creating an object in the back-end via WritableContainer.add_item
     * or WritableContainer.add_container there might be a delay between the
     * creation and the back-end having the newly created item available. This
     * function waits for the item to become available by hooking into the
     * container_updated signal. The maximum time to wait is 5 seconds.
     *
     * @param container to watch
     */
static Block4Data* block4_data_ref (Block4Data* _data4_) {
	g_atomic_int_inc (&_data4_->_ref_count_);
	return _data4_;
}


static void block4_data_unref (void * _userdata_) {
	Block4Data* _data4_;
	_data4_ = (Block4Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data4_->_ref_count_)) {
		RygelObjectCreator* self;
		self = _data4_->self;
		_g_object_unref0 (_data4_->container);
		_g_object_unref0 (self);
		g_slice_free (Block4Data, _data4_);
	}
}


static void rygel_object_creator_wait_for_object_ready (GObject* source_object, GAsyncResult* _res_, gpointer _user_data_) {
	RygelObjectCreatorWaitForObjectData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_object_creator_wait_for_object_co (_data_);
}


static Block5Data* block5_data_ref (Block5Data* _data5_) {
	g_atomic_int_inc (&_data5_->_ref_count_);
	return _data5_;
}


static void block5_data_unref (void * _userdata_) {
	Block5Data* _data5_;
	_data5_ = (Block5Data*) _userdata_;
	if (g_atomic_int_dec_and_test (&_data5_->_ref_count_)) {
		RygelObjectCreator* self;
		self = _data5_->_data4_->self;
		block4_data_unref (_data5_->_data4_);
		_data5_->_data4_ = NULL;
		g_slice_free (Block5Data, _data5_);
	}
}


static void ____lambda7_ (Block5Data* _data5_, RygelMediaContainer* container) {
	Block4Data* _data4_;
	RygelObjectCreator* self;
	_data4_ = _data5_->_data4_;
	self = _data4_->self;
	g_return_if_fail (container != NULL);
	rygel_object_creator_wait_for_object_co (_data4_->_async_data_);
}


static void _____lambda7__rygel_media_container_container_updated (RygelMediaContainer* _sender, RygelMediaContainer* container, gpointer self) {
	____lambda7_ (self, container);
}


static gboolean ____lambda8_ (Block5Data* _data5_) {
	Block4Data* _data4_;
	RygelObjectCreator* self;
	gboolean result = FALSE;
	RygelWritableContainer* _tmp0_ = NULL;
	const gchar* _tmp1_ = NULL;
	const gchar* _tmp2_ = NULL;
	_data4_ = _data5_->_data4_;
	self = _data4_->self;
	_tmp0_ = _data4_->container;
	_tmp1_ = rygel_media_object_get_id ((RygelMediaObject*) _tmp0_);
	_tmp2_ = _tmp1_;
	g_debug ("rygel-object-creator.vala:752: Timeout on waiting for 'updated' signal" \
" on '%s'.", _tmp2_);
	_data5_->timeout = (guint) 0;
	rygel_object_creator_wait_for_object_co (_data4_->_async_data_);
	result = FALSE;
	return result;
}


static gboolean _____lambda8__gsource_func (gpointer self) {
	gboolean result;
	result = ____lambda8_ (self);
	return result;
}


static gboolean rygel_object_creator_wait_for_object_co (RygelObjectCreatorWaitForObjectData* _data_) {
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		case 2:
		goto _state_2;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_data4_ = g_slice_new0 (Block4Data);
	_data_->_data4_->_ref_count_ = 1;
	_data_->_data4_->self = g_object_ref (_data_->self);
	_data_->_tmp0_ = NULL;
	_data_->_tmp0_ = _data_->container;
	_g_object_unref0 (_data_->_data4_->container);
	_data_->_data4_->container = _data_->_tmp0_;
	_data_->_data4_->_async_data_ = _data_;
	_data_->_tmp1_ = NULL;
	_data_->_tmp1_ = _data_->_data4_->container;
	_data_->_tmp2_ = NULL;
	_data_->_tmp2_ = rygel_media_object_get_id ((RygelMediaObject*) _data_->_tmp1_);
	_data_->_tmp3_ = NULL;
	_data_->_tmp3_ = _data_->_tmp2_;
	g_debug ("rygel-object-creator.vala:731: Waiting for new object to appear under " \
"container '%s'…", _data_->_tmp3_);
	_data_->object = NULL;
	while (TRUE) {
		_data_->_tmp4_ = NULL;
		_data_->_tmp4_ = _data_->object;
		if (!(_data_->_tmp4_ == NULL)) {
			break;
		}
		{
			_data_->_tmp6_ = NULL;
			_data_->_tmp6_ = _data_->_data4_->container;
			_data_->_tmp7_ = NULL;
			_data_->_tmp7_ = _data_->self->priv->object;
			_data_->_tmp8_ = NULL;
			_data_->_tmp8_ = rygel_media_object_get_id (_data_->_tmp7_);
			_data_->_tmp9_ = NULL;
			_data_->_tmp9_ = _data_->_tmp8_;
			_data_->_tmp10_ = NULL;
			_data_->_tmp10_ = rygel_state_machine_get_cancellable ((RygelStateMachine*) _data_->self);
			_data_->_tmp11_ = NULL;
			_data_->_tmp11_ = _data_->_tmp10_;
			_data_->_state_ = 1;
			rygel_media_object_find_object ((RygelMediaObject*) _data_->_tmp6_, _data_->_tmp9_, _data_->_tmp11_, rygel_object_creator_wait_for_object_ready, _data_);
			return FALSE;
			_state_1:
			_data_->_tmp12_ = NULL;
			_data_->_tmp12_ = rygel_media_object_find_object_finish ((RygelMediaObject*) _data_->_tmp6_, _data_->_res_, &_data_->_inner_error_);
			_data_->_tmp5_ = _data_->_tmp12_;
			if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
				goto __catch4_g_error;
			}
			_data_->_tmp13_ = NULL;
			_data_->_tmp13_ = _data_->_tmp5_;
			_data_->_tmp5_ = NULL;
			_g_object_unref0 (_data_->object);
			_data_->object = _data_->_tmp13_;
			_g_object_unref0 (_data_->_tmp5_);
		}
		goto __finally4;
		__catch4_g_error:
		{
			_data_->_error_ = _data_->_inner_error_;
			_data_->_inner_error_ = NULL;
			_data_->_tmp14_ = NULL;
			_data_->_tmp14_ = _ ("Error from container '%s' on trying to find the newly added child obje" \
"ct '%s' in it: %s");
			_data_->_tmp15_ = NULL;
			_data_->_tmp15_ = g_strdup (_data_->_tmp14_);
			_data_->msg = _data_->_tmp15_;
			_data_->_tmp16_ = NULL;
			_data_->_tmp16_ = _data_->msg;
			_data_->_tmp17_ = NULL;
			_data_->_tmp17_ = _data_->_data4_->container;
			_data_->_tmp18_ = NULL;
			_data_->_tmp18_ = rygel_media_object_get_id ((RygelMediaObject*) _data_->_tmp17_);
			_data_->_tmp19_ = NULL;
			_data_->_tmp19_ = _data_->_tmp18_;
			_data_->_tmp20_ = NULL;
			_data_->_tmp20_ = _data_->self->priv->object;
			_data_->_tmp21_ = NULL;
			_data_->_tmp21_ = rygel_media_object_get_id (_data_->_tmp20_);
			_data_->_tmp22_ = NULL;
			_data_->_tmp22_ = _data_->_tmp21_;
			_data_->_tmp23_ = NULL;
			_data_->_tmp23_ = _data_->_error_;
			_data_->_tmp24_ = NULL;
			_data_->_tmp24_ = _data_->_tmp23_->message;
			g_warning (_data_->_tmp16_, _data_->_tmp19_, _data_->_tmp22_, _data_->_tmp24_);
			_g_free0 (_data_->msg);
			_g_error_free0 (_data_->_error_);
		}
		__finally4:
		if (G_UNLIKELY (_data_->_inner_error_ != NULL)) {
			_g_object_unref0 (_data_->object);
			block4_data_unref (_data_->_data4_);
			_data_->_data4_ = 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_->_tmp25_ = NULL;
		_data_->_tmp25_ = _data_->object;
		if (_data_->_tmp25_ == NULL) {
			_data_->_data5_ = g_slice_new0 (Block5Data);
			_data_->_data5_->_ref_count_ = 1;
			_data_->_data5_->_data4_ = block4_data_ref (_data_->_data4_);
			_data_->_tmp26_ = NULL;
			_data_->_tmp26_ = _data_->_data4_->container;
			_data_->_tmp27_ = 0UL;
			_data_->_tmp27_ = g_signal_connect_data ((RygelMediaContainer*) _data_->_tmp26_, "container-updated", (GCallback) _____lambda7__rygel_media_container_container_updated, block5_data_ref (_data_->_data5_), (GClosureNotify) block5_data_unref, 0);
			_data_->id = _data_->_tmp27_;
			_data_->_data5_->timeout = (guint) 0;
			_data_->_tmp28_ = 0U;
			_data_->_tmp28_ = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT, (guint) 5, _____lambda8__gsource_func, block5_data_ref (_data_->_data5_), block5_data_unref);
			_data_->_data5_->timeout = _data_->_tmp28_;
			_data_->_state_ = 2;
			return FALSE;
			_state_2:
			;
			_data_->_tmp29_ = NULL;
			_data_->_tmp29_ = _data_->_data4_->container;
			_data_->_tmp30_ = 0UL;
			_data_->_tmp30_ = _data_->id;
			g_signal_handler_disconnect ((GObject*) _data_->_tmp29_, _data_->_tmp30_);
			_data_->_tmp31_ = 0U;
			_data_->_tmp31_ = _data_->_data5_->timeout;
			if (_data_->_tmp31_ != ((guint) 0)) {
				_data_->_tmp32_ = 0U;
				_data_->_tmp32_ = _data_->_data5_->timeout;
				g_source_remove (_data_->_tmp32_);
			} else {
				block5_data_unref (_data_->_data5_);
				_data_->_data5_ = NULL;
				break;
			}
			block5_data_unref (_data_->_data5_);
			_data_->_data5_ = NULL;
		}
	}
	_data_->_tmp33_ = NULL;
	_data_->_tmp33_ = _data_->_data4_->container;
	_data_->_tmp34_ = NULL;
	_data_->_tmp34_ = rygel_media_object_get_id ((RygelMediaObject*) _data_->_tmp33_);
	_data_->_tmp35_ = NULL;
	_data_->_tmp35_ = _data_->_tmp34_;
	g_debug ("rygel-object-creator.vala:771: Finished waiting for new object to appe" \
"ar under container '%s'", _data_->_tmp35_);
	_data_->_tmp36_ = NULL;
	_data_->_tmp36_ = _data_->object;
	_data_->_tmp37_ = NULL;
	_data_->_tmp37_ = _g_object_ref0 (_data_->_tmp36_);
	_g_object_unref0 (_data_->self->priv->object);
	_data_->self->priv->object = _data_->_tmp37_;
	_g_object_unref0 (_data_->object);
	block4_data_unref (_data_->_data4_);
	_data_->_data4_ = 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;
}


/**
     * Check if the profile is supported.
     *
     * The check is performed against the MediaEngine's database explicitly excluding
     * the transcoders.
     *
     * @param profile to check
     * @returns true if the profile is supported, false otherwise.
     */
static gint _rygel_dlna_profile_compare_by_name_gcompare_func (gconstpointer a, gconstpointer b) {
	gint result;
	result = rygel_dlna_profile_compare_by_name ((RygelDLNAProfile*) a, (RygelDLNAProfile*) b);
	return result;
}


static gboolean rygel_object_creator_is_profile_valid (RygelObjectCreator* self, const gchar* profile) {
	gboolean result = FALSE;
	GList* profiles = NULL;
	GList* _result_ = NULL;
	RygelMediaServerPlugin* plugin = NULL;
	RygelContentDirectory* _tmp0_ = NULL;
	RygelRootDevice* _tmp1_ = NULL;
	RygelMediaServerPlugin* _tmp2_ = NULL;
	RygelMediaServerPlugin* _tmp3_ = NULL;
	GList* _tmp4_ = NULL;
	RygelDLNAProfile* p = NULL;
	const gchar* _tmp5_ = NULL;
	RygelDLNAProfile* _tmp6_ = NULL;
	GList* _tmp7_ = NULL;
	g_return_val_if_fail (self != NULL, FALSE);
	g_return_val_if_fail (profile != NULL, FALSE);
	_tmp0_ = self->priv->content_dir;
	_tmp1_ = _tmp0_->root_device;
	_tmp2_ = _tmp1_->resource_factory;
	_tmp3_ = _g_object_ref0 (G_TYPE_CHECK_INSTANCE_TYPE (_tmp2_, RYGEL_TYPE_MEDIA_SERVER_PLUGIN) ? ((RygelMediaServerPlugin*) _tmp2_) : NULL);
	plugin = _tmp3_;
	_tmp4_ = plugin->upload_profiles;
	profiles = _tmp4_;
	_tmp5_ = profile;
	_tmp6_ = rygel_dlna_profile_new (_tmp5_, "");
	p = _tmp6_;
	_tmp7_ = g_list_find_custom (profiles, p, _rygel_dlna_profile_compare_by_name_gcompare_func);
	_result_ = _tmp7_;
	result = _result_ != NULL;
	_rygel_dlna_profile_unref0 (p);
	_g_object_unref0 (plugin);
	return result;
}


static GCancellable* rygel_object_creator_real_get_cancellable (RygelStateMachine* base) {
	GCancellable* result;
	RygelObjectCreator* self;
	GCancellable* _tmp0_ = NULL;
	self = (RygelObjectCreator*) base;
	_tmp0_ = self->priv->_cancellable;
	result = _tmp0_;
	return result;
}


static void rygel_object_creator_real_set_cancellable (RygelStateMachine* base, GCancellable* value) {
	RygelObjectCreator* self;
	GCancellable* _tmp0_ = NULL;
	GCancellable* _tmp1_ = NULL;
	self = (RygelObjectCreator*) base;
	_tmp0_ = value;
	_tmp1_ = _g_object_ref0 (_tmp0_);
	_g_object_unref0 (self->priv->_cancellable);
	self->priv->_cancellable = _tmp1_;
	g_object_notify ((GObject *) self, "cancellable");
}


static void rygel_object_creator_class_init (RygelObjectCreatorClass * klass) {
	GPatternSpec* _tmp0_ = NULL;
	rygel_object_creator_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (RygelObjectCreatorPrivate));
	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_object_creator_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_object_creator_set_property;
	G_OBJECT_CLASS (klass)->finalize = rygel_object_creator_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_OBJECT_CREATOR_CANCELLABLE, g_param_spec_object ("cancellable", "cancellable", "cancellable", g_cancellable_get_type (), G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
	_tmp0_ = g_pattern_spec_new ("*<!--*-->*");
	rygel_object_creator_comment_pattern = _tmp0_;
}


static void rygel_object_creator_rygel_state_machine_interface_init (RygelStateMachineIface * iface) {
	rygel_object_creator_rygel_state_machine_parent_iface = g_type_interface_peek_parent (iface);
	iface->run = (void (*)(RygelStateMachine*)) rygel_object_creator_real_run;
	iface->run_finish = rygel_object_creator_real_run_finish;
	iface->get_cancellable = rygel_object_creator_real_get_cancellable;
	iface->set_cancellable = rygel_object_creator_real_set_cancellable;
}


static void rygel_object_creator_instance_init (RygelObjectCreator * self) {
	self->priv = RYGEL_OBJECT_CREATOR_GET_PRIVATE (self);
}


static void rygel_object_creator_finalize (GObject* obj) {
	RygelObjectCreator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreator);
	_g_free0 (self->priv->container_id);
	_g_free0 (self->priv->elements);
	_g_object_unref0 (self->priv->didl_object);
	_g_object_unref0 (self->priv->object);
	_g_object_unref0 (self->priv->content_dir);
	_g_object_unref0 (self->priv->action);
	_g_object_unref0 (self->priv->serializer);
	_g_object_unref0 (self->priv->didl_parser);
	_g_regex_unref0 (self->priv->title_regex);
	_g_object_unref0 (self->priv->_cancellable);
	G_OBJECT_CLASS (rygel_object_creator_parent_class)->finalize (obj);
}


/**
 * CreateObject action implementation.
 */
GType rygel_object_creator_get_type (void) {
	static volatile gsize rygel_object_creator_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_object_creator_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelObjectCreatorClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_object_creator_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelObjectCreator), 0, (GInstanceInitFunc) rygel_object_creator_instance_init, NULL };
		static const GInterfaceInfo rygel_state_machine_info = { (GInterfaceInitFunc) rygel_object_creator_rygel_state_machine_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
		GType rygel_object_creator_type_id;
		rygel_object_creator_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelObjectCreator", &g_define_type_info, 0);
		g_type_add_interface_static (rygel_object_creator_type_id, RYGEL_TYPE_STATE_MACHINE, &rygel_state_machine_info);
		g_once_init_leave (&rygel_object_creator_type_id__volatile, rygel_object_creator_type_id);
	}
	return rygel_object_creator_type_id__volatile;
}


static void _vala_rygel_object_creator_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
	RygelObjectCreator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreator);
	switch (property_id) {
		case RYGEL_OBJECT_CREATOR_CANCELLABLE:
		g_value_set_object (value, rygel_state_machine_get_cancellable ((RygelStateMachine*) self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}


static void _vala_rygel_object_creator_set_property (GObject * object, guint property_id, const GValue * value, GParamSpec * pspec) {
	RygelObjectCreator * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_TYPE_OBJECT_CREATOR, RygelObjectCreator);
	switch (property_id) {
		case RYGEL_OBJECT_CREATOR_CANCELLABLE:
		rygel_state_machine_set_cancellable ((RygelStateMachine*) self, g_value_get_object (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}



