/* rygel-client-hacks.c generated by valac 0.56.19, the Vala compiler
 * generated from rygel-client-hacks.vala, do not modify */

/*
 * Copyright (C) 2011 Red Hat, Inc.
 * Copyright (C) 2010 Nokia Corporation.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *
 * This file is part of Rygel.
 *
 * Rygel is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public
 * License as published by the Free Software Foundation; either
 * version 2.1 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 library; if not, write to the Free Software
 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
 */

#include <glib.h>
#include <glib-object.h>
#include <stdlib.h>
#include <string.h>
#include "rygel-server.h"
#include <gio/gio.h>
#include <gee.h>
#include <libsoup/soup.h>
#include <glib/gi18n-lib.h>

#define RYGEL_CLIENT_HACKS_CORRECT_OBJECT_ID "ObjectID"
#if !defined(VALA_STRICT_C)
#if !defined(__clang__) && defined(__GNUC__) && (__GNUC__ >= 14)
#pragma GCC diagnostic warning "-Wincompatible-pointer-types"
#elif defined(__clang__) && (__clang_major__ >= 16)
#pragma clang diagnostic ignored "-Wincompatible-function-pointer-types"
#pragma clang diagnostic ignored "-Wincompatible-pointer-types"
#endif
#endif

#define RYGEL_TYPE_CLIENT_HACKS_ERROR (rygel_client_hacks_error_get_type ())

#define RYGEL_TYPE_CLIENT_HACKS (rygel_client_hacks_get_type ())
#define RYGEL_CLIENT_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_CLIENT_HACKS, RygelClientHacks))
#define RYGEL_CLIENT_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_CLIENT_HACKS, RygelClientHacksClass))
#define RYGEL_IS_CLIENT_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_CLIENT_HACKS))
#define RYGEL_IS_CLIENT_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_CLIENT_HACKS))
#define RYGEL_CLIENT_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_CLIENT_HACKS, RygelClientHacksClass))

typedef struct _RygelClientHacks RygelClientHacks;
typedef struct _RygelClientHacksClass RygelClientHacksClass;
typedef struct _RygelClientHacksPrivate RygelClientHacksPrivate;

#define RYGEL_TYPE_MEDIA_QUERY_ACTION (rygel_media_query_action_get_type ())
#define RYGEL_MEDIA_QUERY_ACTION(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MEDIA_QUERY_ACTION, RygelMediaQueryAction))
#define RYGEL_MEDIA_QUERY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MEDIA_QUERY_ACTION, RygelMediaQueryActionClass))
#define RYGEL_IS_MEDIA_QUERY_ACTION(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MEDIA_QUERY_ACTION))
#define RYGEL_IS_MEDIA_QUERY_ACTION_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MEDIA_QUERY_ACTION))
#define RYGEL_MEDIA_QUERY_ACTION_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MEDIA_QUERY_ACTION, RygelMediaQueryActionClass))

typedef struct _RygelMediaQueryAction RygelMediaQueryAction;
typedef struct _RygelMediaQueryActionClass RygelMediaQueryActionClass;
enum  {
	RYGEL_CLIENT_HACKS_0_PROPERTY,
	RYGEL_CLIENT_HACKS_OBJECT_ID_PROPERTY,
	RYGEL_CLIENT_HACKS_NUM_PROPERTIES
};
static GParamSpec* rygel_client_hacks_properties[RYGEL_CLIENT_HACKS_NUM_PROPERTIES];
#define _g_regex_unref0(var) ((var == NULL) ? NULL : (var = (g_regex_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))

#define RYGEL_TYPE_PANASONIC_HACKS (rygel_panasonic_hacks_get_type ())
#define RYGEL_PANASONIC_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_PANASONIC_HACKS, RygelPanasonicHacks))
#define RYGEL_PANASONIC_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_PANASONIC_HACKS, RygelPanasonicHacksClass))
#define RYGEL_IS_PANASONIC_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_PANASONIC_HACKS))
#define RYGEL_IS_PANASONIC_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_PANASONIC_HACKS))
#define RYGEL_PANASONIC_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_PANASONIC_HACKS, RygelPanasonicHacksClass))

typedef struct _RygelPanasonicHacks RygelPanasonicHacks;
typedef struct _RygelPanasonicHacksClass RygelPanasonicHacksClass;

#define RYGEL_TYPE_XBMC_HACKS (rygel_xbmc_hacks_get_type ())
#define RYGEL_XBMC_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_XBMC_HACKS, RygelXBMCHacks))
#define RYGEL_XBMC_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_XBMC_HACKS, RygelXBMCHacksClass))
#define RYGEL_IS_XBMC_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_XBMC_HACKS))
#define RYGEL_IS_XBMC_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_XBMC_HACKS))
#define RYGEL_XBMC_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_XBMC_HACKS, RygelXBMCHacksClass))

typedef struct _RygelXBMCHacks RygelXBMCHacks;
typedef struct _RygelXBMCHacksClass RygelXBMCHacksClass;

#define RYGEL_TYPE_XBM_C4_XBOX_HACKS (rygel_xbm_c4_xbox_hacks_get_type ())
#define RYGEL_XBM_C4_XBOX_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_XBM_C4_XBOX_HACKS, RygelXBMC4XBoxHacks))
#define RYGEL_XBM_C4_XBOX_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_XBM_C4_XBOX_HACKS, RygelXBMC4XBoxHacksClass))
#define RYGEL_IS_XBM_C4_XBOX_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_XBM_C4_XBOX_HACKS))
#define RYGEL_IS_XBM_C4_XBOX_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_XBM_C4_XBOX_HACKS))
#define RYGEL_XBM_C4_XBOX_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_XBM_C4_XBOX_HACKS, RygelXBMC4XBoxHacksClass))

typedef struct _RygelXBMC4XBoxHacks RygelXBMC4XBoxHacks;
typedef struct _RygelXBMC4XBoxHacksClass RygelXBMC4XBoxHacksClass;

