[rygel-gst-0-10-fullscreen-renderer] cleanup



commit 10c81db96aab199d1d257c5ae194f8afd17f6bb1
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Jan 22 13:41:08 2013 +0100

    cleanup

 src/rygel-playbin-player.c   |  159 +++++++++++++++++++-----------------------
 src/rygel-playbin-renderer.c |   58 ++++++----------
 2 files changed, 95 insertions(+), 122 deletions(-)
---
diff --git a/src/rygel-playbin-player.c b/src/rygel-playbin-player.c
index 702045c..239a713 100644
--- a/src/rygel-playbin-player.c
+++ b/src/rygel-playbin-player.c
@@ -30,12 +30,20 @@
 #include <stdlib.h>
 #include <string.h>
 
-#define _gst_object_unref0(var) ((var == NULL) ? NULL : (var = (gst_object_unref (var), NULL)))
-#define _g_free0(var) (var = (g_free (var), NULL))
-#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-#define _gst_structure_free0(var) ((var == NULL) ? NULL : (var = (gst_structure_free (var), NULL)))
-#define _gst_caps_unref0(var) ((var == NULL) ? NULL : (var = (gst_caps_unref (var), NULL)))
-#define _g_error_free0(var) ((var == NULL) ? NULL : (var = (g_error_free (var), NULL)))
+static void rygel_playbin_player_rygel_media_player_interface_init (RygelMediaPlayerIface * iface);
+
+/**
+ * Implementation of RygelMediaPlayer for GStreamer.
+ *
+ * This class is useful only when implementing Rygel plugins.
+ */
+
+G_DEFINE_TYPE_WITH_CODE (RygelPlaybinPlayer,
+                         rygel_playbin_player,
+                         G_TYPE_OBJECT,
+                         G_IMPLEMENT_INTERFACE (RYGEL_TYPE_MEDIA_PLAYER,
+                                                rygel_playbin_player_rygel_media_player_interface_init))
+
 #define _vala_assert(expr, msg) if G_LIKELY (expr) ; else g_assertion_message_expr (G_LOG_DOMAIN, __FILE__, __LINE__, G_STRFUNC, msg);
 
 struct _RygelPlaybinPlayerPrivate {
@@ -58,10 +66,6 @@ struct _RygelPlaybinPlayerPrivate {
 	GUPnPProtocolInfo* protocol_info;
 };
 
-
-static gpointer rygel_playbin_player_parent_class = NULL;
-static RygelPlaybinPlayer* rygel_playbin_player_player;
-static RygelPlaybinPlayer* rygel_playbin_player_player = NULL;
 static RygelMediaPlayerIface* rygel_playbin_player_rygel_media_player_parent_iface = NULL;
 
 #define RYGEL_PLAYBIN_PLAYER_GET_PRIVATE(o) (G_TYPE_INSTANCE_GET_PRIVATE ((o), RYGEL_TYPE_PLAYBIN_PLAYER, RygelPlaybinPlayerPrivate))
@@ -129,7 +133,7 @@ static RygelPlaybinPlayer* rygel_playbin_player_construct (GType object_type) {
 	}
 	_tmp1_ = _tmp0_;
 	rygel_playbin_player_set_playbin (self, _tmp1_);
-	_gst_object_unref0 (_tmp1_);
+	gst_object_unref (_tmp1_);
 	self->priv->foreign = FALSE;
 	rygel_playbin_player_setup_playbin (self);
 	return self;
@@ -145,6 +149,8 @@ static gpointer _g_object_ref0 (gpointer self) {
 }
 
 
+static RygelPlaybinPlayer* rygel_playbin_player_player = NULL;
+
 RygelPlaybinPlayer* rygel_playbin_player_get_default (void) {
 	RygelPlaybinPlayer* result = NULL;
 	RygelPlaybinPlayer* _tmp0_;
@@ -154,7 +160,7 @@ RygelPlaybinPlayer* rygel_playbin_player_get_default (void) {
 	if (_tmp0_ == NULL) {
 		RygelPlaybinPlayer* _tmp1_;
 		_tmp1_ = rygel_playbin_player_new ();
-		_g_object_unref0 (rygel_playbin_player_player);
+		g_object_unref (rygel_playbin_player_player);
 		rygel_playbin_player_player = _tmp1_;
 	}
 	_tmp2_ = rygel_playbin_player_player;
@@ -277,7 +283,7 @@ static gboolean rygel_playbin_player_is_rendering_image (RygelPlaybinPlayer* sel
 	g_return_val_if_fail (self != NULL, FALSE);
 	_tmp0_ = self->priv->_playbin;
 	_tmp1_ = gst_bin_get_by_name (G_TYPE_CHECK_INSTANCE_TYPE (_tmp0_, GST_TYPE_BIN) ? ((GstBin*) _tmp0_) : NULL, "typefind");
-	_gst_object_unref0 (typefind);
+	gst_object_unref (typefind);
 	typefind = _tmp1_;
 	_tmp2_ = typefind;
 	_tmp3_ = _dynamic_get_caps0 (_tmp2_);
@@ -300,9 +306,9 @@ static gboolean rygel_playbin_player_is_rendering_image (RygelPlaybinPlayer* sel
 	}
 	_tmp13_ = _tmp8_;
 	result = _tmp13_;
-	_gst_structure_free0 (structure);
-	_gst_caps_unref0 (caps);
-	_gst_object_unref0 (typefind);
+	gst_structure_free (structure);
+	gst_caps_unref (caps);
+	gst_object_unref (typefind);
 	return result;
 }
 
@@ -406,15 +412,15 @@ static void rygel_playbin_player_bus_handler (RygelPlaybinPlayer* self, GstBus*
 							_tmp20_ = self->priv->_playbin;
 							_tmp21_ = _dynamic_get_uri2 (_tmp20_);
 							_tmp22_ = _tmp21_;
-							_g_free0 (self->priv->_uri);
+							g_free (self->priv->_uri);
 							self->priv->_uri = _tmp22_;
 							g_object_notify ((GObject*) self, "uri");
 							_tmp23_ = rygel_playbin_player_generate_basic_didl (self);
 							_tmp24_ = _tmp23_;
 							rygel_media_player_set_metadata ((RygelMediaPlayer*) self, _tmp24_);
-							_g_free0 (_tmp24_);
+							g_free (_tmp24_);
 						}
-						_g_free0 (uri);
+						g_free (uri);
 					}
 				}
 				_tmp26_ = pending;
@@ -543,9 +549,9 @@ static void rygel_playbin_player_bus_handler (RygelPlaybinPlayer* self, GstBus*
 			const gchar* _tmp54_;
 			_tmp47_ = message;
 			gst_message_parse_error (_tmp47_, &_tmp48_, &_tmp49_);
-			_g_error_free0 (_error_);
+			g_error_free (_error_);
 			_error_ = _tmp48_;
-			_g_free0 (error_message);
+			g_free (error_message);
 			error_message = _tmp49_;
 			_tmp50_ = self->priv->_playbin;
 			_tmp51_ = gst_object_get_name ((GstObject*) _tmp50_);
@@ -553,11 +559,11 @@ static void rygel_playbin_player_bus_handler (RygelPlaybinPlayer* self, GstBus*
 			_tmp53_ = _tmp52_;
 			_tmp54_ = error_message;
 			g_warning ("rygel-playbin-player.vala:413: Error from GStreamer element %s: %s", _tmp53_, _tmp54_);
-			_g_free0 (_tmp53_);
+			g_free (_tmp53_);
 			g_warning ("rygel-playbin-player.vala:416: Going to STOPPED state");
 			rygel_media_player_set_playback_state ((RygelMediaPlayer*) self, "STOPPED");
-			_g_free0 (error_message);
-			_g_error_free0 (_error_);
+			g_free (error_message);
+			g_error_free (_error_);
 			break;
 		}
 		default:
@@ -613,7 +619,7 @@ static void rygel_playbin_player_on_source_setup (RygelPlaybinPlayer* self, GstE
 		_tmp11_ = source;
 		_tmp12_ = structure;
 		_dynamic_set_extra_headers3 (_tmp11_, _tmp12_);
-		_gst_structure_free0 (structure);
+		gst_structure_free (structure);
 	}
 }
 
@@ -666,18 +672,18 @@ static gchar* rygel_playbin_player_generate_basic_didl (RygelPlaybinPlayer* self
 	_tmp6_ = _tmp5_;
 	_tmp7_ = g_file_new_for_uri (_tmp6_);
 	_tmp8_ = _tmp7_;
-	_g_free0 (_tmp6_);
+	g_free (_tmp6_);
 	file = _tmp8_;
 	_tmp9_ = g_file_get_basename (file);
 	_tmp10_ = _tmp9_;
 	gupnp_didl_lite_object_set_title ((GUPnPDIDLLiteObject*) item, _tmp10_);
-	_g_free0 (_tmp10_);
+	g_free (_tmp10_);
 	_tmp11_ = gupnp_didl_lite_writer_get_string (writer);
 	result = _tmp11_;
-	_g_object_unref0 (file);
-	_g_object_unref0 (resource);
-	_g_object_unref0 (item);
-	_g_object_unref0 (writer);
+	g_object_unref (file);
+	g_object_unref (resource);
+	g_object_unref (item);
+	g_object_unref (writer);
 	return result;
 }
 
@@ -731,7 +737,7 @@ static void rygel_playbin_player_setup_playbin (RygelPlaybinPlayer* self) {
 	bus = _tmp5_;
 	gst_bus_add_signal_watch (bus);
 	g_signal_connect_object (bus, "message", (GCallback) _rygel_playbin_player_bus_handler_gst_bus_message, self, 0);
-	_gst_object_unref0 (bus);
+	gst_object_unref (bus);
 }
 
 
@@ -756,7 +762,7 @@ static void rygel_playbin_player_set_playbin (RygelPlaybinPlayer* self, GstEleme
 	g_return_if_fail (self != NULL);
 	_tmp0_ = value;
 	_tmp1_ = _gst_object_ref0 (_tmp0_);
-	_gst_object_unref0 (self->priv->_playbin);
+	gst_object_unref (self->priv->_playbin);
 	self->priv->_playbin = _tmp1_;
 	g_object_notify ((GObject *) self, "playbin");
 }
@@ -819,7 +825,7 @@ static void rygel_playbin_player_real_set_playback_state (RygelMediaPlayer* base
 					gchar* _tmp12_;
 					GstElement* _tmp13_;
 					_tmp12_ = g_strdup ("TRANSITIONING");
-					_g_free0 (self->priv->_playback_state);
+					g_free (self->priv->_playback_state);
 					self->priv->_playback_state = _tmp12_;
 					_tmp13_ = self->priv->_playbin;
 					gst_element_set_state (_tmp13_, GST_STATE_NULL);
@@ -828,7 +834,7 @@ static void rygel_playbin_player_real_set_playback_state (RygelMediaPlayer* base
 					gchar* _tmp15_;
 					_tmp14_ = value;
 					_tmp15_ = g_strdup (_tmp14_);
-					_g_free0 (self->priv->_playback_state);
+					g_free (self->priv->_playback_state);
 					self->priv->_playback_state = _tmp15_;
 				}
 				break;
@@ -854,7 +860,7 @@ static void rygel_playbin_player_real_set_playback_state (RygelMediaPlayer* base
 					gchar* _tmp20_;
 					GstElement* _tmp21_;
 					_tmp20_ = g_strdup ("TRANSITIONING");
-					_g_free0 (self->priv->_playback_state);
+					g_free (self->priv->_playback_state);
 					self->priv->_playback_state = _tmp20_;
 					_tmp21_ = self->priv->_playbin;
 					gst_element_set_state (_tmp21_, GST_STATE_PAUSED);
@@ -863,7 +869,7 @@ static void rygel_playbin_player_real_set_playback_state (RygelMediaPlayer* base
 					gchar* _tmp23_;
 					_tmp22_ = value;
 					_tmp23_ = g_strdup (_tmp22_);
-					_g_free0 (self->priv->_playback_state);
+					g_free (self->priv->_playback_state);
 					self->priv->_playback_state = _tmp23_;
 				}
 				break;
@@ -890,7 +896,7 @@ static void rygel_playbin_player_real_set_playback_state (RygelMediaPlayer* base
 					GstElement* _tmp29_;
 					GstStateChangeReturn _tmp30_ = 0;
 					_tmp28_ = g_strdup ("TRANSITIONING");
-					_g_free0 (self->priv->_playback_state);
+					g_free (self->priv->_playback_state);
 					self->priv->_playback_state = _tmp28_;
 					_tmp29_ = self->priv->_playbin;
 					_tmp30_ = gst_element_set_state (_tmp29_, GST_STATE_PLAYING);
@@ -900,7 +906,7 @@ static void rygel_playbin_player_real_set_playback_state (RygelMediaPlayer* base
 					gchar* _tmp32_;
 					_tmp31_ = value;
 					_tmp32_ = g_strdup (_tmp31_);
-					_g_free0 (self->priv->_playback_state);
+					g_free (self->priv->_playback_state);
 					self->priv->_playback_state = _tmp32_;
 				}
 				break;
@@ -974,7 +980,7 @@ static void rygel_playbin_player_real_set_playback_speed (RygelMediaPlayer* base
 	self = (RygelPlaybinPlayer*) base;
 	_tmp0_ = value;
 	_tmp1_ = g_strdup (_tmp0_);
-	_g_free0 (self->priv->_playback_speed);
+	g_free (self->priv->_playback_speed);
 	self->priv->_playback_speed = _tmp1_;
 	g_object_notify ((GObject *) self, "playback-speed");
 }
@@ -1010,7 +1016,7 @@ static void rygel_playbin_player_real_set_uri (RygelMediaPlayer* base, const gch
 	self = (RygelPlaybinPlayer*) base;
 	_tmp0_ = value;
 	_tmp1_ = g_strdup (_tmp0_);
-	_g_free0 (self->priv->_uri);
+	g_free (self->priv->_uri);
 	self->priv->_uri = _tmp1_;
 	_tmp2_ = self->priv->_playbin;
 	gst_element_set_state (_tmp2_, GST_STATE_READY);
@@ -1035,7 +1041,7 @@ static void rygel_playbin_player_real_set_uri (RygelMediaPlayer* base, const gch
 				{
 					gchar* _tmp10_;
 					_tmp10_ = g_strdup ("STOPPED");
-					_g_free0 (self->priv->_playback_state);
+					g_free (self->priv->_playback_state);
 					self->priv->_playback_state = _tmp10_;
 					g_object_notify ((GObject*) self, "playback-state");
 					break;
@@ -1083,7 +1089,7 @@ static void rygel_playbin_player_real_set_uri (RygelMediaPlayer* base, const gch
 	} else {
 		gchar* _tmp15_;
 		_tmp15_ = g_strdup ("NO_MEDIA_PRESENT");
-		_g_free0 (self->priv->_playback_state);
+		g_free (self->priv->_playback_state);
 		self->priv->_playback_state = _tmp15_;
 		g_object_notify ((GObject*) self, "playback-state");
 	}
@@ -1113,7 +1119,7 @@ static void rygel_playbin_player_real_set_mime_type (RygelMediaPlayer* base, con
 	self = (RygelPlaybinPlayer*) base;
 	_tmp0_ = value;
 	_tmp1_ = g_strdup (_tmp0_);
-	_g_free0 (self->priv->_mime_type);
+	g_free (self->priv->_mime_type);
 	self->priv->_mime_type = _tmp1_;
 	g_object_notify ((GObject *) self, "mime-type");
 }
@@ -1139,7 +1145,7 @@ static void rygel_playbin_player_real_set_metadata (RygelMediaPlayer* base, cons
 	self = (RygelPlaybinPlayer*) base;
 	_tmp0_ = value;
 	_tmp1_ = g_strdup (_tmp0_);
-	_g_free0 (self->priv->_metadata);
+	g_free (self->priv->_metadata);
 	self->priv->_metadata = _tmp1_;
 	g_object_notify ((GObject *) self, "metadata");
 }
@@ -1163,7 +1169,7 @@ static gboolean rygel_playbin_player_real_get_can_seek (RygelMediaPlayer* base)
 		_tmp4_ = _tmp3_;
 		_tmp5_ = g_str_has_prefix (_tmp4_, "image/");
 		_tmp0_ = !_tmp5_;
-		_g_free0 (_tmp4_);
+		g_free (_tmp4_);
 	} else {
 		_tmp0_ = FALSE;
 	}
@@ -1205,7 +1211,7 @@ static void rygel_playbin_player_real_set_content_features (RygelMediaPlayer* ba
 	_tmp3_ = value;
 	_tmp4_ = g_strdup_printf (RYGEL_PLAYBIN_PLAYER_PROTOCOL_INFO_TEMPLATE, _tmp2_, _tmp3_);
 	_tmp5_ = _tmp4_;
-	_g_free0 (_tmp2_);
+	g_free (_tmp2_);
 	pi_string = _tmp5_;
 	{
 		GUPnPProtocolInfo* _tmp6_;
@@ -1220,7 +1226,7 @@ static void rygel_playbin_player_real_set_content_features (RygelMediaPlayer* ba
 		if (_inner_error_ != NULL) {
 			goto __catch0_g_error;
 		}
-		_g_object_unref0 (self->priv->protocol_info);
+		g_object_unref (self->priv->protocol_info);
 		self->priv->protocol_info = _tmp7_;
 		_tmp8_ = self->priv->protocol_info;
 		_tmp9_ = gupnp_protocol_info_get_dlna_flags (_tmp8_);
@@ -1230,7 +1236,7 @@ static void rygel_playbin_player_real_set_content_features (RygelMediaPlayer* ba
 		if ((_tmp11_ & GUPNP_DLNA_FLAGS_INTERACTIVE_TRANSFER_MODE) == GUPNP_DLNA_FLAGS_INTERACTIVE_TRANSFER_MODE) {
 			gchar* _tmp12_;
 			_tmp12_ = g_strdup (RYGEL_PLAYBIN_PLAYER_TRANSFER_MODE_INTERACTIVE);
-			_g_free0 (self->priv->transfer_mode);
+			g_free (self->priv->transfer_mode);
 			self->priv->transfer_mode = _tmp12_;
 		} else {
 			GUPnPDLNAFlags _tmp13_;
@@ -1238,10 +1244,10 @@ static void rygel_playbin_player_real_set_content_features (RygelMediaPlayer* ba
 			if ((_tmp13_ & GUPNP_DLNA_FLAGS_STREAMING_TRANSFER_MODE) == GUPNP_DLNA_FLAGS_STREAMING_TRANSFER_MODE) {
 				gchar* _tmp14_;
 				_tmp14_ = g_strdup (RYGEL_PLAYBIN_PLAYER_TRANSFER_MODE_STREAMING);
-				_g_free0 (self->priv->transfer_mode);
+				g_free (self->priv->transfer_mode);
 				self->priv->transfer_mode = _tmp14_;
 			} else {
-				_g_free0 (self->priv->transfer_mode);
+				g_free (self->priv->transfer_mode);
 				self->priv->transfer_mode = NULL;
 			}
 		}
@@ -1252,24 +1258,24 @@ static void rygel_playbin_player_real_set_content_features (RygelMediaPlayer* ba
 		GError* _error_ = NULL;
 		_error_ = _inner_error_;
 		_inner_error_ = NULL;
-		_g_object_unref0 (self->priv->protocol_info);
+		g_object_unref (self->priv->protocol_info);
 		self->priv->protocol_info = NULL;
-		_g_free0 (self->priv->transfer_mode);
+		g_free (self->priv->transfer_mode);
 		self->priv->transfer_mode = NULL;
-		_g_error_free0 (_error_);
+		g_error_free (_error_);
 	}
 	__finally0:
 	if (_inner_error_ != NULL) {
-		_g_free0 (pi_string);
+		g_free (pi_string);
 		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;
 	}
 	_tmp15_ = value;
 	_tmp16_ = g_strdup (_tmp15_);
-	_g_free0 (self->priv->_content_features);
+	g_free (self->priv->_content_features);
 	self->priv->_content_features = _tmp16_;
-	_g_free0 (pi_string);
+	g_free (pi_string);
 	g_object_notify ((GObject *) self, "content-features");
 }
 
@@ -1413,7 +1419,7 @@ static void rygel_playbin_player_rygel_media_player_interface_init (RygelMediaPl
 }
 
 
-static void rygel_playbin_player_instance_init (RygelPlaybinPlayer * self) {
+static void rygel_playbin_player_init (RygelPlaybinPlayer * self) {
 	gchar* _tmp0_;
 	gchar* _tmp1_;
 	gchar* _tmp2_;
@@ -1436,39 +1442,20 @@ static void rygel_playbin_player_instance_init (RygelPlaybinPlayer * self) {
 static void rygel_playbin_player_finalize (GObject* obj) {
 	RygelPlaybinPlayer * self;
 	self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_PLAYBIN_PLAYER, RygelPlaybinPlayer);
-	_gst_object_unref0 (self->priv->_playbin);
-	_g_free0 (self->priv->_playback_state);
+	gst_object_unref (self->priv->_playbin);
+	g_free (self->priv->_playback_state);
 	self->priv->_allowed_playback_speeds = (_vala_array_free (self->priv->_allowed_playback_speeds, self->priv->_allowed_playback_speeds_length1, (GDestroyNotify) g_free), NULL);
-	_g_free0 (self->priv->_playback_speed);
-	_g_free0 (self->priv->transfer_mode);
-	_g_free0 (self->priv->_uri);
-	_g_free0 (self->priv->_mime_type);
-	_g_free0 (self->priv->_metadata);
-	_g_free0 (self->priv->_content_features);
-	_g_object_unref0 (self->priv->protocol_info);
+	g_free (self->priv->_playback_speed);
+	g_free (self->priv->transfer_mode);
+	g_free (self->priv->_uri);
+	g_free (self->priv->_mime_type);
+	g_free (self->priv->_metadata);
+	g_free (self->priv->_content_features);
+	g_object_unref (self->priv->protocol_info);
 	G_OBJECT_CLASS (rygel_playbin_player_parent_class)->finalize (obj);
 }
 
 
-/**
- * Implementation of RygelMediaPlayer for GStreamer.
- *
- * This class is useful only when implementing Rygel plugins.
- */
-GType rygel_playbin_player_get_type (void) {
-	static volatile gsize rygel_playbin_player_type_id__volatile = 0;
-	if (g_once_init_enter (&rygel_playbin_player_type_id__volatile)) {
-		static const GTypeInfo g_define_type_info = { sizeof (RygelPlaybinPlayerClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_playbin_player_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelPlaybinPlayer), 0, (GInstanceInitFunc) rygel_playbin_player_instance_init, NULL };
-		static const GInterfaceInfo rygel_media_player_info = { (GInterfaceInitFunc) rygel_playbin_player_rygel_media_player_interface_init, (GInterfaceFinalizeFunc) NULL, NULL};
-		GType rygel_playbin_player_type_id;
-		rygel_playbin_player_type_id = g_type_register_static (G_TYPE_OBJECT, "RygelPlaybinPlayer", &g_define_type_info, 0);
-		g_type_add_interface_static (rygel_playbin_player_type_id, RYGEL_TYPE_MEDIA_PLAYER, &rygel_media_player_info);
-		g_once_init_leave (&rygel_playbin_player_type_id__volatile, rygel_playbin_player_type_id);
-	}
-	return rygel_playbin_player_type_id__volatile;
-}
-
-
 static void _vala_rygel_playbin_player_get_property (GObject * object, guint property_id, GValue * value, GParamSpec * pspec) {
 	RygelPlaybinPlayer * self;
 	self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_TYPE_PLAYBIN_PLAYER, RygelPlaybinPlayer);
diff --git a/src/rygel-playbin-renderer.c b/src/rygel-playbin-renderer.c
index 4d02340..7b09f08 100644
--- a/src/rygel-playbin-renderer.c
+++ b/src/rygel-playbin-renderer.c
@@ -26,11 +26,26 @@
 #include <glib/gi18n.h>
 
 
-#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
-
-#define _g_object_unref0(var) ((var == NULL) ? NULL : (var = (g_object_unref (var), NULL)))
+/**
+ * A UPnP renderer that uses a GStreamer Playbin2 element.
+ *
+ * Using GstPlayBin2 as a model, it reflects any changes done externally, such as
+ * changing the currently played URI, volume, pause/play etc., to UPnP.
+ *
+ * Likewise, the playbin can be modified externally using UPnP.
+ *
+ * You can retrieve the GstPlayBin2 by calling rygel_playbin_renderer_get_playbin().
+ * You should then set the "video-sink" and "audio-sink" properties of the
+ * playbin.
+ *
+ * Call rygel_media_device_add_interface() on the Renderer to allow it
+ * to be controlled by a control point and to retrieve data streams via that
+ * network interface.
+ *
+ * See the <link linkend="implementing-renderers-gst">Implementing GStreamer-based Renderers</link> section.
+ */
 
-static gpointer rygel_playbin_renderer_parent_class = NULL;
+G_DEFINE_TYPE (RygelPlaybinRenderer, rygel_playbin_renderer, RYGEL_TYPE_MEDIA_RENDERER)
 
 /**
      * Create a new instance of Renderer.
@@ -50,7 +65,7 @@ RygelPlaybinRenderer* rygel_playbin_renderer_construct (GType object_type, const
 	_tmp1_ = rygel_playbin_player_get_default ();
 	_tmp2_ = _tmp1_;
 	self = (RygelPlaybinRenderer*) g_object_new (object_type, "title", _tmp0_, "player", _tmp2_, NULL);
-	_g_object_unref0 (_tmp2_);
+	g_object_unref (_tmp2_);
 	return self;
 }
 
@@ -83,7 +98,7 @@ GstElement* rygel_playbin_renderer_get_playbin (RygelPlaybinRenderer* self) {
 	_tmp2_ = _tmp1_;
 	_tmp3_ = _gst_object_ref0 (_tmp2_);
 	result = _tmp3_;
-	_g_object_unref0 (player);
+	g_object_unref (player);
 	return result;
 }
 
@@ -107,38 +122,9 @@ static void rygel_playbin_renderer_class_init (RygelPlaybinRendererClass * klass
 }
 
 
-static void rygel_playbin_renderer_instance_init (RygelPlaybinRenderer * self) {
+static void rygel_playbin_renderer_init (RygelPlaybinRenderer * self) {
 }
 
 
-/**
- * A UPnP renderer that uses a GStreamer Playbin2 element.
- *
- * Using GstPlayBin2 as a model, it reflects any changes done externally, such as
- * changing the currently played URI, volume, pause/play etc., to UPnP.
- *
- * Likewise, the playbin can be modified externally using UPnP.
- *
- * You can retrieve the GstPlayBin2 by calling rygel_playbin_renderer_get_playbin().
- * You should then set the "video-sink" and "audio-sink" properties of the
- * playbin.
- *
- * Call rygel_media_device_add_interface() on the Renderer to allow it
- * to be controlled by a control point and to retrieve data streams via that
- * network interface.
- *
- * See the <link linkend="implementing-renderers-gst">Implementing GStreamer-based Renderers</link> section.
- */
-GType rygel_playbin_renderer_get_type (void) {
-	static volatile gsize rygel_playbin_renderer_type_id__volatile = 0;
-	if (g_once_init_enter (&rygel_playbin_renderer_type_id__volatile)) {
-		static const GTypeInfo g_define_type_info = { sizeof (RygelPlaybinRendererClass), (GBaseInitFunc) NULL, (GBaseFinalizeFunc) NULL, (GClassInitFunc) rygel_playbin_renderer_class_init, (GClassFinalizeFunc) NULL, NULL, sizeof (RygelPlaybinRenderer), 0, (GInstanceInitFunc) rygel_playbin_renderer_instance_init, NULL };
-		GType rygel_playbin_renderer_type_id;
-		rygel_playbin_renderer_type_id = g_type_register_static (RYGEL_TYPE_MEDIA_RENDERER, "RygelPlaybinRenderer", &g_define_type_info, 0);
-		g_once_init_leave (&rygel_playbin_renderer_type_id__volatile, rygel_playbin_renderer_type_id);
-	}
-	return rygel_playbin_renderer_type_id__volatile;
-}
-
 
 



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]