/* rygel-gst-media-engine.c generated by valac 0.20.1.2-ca5c2, the Vala compiler
 * generated from rygel-gst-media-engine.vala, do not modify */

/*
 * Copyright (C) 2012 Intel Corporation.
 *
 * Author: 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 <stdlib.h>
#include <string.h>
#include <rygel-server.h>
#include <gst/gst.h>
#include <libgupnp-dlna/gupnp-dlna.h>
#include <gee.h>
#include <rygel-core.h>


#define RYGEL_TYPE_GST_MEDIA_ENGINE (rygel_gst_media_engine_get_type ())
#define RYGEL_GST_MEDIA_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_GST_MEDIA_ENGINE, RygelGstMediaEngine))
#define RYGEL_GST_MEDIA_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_GST_MEDIA_ENGINE, RygelGstMediaEngineClass))
#define RYGEL_IS_GST_MEDIA_ENGINE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_GST_MEDIA_ENGINE))
#define RYGEL_IS_GST_MEDIA_ENGINE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_GST_MEDIA_ENGINE))
#define RYGEL_GST_MEDIA_ENGINE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_GST_MEDIA_ENGINE, RygelGstMediaEngineClass))

typedef struct _RygelGstMediaEngine RygelGstMediaEngine;
typedef struct _RygelGstMediaEngineClass RygelGstMediaEngineClass;
typedef struct _RygelGstMediaEnginePrivate RygelGstMediaEnginePrivate;
#define __g_list_free__rygel_dlna_profile_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__rygel_dlna_profile_unref0_ (var), NULL)))
#define __g_list_free__g_object_unref0_0(var) ((var == NULL) ? NULL : (var = (_g_list_free__g_object_unref0_ (var), NULL)))
#define _rygel_dlna_profile_unref0(var) ((var == NULL) ? NULL : (var = (rygel_dlna_profile_unref (var), NULL)))
#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))

#define RYGEL_TYPE_GST_TRANSCODER (rygel_gst_transcoder_get_type ())
#define RYGEL_GST_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_GST_TRANSCODER, RygelGstTranscoder))
#define RYGEL_GST_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_GST_TRANSCODER, RygelGstTranscoderClass))
#define RYGEL_IS_GST_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_GST_TRANSCODER))
#define RYGEL_IS_GST_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_GST_TRANSCODER))
#define RYGEL_GST_TRANSCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_GST_TRANSCODER, RygelGstTranscoderClass))

typedef struct _RygelGstTranscoder RygelGstTranscoder;
typedef struct _RygelGstTranscoderClass RygelGstTranscoderClass;

#define RYGEL_TYPE_AUDIO_TRANSCODER (rygel_audio_transcoder_get_type ())
#define RYGEL_AUDIO_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_AUDIO_TRANSCODER, RygelAudioTranscoder))
#define RYGEL_AUDIO_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_AUDIO_TRANSCODER, RygelAudioTranscoderClass))
#define RYGEL_IS_AUDIO_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_AUDIO_TRANSCODER))
#define RYGEL_IS_AUDIO_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_AUDIO_TRANSCODER))
#define RYGEL_AUDIO_TRANSCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_AUDIO_TRANSCODER, RygelAudioTranscoderClass))

typedef struct _RygelAudioTranscoder RygelAudioTranscoder;
typedef struct _RygelAudioTranscoderClass RygelAudioTranscoderClass;

#define RYGEL_TYPE_L16_TRANSCODER (rygel_l16_transcoder_get_type ())
#define RYGEL_L16_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_L16_TRANSCODER, RygelL16Transcoder))
#define RYGEL_L16_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_L16_TRANSCODER, RygelL16TranscoderClass))
#define RYGEL_IS_L16_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_L16_TRANSCODER))
#define RYGEL_IS_L16_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_L16_TRANSCODER))
#define RYGEL_L16_TRANSCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_L16_TRANSCODER, RygelL16TranscoderClass))

typedef struct _RygelL16Transcoder RygelL16Transcoder;
typedef struct _RygelL16TranscoderClass RygelL16TranscoderClass;

#define RYGEL_TYPE_MP3_TRANSCODER (rygel_mp3_transcoder_get_type ())
#define RYGEL_MP3_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MP3_TRANSCODER, RygelMP3Transcoder))
#define RYGEL_MP3_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MP3_TRANSCODER, RygelMP3TranscoderClass))
#define RYGEL_IS_MP3_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MP3_TRANSCODER))
#define RYGEL_IS_MP3_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MP3_TRANSCODER))
#define RYGEL_MP3_TRANSCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MP3_TRANSCODER, RygelMP3TranscoderClass))

typedef struct _RygelMP3Transcoder RygelMP3Transcoder;
typedef struct _RygelMP3TranscoderClass RygelMP3TranscoderClass;

#define RYGEL_TYPE_MP2_TS_PROFILE (rygel_mp2_ts_profile_get_type ())

#define RYGEL_TYPE_VIDEO_TRANSCODER (rygel_video_transcoder_get_type ())
#define RYGEL_VIDEO_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_VIDEO_TRANSCODER, RygelVideoTranscoder))
#define RYGEL_VIDEO_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_VIDEO_TRANSCODER, RygelVideoTranscoderClass))
#define RYGEL_IS_VIDEO_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_VIDEO_TRANSCODER))
#define RYGEL_IS_VIDEO_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_VIDEO_TRANSCODER))
#define RYGEL_VIDEO_TRANSCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_VIDEO_TRANSCODER, RygelVideoTranscoderClass))

typedef struct _RygelVideoTranscoder RygelVideoTranscoder;
typedef struct _RygelVideoTranscoderClass RygelVideoTranscoderClass;

#define RYGEL_TYPE_MP2_TS_TRANSCODER (rygel_mp2_ts_transcoder_get_type ())
#define RYGEL_MP2_TS_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_MP2_TS_TRANSCODER, RygelMP2TSTranscoder))
#define RYGEL_MP2_TS_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_MP2_TS_TRANSCODER, RygelMP2TSTranscoderClass))
#define RYGEL_IS_MP2_TS_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_MP2_TS_TRANSCODER))
#define RYGEL_IS_MP2_TS_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_MP2_TS_TRANSCODER))
#define RYGEL_MP2_TS_TRANSCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_MP2_TS_TRANSCODER, RygelMP2TSTranscoderClass))

typedef struct _RygelMP2TSTranscoder RygelMP2TSTranscoder;
typedef struct _RygelMP2TSTranscoderClass RygelMP2TSTranscoderClass;

#define RYGEL_TYPE_WMV_TRANSCODER (rygel_wmv_transcoder_get_type ())
#define RYGEL_WMV_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_WMV_TRANSCODER, RygelWMVTranscoder))
#define RYGEL_WMV_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_WMV_TRANSCODER, RygelWMVTranscoderClass))
#define RYGEL_IS_WMV_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_WMV_TRANSCODER))
#define RYGEL_IS_WMV_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_WMV_TRANSCODER))
#define RYGEL_WMV_TRANSCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_WMV_TRANSCODER, RygelWMVTranscoderClass))

typedef struct _RygelWMVTranscoder RygelWMVTranscoder;
typedef struct _RygelWMVTranscoderClass RygelWMVTranscoderClass;

#define RYGEL_TYPE_AAC_TRANSCODER (rygel_aac_transcoder_get_type ())
#define RYGEL_AAC_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_AAC_TRANSCODER, RygelAACTranscoder))
#define RYGEL_AAC_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_AAC_TRANSCODER, RygelAACTranscoderClass))
#define RYGEL_IS_AAC_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_AAC_TRANSCODER))
#define RYGEL_IS_AAC_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_AAC_TRANSCODER))
#define RYGEL_AAC_TRANSCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_AAC_TRANSCODER, RygelAACTranscoderClass))

typedef struct _RygelAACTranscoder RygelAACTranscoder;
typedef struct _RygelAACTranscoderClass RygelAACTranscoderClass;

#define RYGEL_TYPE_AVC_TRANSCODER (rygel_avc_transcoder_get_type ())
#define RYGEL_AVC_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_AVC_TRANSCODER, RygelAVCTranscoder))
#define RYGEL_AVC_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_AVC_TRANSCODER, RygelAVCTranscoderClass))
#define RYGEL_IS_AVC_TRANSCODER(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_AVC_TRANSCODER))
#define RYGEL_IS_AVC_TRANSCODER_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_AVC_TRANSCODER))
#define RYGEL_AVC_TRANSCODER_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_AVC_TRANSCODER, RygelAVCTranscoderClass))

typedef struct _RygelAVCTranscoder RygelAVCTranscoder;
typedef struct _RygelAVCTranscoderClass RygelAVCTranscoderClass;
#define _g_free0(var) (var = (g_free (var), NULL))

#define RYGEL_TYPE_GST_DATA_SOURCE (rygel_gst_data_source_get_type ())
#define RYGEL_GST_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_TYPE_GST_DATA_SOURCE, RygelGstDataSource))
#define RYGEL_GST_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_TYPE_GST_DATA_SOURCE, RygelGstDataSourceClass))
#define RYGEL_IS_GST_DATA_SOURCE(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_TYPE_GST_DATA_SOURCE))
#define RYGEL_IS_GST_DATA_SOURCE_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_TYPE_GST_DATA_SOURCE))
#define RYGEL_GST_DATA_SOURCE_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_TYPE_GST_DATA_SOURCE, RygelGstDataSourceClass))

typedef struct _RygelGstDataSource RygelGstDataSource;
typedef struct _RygelGstDataSourceClass RygelGstDataSourceClass;

struct _RygelGstMediaEngine {
	RygelMediaEngine parent_instance;
	RygelGstMediaEnginePrivate * priv;
};

struct _RygelGstMediaEngineClass {
	RygelMediaEngineClass parent_class;
};

struct _RygelGstMediaEnginePrivate {
	GList* dlna_profiles;
	GList* transcoders;
};

typedef enum  {
	RYGEL_MP2_TS_PROFILE_SD_EU = 0,
	RYGEL_MP2_TS_PROFILE_SD_NA,
	RYGEL_MP2_TS_PROFILE_HD_NA
} RygelMP2TSProfile;


static gpointer rygel_gst_media_engine_parent_class = NULL;

gboolean gst_preset_set_app_dir (const gchar* app_dir);
GType rygel_gst_media_engine_get_type (void) G_GNUC_CONST;
#define RYGEL_GST_MEDIA_ENGINE_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_GST_MEDIA_ENGINE, RygelGstMediaEnginePrivate))
enum  {
	RYGEL_GST_MEDIA_ENGINE_DUMMY_PROPERTY
};
static void _rygel_dlna_profile_unref0_ (gpointer var);
static void _g_list_free__rygel_dlna_profile_unref0_ (GList* self);
static void _g_object_unref0_ (gpointer var);
static void _g_list_free__g_object_unref0_ (GList* self);
RygelGstMediaEngine* rygel_gst_media_engine_new (void);
RygelGstMediaEngine* rygel_gst_media_engine_construct (GType object_type);
RygelL16Transcoder* rygel_l16_transcoder_new (void);
RygelL16Transcoder* rygel_l16_transcoder_construct (GType object_type);
GType rygel_gst_transcoder_get_type (void) G_GNUC_CONST;
GType rygel_audio_transcoder_get_type (void) G_GNUC_CONST;
GType rygel_l16_transcoder_get_type (void) G_GNUC_CONST;
RygelMP3Transcoder* rygel_mp3_transcoder_new (void);
RygelMP3Transcoder* rygel_mp3_transcoder_construct (GType object_type);
GType rygel_mp3_transcoder_get_type (void) G_GNUC_CONST;
GType rygel_mp2_ts_profile_get_type (void) G_GNUC_CONST;
RygelMP2TSTranscoder* rygel_mp2_ts_transcoder_new (RygelMP2TSProfile profile);
RygelMP2TSTranscoder* rygel_mp2_ts_transcoder_construct (GType object_type, RygelMP2TSProfile profile);
GType rygel_video_transcoder_get_type (void) G_GNUC_CONST;
GType rygel_mp2_ts_transcoder_get_type (void) G_GNUC_CONST;
RygelWMVTranscoder* rygel_wmv_transcoder_new (void);
RygelWMVTranscoder* rygel_wmv_transcoder_construct (GType object_type);
GType rygel_wmv_transcoder_get_type (void) G_GNUC_CONST;
RygelAACTranscoder* rygel_aac_transcoder_new (void);
RygelAACTranscoder* rygel_aac_transcoder_construct (GType object_type);
GType rygel_aac_transcoder_get_type (void) G_GNUC_CONST;
RygelAVCTranscoder* rygel_avc_transcoder_new (void);
RygelAVCTranscoder* rygel_avc_transcoder_construct (GType object_type);
GType rygel_avc_transcoder_get_type (void) G_GNUC_CONST;
static GList* rygel_gst_media_engine_real_get_dlna_profiles (RygelMediaEngine* base);
static GList* rygel_gst_media_engine_real_get_transcoders (RygelMediaEngine* base);
static RygelDataSource* rygel_gst_media_engine_real_create_data_source (RygelMediaEngine* base, const gchar* uri);
RygelGstDataSource* rygel_gst_data_source_new (const gchar* uri, GError** error);
RygelGstDataSource* rygel_gst_data_source_construct (GType object_type, const gchar* uri, GError** error);
GType rygel_gst_data_source_get_type (void) G_GNUC_CONST;
RygelDataSource* rygel_gst_media_engine_create_data_source_from_element (RygelGstMediaEngine* self, GstElement* element);
RygelGstDataSource* rygel_gst_data_source_new_from_element (GstElement* element);
RygelGstDataSource* rygel_gst_data_source_construct_from_element (GType object_type, GstElement* element);
static void rygel_gst_media_engine_finalize (GObject* obj);
RygelMediaEngine* module_get_instance (void);


static void _rygel_dlna_profile_unref0_ (gpointer var) {
	(var == NULL) ? NULL : (var = (rygel_dlna_profile_unref (var), NULL));
}


static void _g_list_free__rygel_dlna_profile_unref0_ (GList* self) {
	g_list_foreach (self, (GFunc) _rygel_dlna_profile_unref0_, NULL);
	g_list_free (self);
}


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 gpointer _g_object_ref0 (gpointer self) {
	return self ? g_object_ref (self) : NULL;
}


static gpointer _rygel_dlna_profile_ref0 (gpointer self) {
	return self ? rygel_dlna_profile_ref (self) : NULL;
}


RygelGstMediaEngine* rygel_gst_media_engine_construct (GType object_type) {
	RygelGstMediaEngine * self = NULL;
	gchar** args;
	gint args_length1;
	gint _args_size_;
	GUPnPDLNAProfileGuesser* _tmp0_;
	GUPnPDLNAProfileGuesser* discoverer;
	GUPnPDLNAProfileGuesser* _tmp1_;
	GList* _tmp2_ = NULL;
	RygelDLNAProfile* _tmp13_;
	gboolean transcoding;
	GeeArrayList* _tmp14_;
	GeeArrayList* transcoder_list;
	RygelMetaConfig* _tmp15_ = NULL;
	RygelMetaConfig* config;
	gboolean _tmp22_;
	GError * _inner_error_ = NULL;
	self = (RygelGstMediaEngine*) rygel_media_engine_construct (object_type);
	args = NULL;
	args_length1 = 0;
	_args_size_ = args_length1;
	gst_init (&args_length1, &args);
	gst_preset_set_app_dir (PRESET_DIR);
	_tmp0_ = gupnp_dlna_profile_guesser_new (TRUE, FALSE);
	discoverer = _tmp0_;
	_tmp1_ = discoverer;
	_tmp2_ = gupnp_dlna_profile_guesser_list_profiles (_tmp1_);
	{
		GList* profile_collection = NULL;
		GList* profile_it = NULL;
		profile_collection = _tmp2_;
		for (profile_it = profile_collection; profile_it != NULL; profile_it = profile_it->next) {
			GUPnPDLNAProfile* _tmp3_;
			GUPnPDLNAProfile* profile = NULL;
			_tmp3_ = _g_object_ref0 ((GUPnPDLNAProfile*) profile_it->data);
			profile = _tmp3_;
			{
				GUPnPDLNAProfile* _tmp4_;
				const gchar* _tmp5_;
				const gchar* _tmp6_;
				GUPnPDLNAProfile* _tmp7_;
				const gchar* _tmp8_;
				const gchar* _tmp9_;
				RygelDLNAProfile* _tmp10_;
				RygelDLNAProfile* p;
				RygelDLNAProfile* _tmp11_;
				RygelDLNAProfile* _tmp12_;
				_tmp4_ = profile;
				_tmp5_ = gupnp_dlna_profile_get_name (_tmp4_);
				_tmp6_ = _tmp5_;
				_tmp7_ = profile;
				_tmp8_ = gupnp_dlna_profile_get_mime (_tmp7_);
				_tmp9_ = _tmp8_;
				_tmp10_ = rygel_dlna_profile_new (_tmp6_, _tmp9_);
				p = _tmp10_;
				_tmp11_ = p;
				_tmp12_ = _rygel_dlna_profile_ref0 (_tmp11_);
				self->priv->dlna_profiles = g_list_prepend (self->priv->dlna_profiles, _tmp12_);
				_rygel_dlna_profile_unref0 (p);
				_g_object_unref0 (profile);
			}
		}
	}
	_tmp13_ = rygel_dlna_profile_new ("DIDL_S", "text/xml");
	self->priv->dlna_profiles = g_list_prepend (self->priv->dlna_profiles, _tmp13_);
	self->priv->dlna_profiles = g_list_reverse (self->priv->dlna_profiles);
	transcoding = TRUE;
	_tmp14_ = gee_array_list_new (G_TYPE_STRING, (GBoxedCopyFunc) g_strdup, g_free, NULL, NULL, NULL);
	transcoder_list = _tmp14_;
	_tmp15_ = rygel_meta_config_get_default ();
	config = _tmp15_;
	{
		RygelMetaConfig* _tmp16_;
		gboolean _tmp17_ = FALSE;
		gboolean _tmp18_;
		RygelMetaConfig* _tmp19_;
		GeeArrayList* _tmp20_ = NULL;
		GeeArrayList* _tmp21_;
		_tmp16_ = config;
		_tmp17_ = rygel_configuration_get_transcoding ((RygelConfiguration*) _tmp16_, &_inner_error_);
		_tmp18_ = _tmp17_;
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		transcoding = _tmp18_;
		_tmp19_ = config;
		_tmp20_ = rygel_configuration_get_string_list ((RygelConfiguration*) _tmp19_, "GstMediaEngine", "transcoders", &_inner_error_);
		_tmp21_ = _tmp20_;
		if (_inner_error_ != NULL) {
			goto __catch0_g_error;
		}
		_g_object_unref0 (transcoder_list);
		transcoder_list = _tmp21_;
	}
	goto __finally0;
	__catch0_g_error:
	{
		GError* err = NULL;
		err = _inner_error_;
		_inner_error_ = NULL;
		_g_error_free0 (err);
	}
	__finally0:
	if (_inner_error_ != NULL) {
		_g_object_unref0 (config);
		_g_object_unref0 (transcoder_list);
		_g_object_unref0 (discoverer);
		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;
	}
	_tmp22_ = transcoding;
	if (_tmp22_) {
		{
			GeeArrayList* _tmp23_;
			GeeArrayList* _tmp24_;
			GeeArrayList* _transcoder_list;
			GeeArrayList* _tmp25_;
			gint _tmp26_;
			gint _tmp27_;
			gint _transcoder_size;
			gint _transcoder_index;
			_tmp23_ = transcoder_list;
			_tmp24_ = _g_object_ref0 (_tmp23_);
			_transcoder_list = _tmp24_;
			_tmp25_ = _transcoder_list;
			_tmp26_ = gee_abstract_collection_get_size ((GeeCollection*) _tmp25_);
			_tmp27_ = _tmp26_;
			_transcoder_size = _tmp27_;
			_transcoder_index = -1;
			while (TRUE) {
				gint _tmp28_;
				gint _tmp29_;
				gint _tmp30_;
				GeeArrayList* _tmp31_;
				gint _tmp32_;
				gpointer _tmp33_ = NULL;
				gchar* transcoder;
				const gchar* _tmp34_;
				const gchar* _tmp35_;
				GQuark _tmp37_ = 0U;
				static GQuark _tmp36_label0 = 0;
				static GQuark _tmp36_label1 = 0;
				static GQuark _tmp36_label2 = 0;
				static GQuark _tmp36_label3 = 0;
				static GQuark _tmp36_label4 = 0;
				static GQuark _tmp36_label5 = 0;
				_tmp28_ = _transcoder_index;
				_transcoder_index = _tmp28_ + 1;
				_tmp29_ = _transcoder_index;
				_tmp30_ = _transcoder_size;
				if (!(_tmp29_ < _tmp30_)) {
					break;
				}
				_tmp31_ = _transcoder_list;
				_tmp32_ = _transcoder_index;
				_tmp33_ = gee_abstract_list_get ((GeeAbstractList*) _tmp31_, _tmp32_);
				transcoder = (gchar*) _tmp33_;
				_tmp34_ = transcoder;
				_tmp35_ = _tmp34_;
				_tmp37_ = (NULL == _tmp35_) ? 0 : g_quark_from_string (_tmp35_);
				if (_tmp37_ == ((0 != _tmp36_label0) ? _tmp36_label0 : (_tmp36_label0 = g_quark_from_static_string ("lpcm")))) {
					switch (0) {
						default:
						{
							RygelL16Transcoder* _tmp38_;
							_tmp38_ = rygel_l16_transcoder_new ();
							self->priv->transcoders = g_list_prepend (self->priv->transcoders, (RygelTranscoder*) _tmp38_);
							break;
						}
					}
				} else if (_tmp37_ == ((0 != _tmp36_label1) ? _tmp36_label1 : (_tmp36_label1 = g_quark_from_static_string ("mp3")))) {
					switch (0) {
						default:
						{
							RygelMP3Transcoder* _tmp39_;
							_tmp39_ = rygel_mp3_transcoder_new ();
							self->priv->transcoders = g_list_prepend (self->priv->transcoders, (RygelTranscoder*) _tmp39_);
							break;
						}
					}
				} else if (_tmp37_ == ((0 != _tmp36_label2) ? _tmp36_label2 : (_tmp36_label2 = g_quark_from_static_string ("mp2ts")))) {
					switch (0) {
						default:
						{
							RygelMP2TSTranscoder* _tmp40_;
							RygelMP2TSTranscoder* _tmp41_;
							RygelMP2TSTranscoder* _tmp42_;
							_tmp40_ = rygel_mp2_ts_transcoder_new (RYGEL_MP2_TS_PROFILE_SD_EU);
							self->priv->transcoders = g_list_prepend (self->priv->transcoders, (RygelTranscoder*) _tmp40_);
							_tmp41_ = rygel_mp2_ts_transcoder_new (RYGEL_MP2_TS_PROFILE_SD_NA);
							self->priv->transcoders = g_list_prepend (self->priv->transcoders, (RygelTranscoder*) _tmp41_);
							_tmp42_ = rygel_mp2_ts_transcoder_new (RYGEL_MP2_TS_PROFILE_HD_NA);
							self->priv->transcoders = g_list_prepend (self->priv->transcoders, (RygelTranscoder*) _tmp42_);
							break;
						}
					}
				} else if (_tmp37_ == ((0 != _tmp36_label3) ? _tmp36_label3 : (_tmp36_label3 = g_quark_from_static_string ("wmv")))) {
					switch (0) {
						default:
						{
							RygelWMVTranscoder* _tmp43_;
							_tmp43_ = rygel_wmv_transcoder_new ();
							self->priv->transcoders = g_list_prepend (self->priv->transcoders, (RygelTranscoder*) _tmp43_);
							break;
						}
					}
				} else if (_tmp37_ == ((0 != _tmp36_label4) ? _tmp36_label4 : (_tmp36_label4 = g_quark_from_static_string ("aac")))) {
					switch (0) {
						default:
						{
							RygelAACTranscoder* _tmp44_;
							_tmp44_ = rygel_aac_transcoder_new ();
							self->priv->transcoders = g_list_prepend (self->priv->transcoders, (RygelTranscoder*) _tmp44_);
							break;
						}
					}
				} else if (_tmp37_ == ((0 != _tmp36_label5) ? _tmp36_label5 : (_tmp36_label5 = g_quark_from_static_string ("avc")))) {
					switch (0) {
						default:
						{
							RygelAVCTranscoder* _tmp45_;
							_tmp45_ = rygel_avc_transcoder_new ();
							self->priv->transcoders = g_list_prepend (self->priv->transcoders, (RygelTranscoder*) _tmp45_);
							break;
						}
					}
				} else {
					switch (0) {
						default:
						{
							const gchar* _tmp46_;
							_tmp46_ = transcoder;
							g_debug ("rygel-gst-media-engine.vala:102: Unsupported transcoder \"%s\"", _tmp46_);
							break;
						}
					}
				}
				_g_free0 (transcoder);
			}
			_g_object_unref0 (_transcoder_list);
		}
		self->priv->transcoders = g_list_reverse (self->priv->transcoders);
	}
	_g_object_unref0 (config);
	_g_object_unref0 (transcoder_list);
	_g_object_unref0 (discoverer);
	return self;
}


RygelGstMediaEngine* rygel_gst_media_engine_new (void) {
	return rygel_gst_media_engine_construct (RYGEL_TYPE_GST_MEDIA_ENGINE);
}


static GList* rygel_gst_media_engine_real_get_dlna_profiles (RygelMediaEngine* base) {
	RygelGstMediaEngine * self;
	GList* result = NULL;
	GList* _tmp0_;
	self = (RygelGstMediaEngine*) base;
	_tmp0_ = self->priv->dlna_profiles;
	result = _tmp0_;
	return result;
}


static GList* rygel_gst_media_engine_real_get_transcoders (RygelMediaEngine* base) {
	RygelGstMediaEngine * self;
	GList* result = NULL;
	GList* _tmp0_;
	self = (RygelGstMediaEngine*) base;
	_tmp0_ = self->priv->transcoders;
	result = _tmp0_;
	return result;
}


static RygelDataSource* rygel_gst_media_engine_real_create_data_source (RygelMediaEngine* base, const gchar* uri) {
	RygelGstMediaEngine * self;
	RygelDataSource* result = NULL;
	GError * _inner_error_ = NULL;
	self = (RygelGstMediaEngine*) base;
	g_return_val_if_fail (uri != NULL, NULL);
	{
		const gchar* _tmp0_;
		RygelGstDataSource* _tmp1_;
		RygelGstDataSource* _tmp2_;
		_tmp0_ = uri;
		_tmp1_ = rygel_gst_data_source_new (_tmp0_, &_inner_error_);
		_tmp2_ = _tmp1_;
		if (_inner_error_ != NULL) {
			goto __catch1_g_error;
		}
		result = (RygelDataSource*) _tmp2_;
		return result;
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* _error_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		result = NULL;
		_g_error_free0 (_error_);
		return result;
	}
	__finally1:
	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;
}


RygelDataSource* rygel_gst_media_engine_create_data_source_from_element (RygelGstMediaEngine* self, GstElement* element) {
	RygelDataSource* result = NULL;
	GstElement* _tmp0_;
	RygelGstDataSource* _tmp1_;
	g_return_val_if_fail (self != NULL, NULL);
	g_return_val_if_fail (element != NULL, NULL);
	_tmp0_ = element;
	_tmp1_ = rygel_gst_data_source_new_from_element (_tmp0_);
	result = (RygelDataSource*) _tmp1_;
	return result;
}


static void rygel_gst_media_engine_class_init (RygelGstMediaEngineClass * klass) {
	rygel_gst_media_engine_parent_class = g_type_class_peek_parent (klass);
	g_type_class_add_private (klass, sizeof (RygelGstMediaEnginePrivate));
	RYGEL_MEDIA_ENGINE_CLASS (klass)->get_dlna_profiles = rygel_gst_media_engine_real_get_dlna_profiles;
	RYGEL_MEDIA_ENGINE_CLASS (klass)->get_transcoders = rygel_gst_media_engine_real_get_transcoders;
	RYGEL_MEDIA_ENGINE_CLASS (klass)->create_data_source = rygel_gst_media_engine_real_create_data_source;
	G_OBJECT_CLASS (klass)->finalize = rygel_gst_media_engine_finalize;
}


static void rygel_gst_media_engine_instance_init (RygelGstMediaEngine * self) {
	self->priv = RYGEL_GST_MEDIA_ENGINE_GET_PRIVATE (self);
	self->priv->dlna_profiles = NULL;
	self->priv->transcoders = NULL;
}


static void rygel_gst_media_engine_finalize (GObject* obj) {
	RygelGstMediaEngine * self;
	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_GST_MEDIA_ENGINE, RygelGstMediaEngine);
	__g_list_free__rygel_dlna_profile_unref0_0 (self->priv->dlna_profiles);
	__g_list_free__g_object_unref0_0 (self->priv->transcoders);
	G_OBJECT_CLASS (rygel_gst_media_engine_parent_class)->finalize (obj);
}


GType rygel_gst_media_engine_get_type (void) {
	static volatile gsize rygel_gst_media_engine_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_gst_media_engine_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelGstMediaEngineClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_gst_media_engine_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelGstMediaEngine), 0, (GInstanceInitFunc) rygel_gst_media_engine_instance_init, NULL };
		GType rygel_gst_media_engine_type_id;
		rygel_gst_media_engine_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_ENGINE, "RygelGstMediaEngine", &g_define_type_info, 0);
		g_once_init_leave (&rygel_gst_media_engine_type_id__volatile, rygel_gst_media_engine_type_id);
	}
	return rygel_gst_media_engine_type_id__volatile;
}


RygelMediaEngine* module_get_instance (void) {
	RygelMediaEngine* result = NULL;
	RygelGstMediaEngine* _tmp0_;
	_tmp0_ = rygel_gst_media_engine_new ();
	result = (RygelMediaEngine*) _tmp0_;
	return result;
}