#define RYGEL_TYPE_XBOX_HACKS (rygel_xbox_hacks_get_type ())
#define RYGEL_XBOX_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_XBOX_HACKS, RygelXBoxHacks))
#define RYGEL_XBOX_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_XBOX_HACKS, RygelXBoxHacksClass))
#define RYGEL_IS_XBOX_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_XBOX_HACKS))
#define RYGEL_IS_XBOX_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_XBOX_HACKS))
#define RYGEL_XBOX_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_XBOX_HACKS, RygelXBoxHacksClass))

typedef struct _RygelXBoxHacks RygelXBoxHacks;
typedef struct _RygelXBoxHacksClass RygelXBoxHacksClass;

#define RYGEL_TYPE_WMP_HACKS (rygel_wmp_hacks_get_type ())
#define RYGEL_WMP_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_WMP_HACKS, RygelWMPHacks))
#define RYGEL_WMP_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_WMP_HACKS, RygelWMPHacksClass))
#define RYGEL_IS_WMP_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_WMP_HACKS))
#define RYGEL_IS_WMP_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_WMP_HACKS))
#define RYGEL_WMP_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_WMP_HACKS, RygelWMPHacksClass))

typedef struct _RygelWMPHacks RygelWMPHacks;
typedef struct _RygelWMPHacksClass RygelWMPHacksClass;

#define RYGEL_TYPE_SAMSUNG_TV_HACKS (rygel_samsung_tv_hacks_get_type ())
#define RYGEL_SAMSUNG_TV_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SAMSUNG_TV_HACKS, RygelSamsungTVHacks))
#define RYGEL_SAMSUNG_TV_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SAMSUNG_TV_HACKS, RygelSamsungTVHacksClass))
#define RYGEL_IS_SAMSUNG_TV_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SAMSUNG_TV_HACKS))
#define RYGEL_IS_SAMSUNG_TV_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SAMSUNG_TV_HACKS))
#define RYGEL_SAMSUNG_TV_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SAMSUNG_TV_HACKS, RygelSamsungTVHacksClass))

typedef struct _RygelSamsungTVHacks RygelSamsungTVHacks;
typedef struct _RygelSamsungTVHacksClass RygelSamsungTVHacksClass;

#define RYGEL_TYPE_SEEK_HACKS (rygel_seek_hacks_get_type ())
#define RYGEL_SEEK_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_SEEK_HACKS, RygelSeekHacks))
#define RYGEL_SEEK_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_SEEK_HACKS, RygelSeekHacksClass))
#define RYGEL_IS_SEEK_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_SEEK_HACKS))
#define RYGEL_IS_SEEK_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_SEEK_HACKS))
#define RYGEL_SEEK_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_SEEK_HACKS, RygelSeekHacksClass))

typedef struct _RygelSeekHacks RygelSeekHacks;
typedef struct _RygelSeekHacksClass RygelSeekHacksClass;

#define RYGEL_TYPE_LGTV_HACKS (rygel_lgtv_hacks_get_type ())
#define RYGEL_LGTV_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_LGTV_HACKS, RygelLGTVHacks))
#define RYGEL_LGTV_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_LGTV_HACKS, RygelLGTVHacksClass))
#define RYGEL_IS_LGTV_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_LGTV_HACKS))
#define RYGEL_IS_LGTV_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_LGTV_HACKS))
#define RYGEL_LGTV_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_LGTV_HACKS, RygelLGTVHacksClass))

typedef struct _RygelLGTVHacks RygelLGTVHacks;
typedef struct _RygelLGTVHacksClass RygelLGTVHacksClass;

#define RYGEL_TYPE_PHILLIPS_HACKS (rygel_phillips_hacks_get_type ())
#define RYGEL_PHILLIPS_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_PHILLIPS_HACKS, RygelPhillipsHacks))
#define RYGEL_PHILLIPS_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_PHILLIPS_HACKS, RygelPhillipsHacksClass))
#define RYGEL_IS_PHILLIPS_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_PHILLIPS_HACKS))
#define RYGEL_IS_PHILLIPS_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_PHILLIPS_HACKS))
#define RYGEL_PHILLIPS_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_PHILLIPS_HACKS, RygelPhillipsHacksClass))

typedef struct _RygelPhillipsHacks RygelPhillipsHacks;
typedef struct _RygelPhillipsHacksClass RygelPhillipsHacksClass;

#define RYGEL_TYPE_RAUMFELD_HACKS (rygel_raumfeld_hacks_get_type ())
#define RYGEL_RAUMFELD_HACKS(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_RAUMFELD_HACKS, RygelRaumfeldHacks))
#define RYGEL_RAUMFELD_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_RAUMFELD_HACKS, RygelRaumfeldHacksClass))
#define RYGEL_IS_RAUMFELD_HACKS(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_RAUMFELD_HACKS))
#define RYGEL_IS_RAUMFELD_HACKS_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_RAUMFELD_HACKS))
#define RYGEL_RAUMFELD_HACKS_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_RAUMFELD_HACKS, RygelRaumfeldHacksClass))

typedef struct _RygelRaumfeldHacks RygelRaumfeldHacks;
typedef struct _RygelRaumfeldHacksClass RygelRaumfeldHacksClass;
#define _rygel_search_expression_unref0(var) ((var == NULL) ? NULL : (var = (rygel_search_expression_unref (var), NULL)))
#define _g_free0(var) (var = (g_free (var), NULL))
typedef struct _RygelClientHacksSearchData RygelClientHacksSearchData;
#define _soup_message_headers_unref0(var) ((var == NULL) ? NULL : (var = (soup_message_headers_unref (var), NULL)))

typedef enum  {
	RYGEL_CLIENT_HACKS_ERROR_NA
} RygelClientHacksError;
#define RYGEL_CLIENT_HACKS_ERROR rygel_client_hacks_error_quark ()

struct _RygelClientHacks {
	GObject parent_instance;
	RygelClientHacksPrivate * priv;
	GRegex* agent_regex;
};

struct _RygelClientHacksClass {
	GObjectClass parent_class;
	void (*translate_container_id) (RygelClientHacks* self, RygelMediaQueryAction* action, gchar** container_id);
	void (*apply) (RygelClientHacks* self, RygelMediaObject* object);
	void (*filter_sort_criteria) (RygelClientHacks* self, gchar** sort_criteria);
	gboolean (*force_seek) (RygelClientHacks* self);
	void (*modify_headers) (RygelClientHacks* self, RygelHTTPRequest* request);
	void (*search) (RygelClientHacks* self, RygelSearchableContainer* container, RygelSearchExpression* expression, guint offset, guint max_count, const gchar* sort_criteria, GCancellable* cancellable, GAsyncReadyCallback _callback_, gpointer _user_data_);
	RygelMediaObjects* (*search_finish) (RygelClientHacks* self, GAsyncResult* _res_, guint* total_matches, GError** error);
};

