/* rygel-playbin-plugin.c generated by valac 0.42.2, the Vala compiler
 * generated from rygel-playbin-plugin.vala, do not modify */

/*
 * Copyright (C) 2008 Zeeshan Ali (Khattak) <zeeshanak@gnome.org>.
 * Copyright (C) 2008 Nokia Corporation.
 * Copyright (C) 2012 Openismus GmbH.
 * Copyright (C) 2012 Intel Corporation.
 *
 * Author: Zeeshan Ali (Khattak) <zeeshanak@gnome.org>
 *                               <zeeshan.ali@nokia.com>
 *         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.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 <rygel-renderer.h>
#include <stdlib.h>
#include <string.h>
#include <glib/gi18n-lib.h>
#include <rygel-core.h>
#include <rygel-renderer-gst.h>


#define RYGEL_PLAYBIN_TYPE_PLUGIN (rygel_playbin_plugin_get_type ())
#define RYGEL_PLAYBIN_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), RYGEL_PLAYBIN_TYPE_PLUGIN, RygelPlaybinPlugin))
#define RYGEL_PLAYBIN_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), RYGEL_PLAYBIN_TYPE_PLUGIN, RygelPlaybinPluginClass))
#define RYGEL_PLAYBIN_IS_PLUGIN(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), RYGEL_PLAYBIN_TYPE_PLUGIN))
#define RYGEL_PLAYBIN_IS_PLUGIN_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), RYGEL_PLAYBIN_TYPE_PLUGIN))
#define RYGEL_PLAYBIN_PLUGIN_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), RYGEL_PLAYBIN_TYPE_PLUGIN, RygelPlaybinPluginClass))

typedef struct _RygelPlaybinPlugin RygelPlaybinPlugin;
typedef struct _RygelPlaybinPluginClass RygelPlaybinPluginClass;
typedef struct _RygelPlaybinPluginPrivate RygelPlaybinPluginPrivate;
enum  {
	RYGEL_PLAYBIN_PLUGIN_0_PROPERTY,
	RYGEL_PLAYBIN_PLUGIN_NUM_PROPERTIES
};
static GParamSpec* rygel_playbin_plugin_properties[RYGEL_PLAYBIN_PLUGIN_NUM_PROPERTIES];
#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)))

struct _RygelPlaybinPlugin {
	RygelMediaRendererPlugin parent_instance;
	RygelPlaybinPluginPrivate * priv;
};

struct _RygelPlaybinPluginClass {
	RygelMediaRendererPluginClass parent_class;
};


static gpointer rygel_playbin_plugin_parent_class = NULL;

GType rygel_playbin_plugin_get_type (void) G_GNUC_CONST;
#define RYGEL_PLAYBIN_PLUGIN_NAME "Playbin"
RygelPlaybinPlugin* rygel_playbin_plugin_new (GError** error);
RygelPlaybinPlugin* rygel_playbin_plugin_construct (GType object_type,
                                                    GError** error);
static RygelMediaPlayer* rygel_playbin_plugin_real_get_player (RygelMediaRendererPlugin* base);


RygelPlaybinPlugin*
rygel_playbin_plugin_construct (GType object_type,
                                GError** error)
{
	RygelPlaybinPlugin * self = NULL;
	RygelPlaybinPlayer* _tmp0_ = NULL;
	RygelPlaybinPlayer* _tmp1_;
	GList* _tmp2_;
	GList* _tmp3_;
	GError * _inner_error_ = NULL;
	self = (RygelPlaybinPlugin*) rygel_media_renderer_plugin_construct (object_type, RYGEL_PLAYBIN_PLUGIN_NAME, _ ("GStreamer Player"), NULL, RYGEL_PLUGIN_CAPABILITIES_NONE);
	_tmp1_ = rygel_playbin_player_instance (&_inner_error_);
	_tmp0_ = _tmp1_;
	if (G_UNLIKELY (_inner_error_ != NULL)) {
		g_propagate_error (error, _inner_error_);
		_g_object_unref0 (self);
		return NULL;
	}
	_tmp2_ = rygel_playbin_player_get_supported_profiles (_tmp0_);
	_tmp3_ = _tmp2_;
	rygel_media_renderer_plugin_set_supported_profiles ((RygelMediaRendererPlugin*) self, _tmp3_);
	_g_object_unref0 (_tmp0_);
	return self;
}


RygelPlaybinPlugin*
rygel_playbin_plugin_new (GError** error)
{
	return rygel_playbin_plugin_construct (RYGEL_PLAYBIN_TYPE_PLUGIN, error);
}


static RygelMediaPlayer*
rygel_playbin_plugin_real_get_player (RygelMediaRendererPlugin* base)
{
	RygelPlaybinPlugin * self;
	RygelMediaPlayer* result = NULL;
	GError * _inner_error_ = NULL;
	self = (RygelPlaybinPlugin*) base;
	{
		RygelPlaybinPlayer* _tmp0_ = NULL;
		RygelPlaybinPlayer* _tmp1_;
		RygelPlaybinPlayer* _tmp2_;
		_tmp1_ = rygel_playbin_player_instance (&_inner_error_);
		_tmp0_ = _tmp1_;
		if (G_UNLIKELY (_inner_error_ != NULL)) {
			goto __catch1_g_error;
		}
		_tmp2_ = _tmp0_;
		_tmp0_ = NULL;
		result = (RygelMediaPlayer*) _tmp2_;
		_g_object_unref0 (_tmp0_);
		return result;
	}
	goto __finally1;
	__catch1_g_error:
	{
		GError* _error_ = NULL;
		_error_ = _inner_error_;
		_inner_error_ = NULL;
		g_warning ("rygel-playbin-plugin.vala:43: %s", _ ("Could not create GStreamer player"));
		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;
}


static void
rygel_playbin_plugin_class_init (RygelPlaybinPluginClass * klass)
{
	rygel_playbin_plugin_parent_class = g_type_class_peek_parent (klass);
	((RygelMediaRendererPluginClass *) klass)->get_player = (RygelMediaPlayer* (*) (RygelMediaRendererPlugin *)) rygel_playbin_plugin_real_get_player;
}


static void
rygel_playbin_plugin_instance_init (RygelPlaybinPlugin * self)
{
}


GType
rygel_playbin_plugin_get_type (void)
{
	static volatile gsize rygel_playbin_plugin_type_id__volatile = 0;
	if (g_once_init_enter (&rygel_playbin_plugin_type_id__volatile)) {
		static const GTypeInfo g_define_type_info = { sizeof (RygelPlaybinPluginClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_playbin_plugin_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelPlaybinPlugin), 0, (GInstanceInitFunc) rygel_playbin_plugin_instance_init, NULL };
		GType rygel_playbin_plugin_type_id;
		rygel_playbin_plugin_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_RENDERER_PLUGIN, "RygelPlaybinPlugin", &g_define_type_info, 0);
		g_once_init_leave (&rygel_playbin_plugin_type_id__volatile, rygel_playbin_plugin_type_id);
	}
	return rygel_playbin_plugin_type_id__volatile;
}