struct _RygelClientHacksPrivate {
	const gchar* _object_id;
};

struct _RygelClientHacksSearchData {
	int _state_;
	GObject* _source_object_;
	GAsyncResult* _res_;
	GTask* _async_result;
	RygelClientHacks* self;
	RygelSearchableContainer* container;
	RygelSearchExpression* expression;
	guint offset;
	guint max_count;
	gchar* sort_criteria;
	GCancellable* cancellable;
	guint total_matches;
	RygelMediaObjects* result;
	RygelMediaObjects* _tmp0_;
	guint _tmp1_;
	RygelMediaObjects* _tmp2_;
	RygelMediaObjects* _tmp3_;
	GError* _inner_error0_;
};

static gint RygelClientHacks_private_offset;
static gpointer rygel_client_hacks_parent_class = NULL;
static GeeHashMap* rygel_client_hacks_client_agent_cache;
static GeeHashMap* rygel_client_hacks_client_agent_cache = NULL;

VALA_EXTERN GQuark rygel_client_hacks_error_quark (void);
VALA_EXTERN GType rygel_client_hacks_error_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType rygel_client_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType rygel_media_query_action_get_type (void) G_GNUC_CONST ;
VALA_EXTERN void rygel_client_hacks_translate_container_id (RygelClientHacks* self,
                                                RygelMediaQueryAction* action,
                                                gchar** container_id);
VALA_EXTERN void rygel_client_hacks_apply (RygelClientHacks* self,
                               RygelMediaObject* object);
VALA_EXTERN void rygel_client_hacks_filter_sort_criteria (RygelClientHacks* self,
                                              gchar** sort_criteria);
VALA_EXTERN gboolean rygel_client_hacks_force_seek (RygelClientHacks* self);
VALA_EXTERN void rygel_client_hacks_modify_headers (RygelClientHacks* self,
                                        RygelHTTPRequest* request);
VALA_EXTERN void rygel_client_hacks_search (RygelClientHacks* self,
                                RygelSearchableContainer* container,
                                RygelSearchExpression* expression,
                                guint offset,
                                guint max_count,
                                const gchar* sort_criteria,
                                GCancellable* cancellable,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_);
VALA_EXTERN RygelMediaObjects* rygel_client_hacks_search_finish (RygelClientHacks* self,
                                                     GAsyncResult* _res_,
                                                     guint* total_matches,
                                                     GError** error);
VALA_EXTERN RygelClientHacks* rygel_client_hacks_construct (GType object_type,
                                                const gchar* agent,
                                                SoupServerMessage* message,
                                                GError** error);
static void rygel_client_hacks_check_headers (RygelClientHacks* self,
                                       SoupServerMessage* message,
                                       GError** error);
VALA_EXTERN RygelClientHacks* rygel_client_hacks_create (SoupServerMessage* message,
                                             GError** error);
VALA_EXTERN GType rygel_panasonic_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelPanasonicHacks* rygel_panasonic_hacks_new (SoupServerMessage* message,
                                                GError** error);
VALA_EXTERN RygelPanasonicHacks* rygel_panasonic_hacks_construct (GType object_type,
                                                      SoupServerMessage* message,
                                                      GError** error);
VALA_EXTERN GType rygel_xbmc_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN GType rygel_xbm_c4_xbox_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelXBMC4XBoxHacks* rygel_xbm_c4_xbox_hacks_new (SoupServerMessage* message,
                                                  GError** error);
VALA_EXTERN RygelXBMC4XBoxHacks* rygel_xbm_c4_xbox_hacks_construct (GType object_type,
                                                        SoupServerMessage* message,
                                                        GError** error);
VALA_EXTERN GType rygel_xbox_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelXBoxHacks* rygel_xbox_hacks_new (SoupServerMessage* message,
                                      GError** error);
VALA_EXTERN RygelXBoxHacks* rygel_xbox_hacks_construct (GType object_type,
                                            SoupServerMessage* message,
                                            GError** error);
VALA_EXTERN GType rygel_wmp_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelWMPHacks* rygel_wmp_hacks_new (SoupServerMessage* message,
                                    GError** error);
VALA_EXTERN RygelWMPHacks* rygel_wmp_hacks_construct (GType object_type,
                                          SoupServerMessage* message,
                                          GError** error);
VALA_EXTERN GType rygel_samsung_tv_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelSamsungTVHacks* rygel_samsung_tv_hacks_new (SoupServerMessage* message,
                                                 GError** error);
VALA_EXTERN RygelSamsungTVHacks* rygel_samsung_tv_hacks_construct (GType object_type,
                                                       SoupServerMessage* message,
                                                       GError** error);
VALA_EXTERN GType rygel_seek_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelSeekHacks* rygel_seek_hacks_new (SoupServerMessage* message,
                                      GError** error);
VALA_EXTERN RygelSeekHacks* rygel_seek_hacks_construct (GType object_type,
                                            SoupServerMessage* message,
                                            GError** error);
VALA_EXTERN GType rygel_lgtv_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelLGTVHacks* rygel_lgtv_hacks_new (SoupServerMessage* message,
                                      GError** error);
VALA_EXTERN RygelLGTVHacks* rygel_lgtv_hacks_construct (GType object_type,
                                            SoupServerMessage* message,
                                            GError** error);
VALA_EXTERN GType rygel_phillips_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelPhillipsHacks* rygel_phillips_hacks_new (SoupServerMessage* message,
                                              GError** error);
VALA_EXTERN RygelPhillipsHacks* rygel_phillips_hacks_construct (GType object_type,
                                                    SoupServerMessage* message,
                                                    GError** error);
VALA_EXTERN GType rygel_raumfeld_hacks_get_type (void) G_GNUC_CONST ;
VALA_EXTERN RygelRaumfeldHacks* rygel_raumfeld_hacks_new (SoupServerMessage* message,
                                              GError** error);
VALA_EXTERN RygelRaumfeldHacks* rygel_raumfeld_hacks_construct (GType object_type,
                                                    SoupServerMessage* message,
                                                    GError** error);
VALA_EXTERN RygelXBMCHacks* rygel_xbmc_hacks_new (SoupServerMessage* message,
                                      const gchar* agent,
                                      GError** error);
VALA_EXTERN RygelXBMCHacks* rygel_xbmc_hacks_construct (GType object_type,
                                            SoupServerMessage* message,
                                            const gchar* agent,
                                            GError** error);
static void rygel_client_hacks_real_translate_container_id (RygelClientHacks* self,
                                                     RygelMediaQueryAction* action,
                                                     gchar** container_id);
static void rygel_client_hacks_real_apply (RygelClientHacks* self,
                                    RygelMediaObject* object);
static void rygel_client_hacks_real_filter_sort_criteria (RygelClientHacks* self,
                                                   gchar** sort_criteria);
static gboolean rygel_client_hacks_real_force_seek (RygelClientHacks* self);
static void rygel_client_hacks_real_modify_headers (RygelClientHacks* self,
                                             RygelHTTPRequest* request);
static void rygel_client_hacks_real_search_data_free (gpointer _data);
static void rygel_client_hacks_real_search (RygelClientHacks* self,
                                     RygelSearchableContainer* container,
                                     RygelSearchExpression* expression,
                                     guint offset,
                                     guint max_count,
                                     const gchar* sort_criteria,
                                     GCancellable* cancellable,
                                     GAsyncReadyCallback _callback_,
                                     gpointer _user_data_);
static gboolean rygel_client_hacks_real_search_co (RygelClientHacksSearchData* _data_);
static void rygel_client_hacks_search_ready (GObject* source_object,
                                      GAsyncResult* _res_,
                                      gpointer _user_data_);
VALA_EXTERN const gchar* rygel_client_hacks_get_object_id (RygelClientHacks* self);
VALA_EXTERN void rygel_client_hacks_set_object_id (RygelClientHacks* self,
                                       const gchar* value);
static void rygel_client_hacks_finalize (GObject * obj);
static GType rygel_client_hacks_get_type_once (void);
static void _vala_rygel_client_hacks_get_property (GObject * object,
                                            guint property_id,
                                            GValue * value,
                                            GParamSpec * pspec);
static void _vala_rygel_client_hacks_set_property (GObject * object,
                                            guint property_id,
                                            const GValue * value,
                                            GParamSpec * pspec);
static inline gpointer _vala_memdup2 (gconstpointer mem,
                        gsize byte_size);

GQuark
rygel_client_hacks_error_quark (void)
{
	return g_quark_from_static_string ("rygel-client-hacks-error-quark");
}

 G_GNUC_NO_INLINE static GType
rygel_client_hacks_error_get_type_once (void)
{
	static const GEnumValue values[] = {{RYGEL_CLIENT_HACKS_ERROR_NA, "RYGEL_CLIENT_HACKS_ERROR_NA", "na"}, {0, NULL, NULL}};
	GType rygel_client_hacks_error_type_id;
	rygel_client_hacks_error_type_id = g_enum_register_static ("RygelClientHacksError", values);
	return rygel_client_hacks_error_type_id;
}

GType
rygel_client_hacks_error_get_type (void)
{
	static volatile gsize rygel_client_hacks_error_type_id__once = 0;
	if (g_once_init_enter (&rygel_client_hacks_error_type_id__once)) {
		GType rygel_client_hacks_error_type_id;
		rygel_client_hacks_error_type_id = rygel_client_hacks_error_get_type_once ();
		g_once_init_leave (&rygel_client_hacks_error_type_id__once, rygel_client_hacks_error_type_id);
	}
	return rygel_client_hacks_error_type_id__once;
}

static inline gpointer
rygel_client_hacks_get_instance_private (RygelClientHacks* self)
{
	return G_STRUCT_MEMBER_P (self, RygelClientHacks_private_offset);
}

RygelClientHacks*
rygel_client_hacks_construct (GType object_type,
                              const gchar* agent,
                              SoupServerMessage* message,
                              GError** error)
{
	RygelClientHacks * self = NULL;
	GError* _inner_error0_ = NULL;
	g_return_val_if_fail (agent != NULL, NULL);
	self = (RygelClientHacks*) g_object_new (object_type, NULL);
	{
		GRegex* _tmp0_ = NULL;
		GRegex* _tmp1_;
		GRegex* _tmp2_;
		_tmp1_ = g_regex_new (agent, G_REGEX_CASELESS | G_REGEX_RAW, 0, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == G_REGEX_ERROR) {
				goto __catch0_g_regex_error;
			}
			g_critical ("file %s: line %d: unexpected error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		_g_regex_unref0 (self->agent_regex);
		self->agent_regex = _tmp2_;
		_g_regex_unref0 (_tmp0_);
	}
	goto __finally0;
	__catch0_g_regex_error:
	{
		g_clear_error (&_inner_error0_);
		g_assert_not_reached ();
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_object_unref0 (self);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	if (message != NULL) {
		rygel_client_hacks_check_headers (self, message, &_inner_error0_);
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
				g_propagate_error (error, _inner_error0_);
				_g_object_unref0 (self);
				return NULL;
			} else {
				g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
				g_clear_error (&_inner_error0_);
				return NULL;
			}
		}
	}
	return self;
}

RygelClientHacks*
rygel_client_hacks_create (SoupServerMessage* message,
                           GError** error)
{
	RygelXBMCHacks* _tmp27_ = NULL;
	RygelXBMCHacks* _tmp28_;
	RygelXBMCHacks* _tmp29_;
	GError* _inner_error0_ = NULL;
	RygelClientHacks* result;
	{
		RygelPanasonicHacks* _tmp0_ = NULL;
		RygelPanasonicHacks* _tmp1_;
		RygelPanasonicHacks* _tmp2_;
		_tmp1_ = rygel_panasonic_hacks_new (message, &_inner_error0_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch0_g_error;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		result = (RygelClientHacks*) _tmp2_;
		_g_object_unref0 (_tmp0_);
		return result;
	}
	goto __finally0;
	__catch0_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally0:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		RygelXBMC4XBoxHacks* _tmp3_ = NULL;
		RygelXBMC4XBoxHacks* _tmp4_;
		RygelXBMC4XBoxHacks* _tmp5_;
		_tmp4_ = rygel_xbm_c4_xbox_hacks_new (message, &_inner_error0_);
		_tmp3_ = _tmp4_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch1_g_error;
		}
		_tmp5_ = _tmp3_;
		_tmp3_ = NULL;
		result = (RygelClientHacks*) _tmp5_;
		_g_object_unref0 (_tmp3_);
		return result;
	}
	goto __finally1;
	__catch1_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally1:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		RygelXBoxHacks* _tmp6_ = NULL;
		RygelXBoxHacks* _tmp7_;
		RygelXBoxHacks* _tmp8_;
		_tmp7_ = rygel_xbox_hacks_new (message, &_inner_error0_);
		_tmp6_ = _tmp7_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch2_g_error;
		}
		_tmp8_ = _tmp6_;
		_tmp6_ = NULL;
		result = (RygelClientHacks*) _tmp8_;
		_g_object_unref0 (_tmp6_);
		return result;
	}
	goto __finally2;
	__catch2_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally2:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		RygelWMPHacks* _tmp9_ = NULL;
		RygelWMPHacks* _tmp10_;
		RygelWMPHacks* _tmp11_;
		_tmp10_ = rygel_wmp_hacks_new (message, &_inner_error0_);
		_tmp9_ = _tmp10_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch3_g_error;
		}
		_tmp11_ = _tmp9_;
		_tmp9_ = NULL;
		result = (RygelClientHacks*) _tmp11_;
		_g_object_unref0 (_tmp9_);
		return result;
	}
	goto __finally3;
	__catch3_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally3:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		RygelSamsungTVHacks* _tmp12_ = NULL;
		RygelSamsungTVHacks* _tmp13_;
		RygelSamsungTVHacks* _tmp14_;
		_tmp13_ = rygel_samsung_tv_hacks_new (message, &_inner_error0_);
		_tmp12_ = _tmp13_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch4_g_error;
		}
		_tmp14_ = _tmp12_;
		_tmp12_ = NULL;
		result = (RygelClientHacks*) _tmp14_;
		_g_object_unref0 (_tmp12_);
		return result;
	}
	goto __finally4;
	__catch4_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally4:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		RygelSeekHacks* _tmp15_ = NULL;
		RygelSeekHacks* _tmp16_;
		RygelSeekHacks* _tmp17_;
		_tmp16_ = rygel_seek_hacks_new (message, &_inner_error0_);
		_tmp15_ = _tmp16_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch5_g_error;
		}
		_tmp17_ = _tmp15_;
		_tmp15_ = NULL;
		result = (RygelClientHacks*) _tmp17_;
		_g_object_unref0 (_tmp15_);
		return result;
	}
	goto __finally5;
	__catch5_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally5:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		RygelLGTVHacks* _tmp18_ = NULL;
		RygelLGTVHacks* _tmp19_;
		RygelLGTVHacks* _tmp20_;
		_tmp19_ = rygel_lgtv_hacks_new (message, &_inner_error0_);
		_tmp18_ = _tmp19_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch6_g_error;
		}
		_tmp20_ = _tmp18_;
		_tmp18_ = NULL;
		result = (RygelClientHacks*) _tmp20_;
		_g_object_unref0 (_tmp18_);
		return result;
	}
	goto __finally6;
	__catch6_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally6:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		RygelPhillipsHacks* _tmp21_ = NULL;
		RygelPhillipsHacks* _tmp22_;
		RygelPhillipsHacks* _tmp23_;
		_tmp22_ = rygel_phillips_hacks_new (message, &_inner_error0_);
		_tmp21_ = _tmp22_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch7_g_error;
		}
		_tmp23_ = _tmp21_;
		_tmp21_ = NULL;
		result = (RygelClientHacks*) _tmp23_;
		_g_object_unref0 (_tmp21_);
		return result;
	}
	goto __finally7;
	__catch7_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally7:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	{
		RygelRaumfeldHacks* _tmp24_ = NULL;
		RygelRaumfeldHacks* _tmp25_;
		RygelRaumfeldHacks* _tmp26_;
		_tmp25_ = rygel_raumfeld_hacks_new (message, &_inner_error0_);
		_tmp24_ = _tmp25_;
		if (G_UNLIKELY (_inner_error0_ != NULL)) {
			goto __catch8_g_error;
		}
		_tmp26_ = _tmp24_;
		_tmp24_ = NULL;
		result = (RygelClientHacks*) _tmp26_;
		_g_object_unref0 (_tmp24_);
		return result;
	}
	goto __finally8;
	__catch8_g_error:
	{
		g_clear_error (&_inner_error0_);
	}
	__finally8:
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	_tmp28_ = rygel_xbmc_hacks_new (message, NULL, &_inner_error0_);
	_tmp27_ = _tmp28_;
	if (G_UNLIKELY (_inner_error0_ != NULL)) {
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			return NULL;
		} else {
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return NULL;
		}
	}
	_tmp29_ = _tmp27_;
	_tmp27_ = NULL;
	result = (RygelClientHacks*) _tmp29_;
	_g_object_unref0 (_tmp27_);
	return result;
}

static void
rygel_client_hacks_real_translate_container_id (RygelClientHacks* self,
                                                RygelMediaQueryAction* action,
                                                gchar** container_id)
{
	g_return_if_fail (action != NULL);
	g_return_if_fail (*container_id != NULL);
}

void
rygel_client_hacks_translate_container_id (RygelClientHacks* self,
                                           RygelMediaQueryAction* action,
                                           gchar** container_id)
{
	RygelClientHacksClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = RYGEL_CLIENT_HACKS_GET_CLASS (self);
	if (_klass_->translate_container_id) {
		_klass_->translate_container_id (self, action, container_id);
	}
}

/**
     * Modify the passed media object.
     *
     * Called before serializing the Object to DIDL-Lite.
     */
static void
rygel_client_hacks_real_apply (RygelClientHacks* self,
                               RygelMediaObject* object)
{
	g_return_if_fail (object != NULL);
}

void
rygel_client_hacks_apply (RygelClientHacks* self,
                          RygelMediaObject* object)
{
	RygelClientHacksClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = RYGEL_CLIENT_HACKS_GET_CLASS (self);
	if (_klass_->apply) {
		_klass_->apply (self, object);
	}
}

static void
rygel_client_hacks_real_filter_sort_criteria (RygelClientHacks* self,
                                              gchar** sort_criteria)
{
	g_return_if_fail (*sort_criteria != NULL);
}

void
rygel_client_hacks_filter_sort_criteria (RygelClientHacks* self,
                                         gchar** sort_criteria)
{
	RygelClientHacksClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = RYGEL_CLIENT_HACKS_GET_CLASS (self);
	if (_klass_->filter_sort_criteria) {
		_klass_->filter_sort_criteria (self, sort_criteria);
	}
}

static gboolean
rygel_client_hacks_real_force_seek (RygelClientHacks* self)
{
	gboolean result;
	result = FALSE;
	return result;
}

gboolean
rygel_client_hacks_force_seek (RygelClientHacks* self)
{
	RygelClientHacksClass* _klass_;
	g_return_val_if_fail (self != NULL, FALSE);
	_klass_ = RYGEL_CLIENT_HACKS_GET_CLASS (self);
	if (_klass_->force_seek) {
		return _klass_->force_seek (self);
	}
	return FALSE;
}

static void
rygel_client_hacks_real_modify_headers (RygelClientHacks* self,
                                        RygelHTTPRequest* request)
{
	g_return_if_fail (request != NULL);
}

void
rygel_client_hacks_modify_headers (RygelClientHacks* self,
                                   RygelHTTPRequest* request)
{
	RygelClientHacksClass* _klass_;
	g_return_if_fail (self != NULL);
	_klass_ = RYGEL_CLIENT_HACKS_GET_CLASS (self);
	if (_klass_->modify_headers) {
		_klass_->modify_headers (self, request);
	}
}

static void
rygel_client_hacks_real_search_data_free (gpointer _data)
{
	RygelClientHacksSearchData* _data_;
	_data_ = _data;
	_g_object_unref0 (_data_->container);
	_rygel_search_expression_unref0 (_data_->expression);
	_g_free0 (_data_->sort_criteria);
	_g_object_unref0 (_data_->cancellable);
	_g_object_unref0 (_data_->result);
	_g_object_unref0 (_data_->self);
	g_slice_free (RygelClientHacksSearchData, _data_);
}

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

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

static void
rygel_client_hacks_real_search (RygelClientHacks* self,
                                RygelSearchableContainer* container,
                                RygelSearchExpression* expression,
                                guint offset,
                                guint max_count,
                                const gchar* sort_criteria,
                                GCancellable* cancellable,
                                GAsyncReadyCallback _callback_,
                                gpointer _user_data_)
{
	RygelClientHacksSearchData* _data_;
	RygelClientHacks* _tmp0_;
	RygelSearchableContainer* _tmp1_;
	RygelSearchExpression* _tmp2_;
	gchar* _tmp3_;
	GCancellable* _tmp4_;
	g_return_if_fail (container != NULL);
	g_return_if_fail (sort_criteria != NULL);
	_data_ = g_slice_new0 (RygelClientHacksSearchData);
	_data_->_async_result = g_task_new (G_OBJECT (self), cancellable, _callback_, _user_data_);
	g_task_set_task_data (_data_->_async_result, _data_, rygel_client_hacks_real_search_data_free);
	_tmp0_ = _g_object_ref0 (self);
	_data_->self = _tmp0_;
	_tmp1_ = _g_object_ref0 (container);
	_g_object_unref0 (_data_->container);
	_data_->container = _tmp1_;
	_tmp2_ = _rygel_search_expression_ref0 (expression);
	_rygel_search_expression_unref0 (_data_->expression);
	_data_->expression = _tmp2_;
	_data_->offset = offset;
	_data_->max_count = max_count;
	_tmp3_ = g_strdup (sort_criteria);
	_g_free0 (_data_->sort_criteria);
	_data_->sort_criteria = _tmp3_;
	_tmp4_ = _g_object_ref0 (cancellable);
	_g_object_unref0 (_data_->cancellable);
	_data_->cancellable = _tmp4_;
	rygel_client_hacks_real_search_co (_data_);
}

static RygelMediaObjects*
rygel_client_hacks_real_search_finish (RygelClientHacks* self,
                                       GAsyncResult* _res_,
                                       guint* total_matches,
                                       GError** error)
{
	RygelMediaObjects* result;
	RygelClientHacksSearchData* _data_;
	_data_ = g_task_propagate_pointer (G_TASK (_res_), error);
	if (NULL == _data_) {
		return NULL;
	}
	if (total_matches) {
		*total_matches = _data_->total_matches;
	}
	result = _data_->result;
	_data_->result = NULL;
	return result;
}

static void
rygel_client_hacks_search_ready (GObject* source_object,
                                 GAsyncResult* _res_,
                                 gpointer _user_data_)
{
	RygelClientHacksSearchData* _data_;
	_data_ = _user_data_;
	_data_->_source_object_ = source_object;
	_data_->_res_ = _res_;
	rygel_client_hacks_real_search_co (_data_);
}

static gboolean
rygel_client_hacks_real_search_co (RygelClientHacksSearchData* _data_)
{
	switch (_data_->_state_) {
		case 0:
		goto _state_0;
		case 1:
		goto _state_1;
		default:
		g_assert_not_reached ();
	}
	_state_0:
	_data_->_tmp1_ = 0U;
	_data_->_state_ = 1;
	rygel_searchable_container_search (_data_->container, _data_->expression, _data_->offset, _data_->max_count, _data_->sort_criteria, _data_->cancellable, rygel_client_hacks_search_ready, _data_);
	return FALSE;
	_state_1:
	_data_->_tmp2_ = rygel_searchable_container_search_finish (_data_->container, _data_->_res_, &_data_->_tmp1_, &_data_->_inner_error0_);
	_data_->total_matches = _data_->_tmp1_;
	_data_->_tmp0_ = _data_->_tmp2_;
	if (G_UNLIKELY (_data_->_inner_error0_ != NULL)) {
		g_task_return_error (_data_->_async_result, _data_->_inner_error0_);
		g_object_unref (_data_->_async_result);
		return FALSE;
	}
	_data_->_tmp3_ = _data_->_tmp0_;
	_data_->_tmp0_ = NULL;
	_data_->result = _data_->_tmp3_;
	_g_object_unref0 (_data_->_tmp0_);
	g_task_return_pointer (_data_->_async_result, _data_, NULL);
	if (_data_->_state_ != 0) {
		while (!g_task_get_completed (_data_->_async_result)) {
			g_main_context_iteration (g_task_get_context (_data_->_async_result), TRUE);
		}
	}
	g_object_unref (_data_->_async_result);
	return FALSE;
}

void
rygel_client_hacks_search (RygelClientHacks* self,
                           RygelSearchableContainer* container,
                           RygelSearchExpression* expression,
                           guint offset,
                           guint max_count,
                           const gchar* sort_criteria,
                           GCancellable* cancellable,
                           GAsyncReadyCallback _callback_,
                           gpointer _user_data_)
{
	RygelClientHacksClass* _klass_;
	_klass_ = RYGEL_CLIENT_HACKS_GET_CLASS (self);
	if (_klass_->search) {
		_klass_->search (self, container, expression, offset, max_count, sort_criteria, cancellable, _callback_, _user_data_);
	}
}

RygelMediaObjects*
rygel_client_hacks_search_finish (RygelClientHacks* self,
                                  GAsyncResult* _res_,
                                  guint* total_matches,
                                  GError** error)
{
	RygelClientHacksClass* _klass_;
	_klass_ = RYGEL_CLIENT_HACKS_GET_CLASS (self);
	if (_klass_->search_finish) {
		return _klass_->search_finish (self, _res_, total_matches, error);
	}
	return NULL;
}

static gpointer
_soup_message_headers_ref0 (gpointer self)
{
	return self ? soup_message_headers_ref (self) : NULL;
}

static void
rygel_client_hacks_check_headers (RygelClientHacks* self,
                                  SoupServerMessage* message,
                                  GError** error)
{
	SoupMessageHeaders* headers = NULL;
	SoupMessageHeaders* _tmp0_;
	SoupMessageHeaders* _tmp1_;
	gchar* remote_ip = NULL;
	gchar* _tmp2_;
	gchar* agent = NULL;
	SoupMessageHeaders* _tmp3_;
	const gchar* _tmp4_;
	gchar* _tmp5_;
	gboolean _tmp6_ = FALSE;
	const gchar* _tmp7_;
	const gchar* _tmp12_;
	gboolean _tmp18_ = FALSE;
	const gchar* _tmp19_;
	GError* _inner_error0_ = NULL;
	g_return_if_fail (self != NULL);
	g_return_if_fail (message != NULL);
	_tmp0_ = soup_server_message_get_request_headers (message);
	_tmp1_ = _soup_message_headers_ref0 (_tmp0_);
	headers = _tmp1_;
	_tmp2_ = g_strdup ("127.0.0.1");
	remote_ip = _tmp2_;
	_tmp3_ = headers;
	_tmp4_ = soup_message_headers_get_one (_tmp3_, "User-Agent");
	_tmp5_ = g_strdup (_tmp4_);
	agent = _tmp5_;
	_tmp7_ = agent;
	if (_tmp7_ == NULL) {
		GeeHashMap* _tmp8_;
		_tmp8_ = rygel_client_hacks_client_agent_cache;
		_tmp6_ = _tmp8_ != NULL;
	} else {
		_tmp6_ = FALSE;
	}
	if (_tmp6_) {
		GeeHashMap* _tmp9_;
		const gchar* _tmp10_;
		gpointer _tmp11_;
		_tmp9_ = rygel_client_hacks_client_agent_cache;
		_tmp10_ = remote_ip;
		_tmp11_ = gee_abstract_map_get ((GeeAbstractMap*) _tmp9_, _tmp10_);
		_g_free0 (agent);
		agent = (gchar*) _tmp11_;
	}
	_tmp12_ = agent;
	if (_tmp12_ != NULL) {
		GeeHashMap* _tmp13_;
		GeeHashMap* _tmp15_;
		const gchar* _tmp16_;
		const gchar* _tmp17_;
		_tmp13_ = rygel_client_hacks_client_agent_cache;
		if (_tmp13_ == NULL) {
			GeeHashMap* _tmp14_;
			_tmp14_ = gee_hash_map_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, (GDestroyNotify) g_free, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL);
			_g_object_unref0 (rygel_client_hacks_client_agent_cache);
			rygel_client_hacks_client_agent_cache = _tmp14_;
		}
		_tmp15_ = rygel_client_hacks_client_agent_cache;
		_tmp16_ = remote_ip;
		_tmp17_ = agent;
		gee_abstract_map_set ((GeeAbstractMap*) _tmp15_, _tmp16_, _tmp17_);
	}
	_tmp19_ = agent;
	if (_tmp19_ == NULL) {
		_tmp18_ = TRUE;
	} else {
		GRegex* _tmp20_;
		const gchar* _tmp21_;
		_tmp20_ = self->agent_regex;
		_tmp21_ = agent;
		_tmp18_ = !g_regex_match (_tmp20_, _tmp21_, 0, NULL);
	}
	if (_tmp18_) {
		GError* _tmp22_;
		_tmp22_ = g_error_new_literal (RYGEL_CLIENT_HACKS_ERROR, RYGEL_CLIENT_HACKS_ERROR_NA, _ ("Not Applicable"));
		_inner_error0_ = _tmp22_;
		if (_inner_error0_->domain == RYGEL_CLIENT_HACKS_ERROR) {
			g_propagate_error (error, _inner_error0_);
			_g_free0 (agent);
			_g_free0 (remote_ip);
			_soup_message_headers_unref0 (headers);
			return;
		} else {
			_g_free0 (agent);
			_g_free0 (remote_ip);
			_soup_message_headers_unref0 (headers);
			g_critical ("file %s: line %d: uncaught error: %s (%s, %d)", __FILE__, __LINE__, _inner_error0_->message, g_quark_to_string (_inner_error0_->domain), _inner_error0_->code);
			g_clear_error (&_inner_error0_);
			return;
		}
	}
	_g_free0 (agent);
	_g_free0 (remote_ip);
	_soup_message_headers_unref0 (headers);
}

const gchar*
rygel_client_hacks_get_object_id (RygelClientHacks* self)
{
	const gchar* result;
	const gchar* _tmp0_;
	g_return_val_if_fail (self != NULL, NULL);
	_tmp0_ = self->priv->_object_id;
	result = _tmp0_;
	return result;
}

void
rygel_client_hacks_set_object_id (RygelClientHacks* self,
                                  const gchar* value)
{
	const gchar* old_value;
	g_return_if_fail (self != NULL);
	old_value = rygel_client_hacks_get_object_id (self);
	if (g_strcmp0 (value, old_value) != 0) {
		self->priv->_object_id = value;
		g_object_notify_by_pspec ((GObject *) self, rygel_client_hacks_properties[RYGEL_CLIENT_HACKS_OBJECT_ID_PROPERTY]);
	}
}

static void
rygel_client_hacks_class_init (RygelClientHacksClass * klass,
                               gpointer klass_data)
{
	rygel_client_hacks_parent_class = g_type_class_peek_parent (klass);
	g_type_class_adjust_private_offset (klass, &RygelClientHacks_private_offset);
	((RygelClientHacksClass *) klass)->translate_container_id = (void (*) (RygelClientHacks*, RygelMediaQueryAction*, gchar**)) rygel_client_hacks_real_translate_container_id;
	((RygelClientHacksClass *) klass)->apply = (void (*) (RygelClientHacks*, RygelMediaObject*)) rygel_client_hacks_real_apply;
	((RygelClientHacksClass *) klass)->filter_sort_criteria = (void (*) (RygelClientHacks*, gchar**)) rygel_client_hacks_real_filter_sort_criteria;
	((RygelClientHacksClass *) klass)->force_seek = (gboolean (*) (RygelClientHacks*)) rygel_client_hacks_real_force_seek;
	((RygelClientHacksClass *) klass)->modify_headers = (void (*) (RygelClientHacks*, RygelHTTPRequest*)) rygel_client_hacks_real_modify_headers;
	((RygelClientHacksClass *) klass)->search = (void (*) (RygelClientHacks*, RygelSearchableContainer*, RygelSearchExpression*, guint, guint, const gchar*, GCancellable*, GAsyncReadyCallback, gpointer)) rygel_client_hacks_real_search;
	((RygelClientHacksClass *) klass)->search_finish = (RygelMediaObjects* (*) (RygelClientHacks*, GAsyncResult*, guint*, GError**)) rygel_client_hacks_real_search_finish;
	G_OBJECT_CLASS (klass)->get_property = _vala_rygel_client_hacks_get_property;
	G_OBJECT_CLASS (klass)->set_property = _vala_rygel_client_hacks_set_property;
	G_OBJECT_CLASS (klass)->finalize = rygel_client_hacks_finalize;
	g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_CLIENT_HACKS_OBJECT_ID_PROPERTY, rygel_client_hacks_properties[RYGEL_CLIENT_HACKS_OBJECT_ID_PROPERTY] = g_param_spec_string ("object-id", "object-id", "object-id", NULL, G_PARAM_STATIC_STRINGS | G_PARAM_READABLE | G_PARAM_WRITABLE));
}

static void
rygel_client_hacks_instance_init (RygelClientHacks * self,
                                  gpointer klass)
{
	self->priv = rygel_client_hacks_get_instance_private (self);
	self->priv->_object_id = RYGEL_CLIENT_HACKS_CORRECT_OBJECT_ID;
}

static void
rygel_client_hacks_finalize (GObject * obj)
{
	RygelClientHacks * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_CLIENT_HACKS, RygelClientHacks);
	_g_regex_unref0 (self->agent_regex);
	G_OBJECT_CLASS (rygel_client_hacks_parent_class)->finalize (obj);
}

 G_GNUC_NO_INLINE static GType
rygel_client_hacks_get_type_once (void)
{
	static const GTypeInfo g_define_type_info = { sizeof (RygelClientHacksClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_client_hacks_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelClientHacks), 0, (GInstanceInitFunc) rygel_client_hacks_instance_init, NULL };
	GType rygel_client_hacks_type_id;
	rygel_client_hacks_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelClientHacks", &g_define_type_info, G_TYPE_FLAG_ABSTRACT);
	RygelClientHacks_private_offset = g_type_add_instance_private (rygel_client_hacks_type_id, sizeof (RygelClientHacksPrivate));
	return rygel_client_hacks_type_id;
}

GType
rygel_client_hacks_get_type (void)
{
	static volatile gsize rygel_client_hacks_type_id__once = 0;
	if (g_once_init_enter (&rygel_client_hacks_type_id__once)) {
		GType rygel_client_hacks_type_id;
		rygel_client_hacks_type_id = rygel_client_hacks_get_type_once ();
		g_once_init_leave (&rygel_client_hacks_type_id__once, rygel_client_hacks_type_id);
	}
	return rygel_client_hacks_type_id__once;
}

static void
_vala_rygel_client_hacks_get_property (GObject * object,
                                       guint property_id,
                                       GValue * value,
                                       GParamSpec * pspec)
{
	RygelClientHacks * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_TYPE_CLIENT_HACKS, RygelClientHacks);
	switch (property_id) {
		case RYGEL_CLIENT_HACKS_OBJECT_ID_PROPERTY:
		g_value_set_string (value, rygel_client_hacks_get_object_id (self));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

static void
_vala_rygel_client_hacks_set_property (GObject * object,
                                       guint property_id,
                                       const GValue * value,
                                       GParamSpec * pspec)
{
	RygelClientHacks * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_TYPE_CLIENT_HACKS, RygelClientHacks);
	switch (property_id) {
		case RYGEL_CLIENT_HACKS_OBJECT_ID_PROPERTY:
		rygel_client_hacks_set_object_id (self, g_value_get_string (value));
		break;
		default:
		G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
		break;
	}
}

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

