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



commit dd121cb4710eb1db1cc57a4dd090cda6d24cf73d
Author: Murray Cumming <murrayc murrayc com>
Date:   Tue Jan 22 14:28:56 2013 +0100

    cleanup

 src/rygel-playbin-player.c   |  384 +++++++++++++++++-------------------------
 src/rygel-playbin-renderer.c |   96 ++++-------
 2 files changed, 183 insertions(+), 297 deletions(-)
---
diff --git a/src/rygel-playbin-player.c b/src/rygel-playbin-player.c
index dd5121e..cc69b9e 100644
--- a/src/rygel-playbin-player.c
+++ b/src/rygel-playbin-player.c
@@ -54,7 +54,7 @@ struct _RygelPlaybinPlayerPrivate {
   GstElement *_playbin;
   gchar *_playback_state;
   gchar **_allowed_playback_speeds;
-  gint _allowed_playback_speeds_length1;
+  gint _allowed_playback_speeds_length;
   gint __allowed_playback_speeds_size_;
   gchar *_playback_speed;
   gchar *transfer_mode;
@@ -84,18 +84,16 @@ enum  {
   RYGEL_PLAYBIN_PLAYER_DURATION,
   RYGEL_PLAYBIN_PLAYER_POSITION
 };
+
 #define RYGEL_PLAYBIN_PLAYER_TRANSFER_MODE_STREAMING "Streaming"
 #define RYGEL_PLAYBIN_PLAYER_TRANSFER_MODE_INTERACTIVE "Interactive"
 #define RYGEL_PLAYBIN_PLAYER_PROTOCOL_INFO_TEMPLATE "http-get:%s:*:%s"
-static RygelPlaybinPlayer* rygel_playbin_player_new (void);
-static RygelPlaybinPlayer* rygel_playbin_player_construct (GType object_type);
+
 static void rygel_playbin_player_set_playbin (RygelPlaybinPlayer *self, GstElement *value);
 static void rygel_playbin_player_setup_playbin (RygelPlaybinPlayer *self);
 static gboolean rygel_playbin_player_real_seek (RygelMediaPlayer *base, gint64 time);
 static gchar **rygel_playbin_player_real_get_protocols (RygelMediaPlayer *base, int *result_length1);
-static gchar **_vala_array_dup1 (gchar **self, int length);
 static gchar **rygel_playbin_player_real_get_mime_types (RygelMediaPlayer *base, int *result_length1);
-static gchar **_vala_array_dup2 (gchar **self, int length);
 static gboolean rygel_playbin_player_is_rendering_image (RygelPlaybinPlayer *self);
 static inline GstCaps* _dynamic_get_caps0 (GstElement *obj);
 static void rygel_playbin_player_bus_handler (RygelPlaybinPlayer *self, GstBus *bus, GstMessage *message);
@@ -119,134 +117,95 @@ static void _vala_rygel_playbin_player_set_property (GObject *object, guint prop
 static void _vala_array_destroy (gpointer array, gint array_length, GDestroyNotify destroy_func);
 static void _vala_array_free (gpointer array, gint array_length, GDestroyNotify destroy_func);
 
-static const gchar *RYGEL_PLAYBIN_PLAYER_protocols[2] = {"http-get", "rtsp"};
-static const gchar *RYGEL_PLAYBIN_PLAYER_mime_types[40] = {"audio/mpeg", "application/ogg", "audio/x-vorbis", "audio/x-vorbis+ogg", "audio/ogg", "audio/x-ms-wma", "audio/x-ms-asf", "audio/x-flac", "audio/x-flac+ogg", "audio/flac", "audio/mp4", "audio/vnd.dlna.adts", "audio/x-mod", "audio/x-wav", "audio/x-ac3", "audio/x-m4a", "audio/L16;rate=44100;channels=2", "audio/L16;rate=44100;channels=1", "audio/L16;channels=2;rate=44100", "audio/L16;channels=1;rate=44100", "audio/L16;rate=44100", "image/jpeg", "image/png", "video/x-theora", "video/x-theora+ogg", "video/x-oggm", "video/ogg", "video/x-dirac", "video/x-wmv", "video/x-wma", "video/x-msvideo", "video/x-3ivx", "video/x-3ivx", "video/x-matroska", "video/x-mkv", "video/mpeg", "video/mp4", "video/x-ms-asf", "video/x-xvid", "video/x-ms-wmv"};
+static const gchar *RYGEL_PLAYBIN_PLAYER_PROTOCOLS[2] = {"http-get", "rtsp"};
+static const gchar *RYGEL_PLAYBIN_PLAYER_MIME_TYPES[40] = {"audio/mpeg", "application/ogg", "audio/x-vorbis", "audio/x-vorbis+ogg", "audio/ogg", "audio/x-ms-wma", "audio/x-ms-asf", "audio/x-flac", "audio/x-flac+ogg", "audio/flac", "audio/mp4", "audio/vnd.dlna.adts", "audio/x-mod", "audio/x-wav", "audio/x-ac3", "audio/x-m4a", "audio/L16;rate=44100;channels=2", "audio/L16;rate=44100;channels=1", "audio/L16;channels=2;rate=44100", "audio/L16;channels=1;rate=44100", "audio/L16;rate=44100", "image/jpeg", "image/png", "video/x-theora", "video/x-theora+ogg", "video/x-oggm", "video/ogg", "video/x-dirac", "video/x-wmv", "video/x-wma", "video/x-msvideo", "video/x-3ivx", "video/x-3ivx", "video/x-matroska", "video/x-mkv", "video/mpeg", "video/mp4", "video/x-ms-asf", "video/x-xvid", "video/x-ms-wmv"};
 
-static RygelPlaybinPlayer* rygel_playbin_player_construct (GType object_type) {
-  RygelPlaybinPlayer *self = NULL;
-  GstElement *_tmp0_ = NULL;
-  GstElement *_tmp1_;
-  self = (RygelPlaybinPlayer*) g_object_new (object_type, NULL);
-  _tmp0_ = gst_element_factory_make ("playbin2", NULL);
-  if (_tmp0_ != NULL) {
-    gst_object_ref_sink (_tmp0_);
+
+static RygelPlaybinPlayer*
+rygel_playbin_player_new (void) {
+  RygelPlaybinPlayer *self;
+
+  self = RYGEL_PLAYBIN_PLAYER (g_object_new (RYGEL_TYPE_PLAYBIN_PLAYER, NULL));
+
+  /* TODO: This should really be done via a construct property. */
+  GstElement *playbin = gst_element_factory_make ("playbin2", NULL);
+  if (playbin) {
+    gst_object_ref_sink (playbin);
   }
-  _tmp1_ = _tmp0_;
-  rygel_playbin_player_set_playbin (self, _tmp1_);
-  gst_object_unref (_tmp1_);
+
+  rygel_playbin_player_set_playbin (self, playbin);
+  gst_object_unref (playbin);
+
   self->priv->foreign = FALSE;
   rygel_playbin_player_setup_playbin (self);
+
   return self;
 }
 
+static RygelPlaybinPlayer* rygel_playbin_player_player = NULL;
 
-static RygelPlaybinPlayer* rygel_playbin_player_new (void) {
-  return rygel_playbin_player_construct (RYGEL_TYPE_PLAYBIN_PLAYER);
-}
+RygelPlaybinPlayer*
+rygel_playbin_player_get_default (void) {
+  if (!rygel_playbin_player_player) {
+    rygel_playbin_player_player = rygel_playbin_player_new ();
+  }
 
-static gpointer _g_object_ref0 (gpointer self) {
-  return self ? g_object_ref (self) : NULL;
+  g_object_ref (rygel_playbin_player_player);
+  return rygel_playbin_player_player;
 }
 
 
-static RygelPlaybinPlayer* rygel_playbin_player_player = NULL;
+static gboolean rygel_playbin_player_real_seek (RygelMediaPlayer *base, gint64 time) {
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+  g_return_val_if_fail (self, FALSE);
 
-RygelPlaybinPlayer* rygel_playbin_player_get_default (void) {
-  RygelPlaybinPlayer *result = NULL;
-  RygelPlaybinPlayer *_tmp0_;
-  RygelPlaybinPlayer *_tmp2_;
-  RygelPlaybinPlayer *_tmp3_;
-  _tmp0_ = rygel_playbin_player_player;
-  if (_tmp0_ == NULL) {
-    RygelPlaybinPlayer *_tmp1_;
-    _tmp1_ = rygel_playbin_player_new ();
-    g_object_unref (rygel_playbin_player_player);
-    rygel_playbin_player_player = _tmp1_;
-  }
-  _tmp2_ = rygel_playbin_player_player;
-  _tmp3_ = _g_object_ref0 (_tmp2_);
-  result = _tmp3_;
-  return result;
+  return gst_element_seek (self->priv->_playbin, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, time * GST_USECOND, GST_SEEK_TYPE_NONE, (gint64) (-1));
 }
 
 
-static gboolean rygel_playbin_player_real_seek (RygelMediaPlayer *base, gint64 time) {
-  RygelPlaybinPlayer *self;
-  gboolean result = FALSE;
-  GstElement *_tmp0_;
-  gint64 _tmp1_;
-  gboolean _tmp2_ = FALSE;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = self->priv->_playbin;
-  _tmp1_ = time;
-  _tmp2_ = gst_element_seek (_tmp0_, 1.0, GST_FORMAT_TIME, GST_SEEK_FLAG_FLUSH, GST_SEEK_TYPE_SET, _tmp1_ * GST_USECOND, GST_SEEK_TYPE_NONE, (gint64) (-1));
-  result = _tmp2_;
-  return result;
-}
+static gchar**
+rygel_playbin_player_real_get_protocols (RygelMediaPlayer *base, int *result_length) {
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+  int length = 0;
+  gchar **result = NULL;
+  int i = 0;
+
+  g_return_val_if_fail (self, NULL);
 
+  length =  G_N_ELEMENTS (RYGEL_PLAYBIN_PLAYER_PROTOCOLS);
+
+  if (result_length) {
+    *result_length = length;
+  }
 
-static gchar **_vala_array_dup1 (gchar **self, int length) {
-  gchar **result;
-  int i;
   result = g_new0 (gchar*, length + 1);
   for (i = 0; i < length; i++) {
-    gchar *_tmp0_;
-    _tmp0_ = g_strdup (self[i]);
-    result[i] = _tmp0_;
+    result[i] = g_strdup (RYGEL_PLAYBIN_PLAYER_PROTOCOLS[i]);
   }
+
   return result;
 }
 
-
-static gchar **rygel_playbin_player_real_get_protocols (RygelMediaPlayer *base, int *result_length1) {
-  RygelPlaybinPlayer *self;
+static gchar**
+rygel_playbin_player_real_get_mime_types (RygelMediaPlayer *base, int *result_length) {
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+  int length = 0;
   gchar **result = NULL;
-  gchar **_tmp0_;
-  gint _tmp0__length1;
-  gchar **_tmp1_;
-  gint _tmp1__length1;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = (RYGEL_PLAYBIN_PLAYER_protocols != NULL) ? _vala_array_dup1 (RYGEL_PLAYBIN_PLAYER_protocols, G_N_ELEMENTS (RYGEL_PLAYBIN_PLAYER_protocols)) : ((gpointer) RYGEL_PLAYBIN_PLAYER_protocols);
-  _tmp0__length1 = G_N_ELEMENTS (RYGEL_PLAYBIN_PLAYER_protocols);
-  _tmp1_ = _tmp0_;
-  _tmp1__length1 = _tmp0__length1;
-  if (result_length1) {
-   *result_length1 = _tmp1__length1;
-  }
-  result = _tmp1_;
-  return result;
-}
+  int i = 0;
+
+  g_return_val_if_fail (self, NULL);
 
+  length =  G_N_ELEMENTS (RYGEL_PLAYBIN_PLAYER_MIME_TYPES);
+
+  if (result_length) {
+    *result_length = length;
+  }
 
-static gchar **_vala_array_dup2 (gchar **self, int length) {
-  gchar **result;
-  int i;
   result = g_new0 (gchar*, length + 1);
   for (i = 0; i < length; i++) {
-    gchar *_tmp0_;
-    _tmp0_ = g_strdup (self[i]);
-    result[i] = _tmp0_;
+    result[i] = g_strdup (RYGEL_PLAYBIN_PLAYER_MIME_TYPES[i]);
   }
-  return result;
-}
-
 
-static gchar **rygel_playbin_player_real_get_mime_types (RygelMediaPlayer *base, int *result_length1) {
-  RygelPlaybinPlayer *self;
-  gchar **result = NULL;
-  gchar **_tmp0_;
-  gint _tmp0__length1;
-  gchar **_tmp1_;
-  gint _tmp1__length1;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = (RYGEL_PLAYBIN_PLAYER_mime_types != NULL) ? _vala_array_dup2 (RYGEL_PLAYBIN_PLAYER_mime_types, G_N_ELEMENTS (RYGEL_PLAYBIN_PLAYER_mime_types)) : ((gpointer) RYGEL_PLAYBIN_PLAYER_mime_types);
-  _tmp0__length1 = G_N_ELEMENTS (RYGEL_PLAYBIN_PLAYER_mime_types);
-  _tmp1_ = _tmp0_;
-  _tmp1__length1 = _tmp0__length1;
-  if (result_length1) {
-   *result_length1 = _tmp1__length1;
-  }
-  result = _tmp1_;
   return result;
 }
 
@@ -632,11 +591,11 @@ static void rygel_playbin_player_on_uri_notify (RygelPlaybinPlayer *self, GParam
 
 
 /**
-     * Generate basic DIDLLite information.
-     *
-     * This is used when the URI gets changed externally. DLNA requires that a
-     * minimum DIDLLite is always present if the URI is not empty.
-     */
+ * Generate basic DIDLLite information.
+ *
+ * This is used when the URI gets changed externally. DLNA requires that a
+ * minimum DIDLLite is always present if the URI is not empty.
+ */
 static gchar *rygel_playbin_player_generate_basic_didl (RygelPlaybinPlayer *self) {
   gchar *result = NULL;
   GUPnPDIDLLiteWriter *_tmp0_;
@@ -742,42 +701,31 @@ static void rygel_playbin_player_setup_playbin (RygelPlaybinPlayer *self) {
 
 
 GstElement* rygel_playbin_player_get_playbin (RygelPlaybinPlayer *self) {
-  GstElement *result;
-  GstElement *_tmp0_;
-  g_return_val_if_fail (self != NULL, NULL);
-  _tmp0_ = self->priv->_playbin;
-  result = _tmp0_;
-  return result;
+  g_return_val_if_fail (self, NULL);
+
+  /* TODO: Shouldn't we ref this, like other GStreamer getters? */
+  return self->priv->_playbin;
 }
 
+static void rygel_playbin_player_set_playbin (RygelPlaybinPlayer *self, GstElement *value) {
+  g_return_if_fail (self);
 
-static gpointer _gst_object_ref0 (gpointer self) {
-  return self ? gst_object_ref (self) : NULL;
-}
+  if(self->priv->_playbin)
+    gst_object_unref (self->priv->_playbin);
 
+  gst_object_ref (value);
+  self->priv->_playbin = value;
 
-static void rygel_playbin_player_set_playbin (RygelPlaybinPlayer *self, GstElement *value) {
-  GstElement *_tmp0_;
-  GstElement *_tmp1_;
-  g_return_if_fail (self != NULL);
-  _tmp0_ = value;
-  _tmp1_ = _gst_object_ref0 (_tmp0_);
-  gst_object_unref (self->priv->_playbin);
-  self->priv->_playbin = _tmp1_;
-  g_object_notify ((GObject *) self, "playbin");
+  g_object_notify (G_OBJECT (self), "playbin");
 }
 
 
 static gchar *rygel_playbin_player_real_get_playback_state (RygelMediaPlayer *base) {
-  gchar *result;
-  RygelPlaybinPlayer *self;
-  const gchar *_tmp0_;
-  gchar *_tmp1_;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = self->priv->_playback_state;
-  _tmp1_ = g_strdup (_tmp0_);
-  result = _tmp1_;
-  return result;
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_val_if_fail (self, NULL);
+
+  return g_strdup (self->priv->_playback_state);
 }
 
 
@@ -920,82 +868,60 @@ static void rygel_playbin_player_real_set_playback_state (RygelMediaPlayer *base
       }
     }
   }
-  g_object_notify ((GObject *) self, "playback-state");
+  g_object_notify (G_OBJECT (self), "playback-state");
 }
 
-static gchar **_vala_array_dup3 (gchar **self, int length) {
-  gchar **result;
-  int i;
-  result = g_new0 (gchar*, length + 1);
-  for (i = 0; i < length; i++) {
-    gchar *_tmp0_;
-    _tmp0_ = g_strdup (self[i]);
-    result[i] = _tmp0_;
-  }
-  return result;
-}
 
+static gchar **rygel_playbin_player_real_get_allowed_playback_speeds (RygelMediaPlayer *base, int *result_length) {
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+  int length = 0;
+  gchar **result = NULL;
+  int i = 0;
 
-static gchar **rygel_playbin_player_real_get_allowed_playback_speeds (RygelMediaPlayer *base, int *result_length1) {
-  gchar **result;
-  RygelPlaybinPlayer *self;
-  gchar **_tmp0_;
-  gint _tmp0__length1;
-  gchar **_tmp1_;
-  gint _tmp1__length1;
-  gchar **_tmp2_;
-  gint _tmp2__length1;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = self->priv->_allowed_playback_speeds;
-  _tmp0__length1 = self->priv->_allowed_playback_speeds_length1;
-  _tmp1_ = (_tmp0_ != NULL) ? _vala_array_dup3 (_tmp0_, _tmp0__length1) : ((gpointer) _tmp0_);
-  _tmp1__length1 = _tmp0__length1;
-  _tmp2_ = _tmp1_;
-  _tmp2__length1 = _tmp1__length1;
-  if (result_length1) {
-    *result_length1 = _tmp2__length1;
+  g_return_val_if_fail (self, NULL);
+
+  if (result_length) {
+    *result_length = self->priv->_allowed_playback_speeds_length;
   }
-  result = _tmp2_;
+
+  result = g_new0 (gchar*, self->priv->_allowed_playback_speeds_length + 1);
+  for (i = 0; i < self->priv->_allowed_playback_speeds_length; i++) {
+    result[i] = g_strdup (self->priv->_allowed_playback_speeds[i]);
+  }
+
   return result;
 }
 
 
 static gchar *rygel_playbin_player_real_get_playback_speed (RygelMediaPlayer *base) {
-  gchar *result;
-  RygelPlaybinPlayer *self;
-  const gchar *_tmp0_;
-  gchar *_tmp1_;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = self->priv->_playback_speed;
-  _tmp1_ = g_strdup (_tmp0_);
-  result = _tmp1_;
-  return result;
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_val_if_fail (self, NULL);
+
+  return g_strdup (self->priv->_playback_speed);
 }
 
 
 static void rygel_playbin_player_real_set_playback_speed (RygelMediaPlayer *base, const gchar *value) {
-  RygelPlaybinPlayer *self;
-  const gchar *_tmp0_;
-  gchar *_tmp1_;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = value;
-  _tmp1_ = g_strdup (_tmp0_);
-  g_free (self->priv->_playback_speed);
-  self->priv->_playback_speed = _tmp1_;
-  g_object_notify ((GObject *) self, "playback-speed");
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_if_fail (self);
+
+  if (self->priv->_playback_speed)
+    g_free (self->priv->_playback_speed);
+
+  self->priv->_playback_speed = g_strdup (value);
+
+  g_object_notify (G_OBJECT (self), "playback-speed");
 }
 
 
 static gchar *rygel_playbin_player_real_get_uri (RygelMediaPlayer *base) {
-  gchar *result;
-  RygelPlaybinPlayer *self;
-  const gchar *_tmp0_;
-  gchar *_tmp1_;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = self->priv->_uri;
-  _tmp1_ = g_strdup (_tmp0_);
-  result = _tmp1_;
-  return result;
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_val_if_fail (self, NULL);
+
+  return g_strdup (self->priv->_uri);
 }
 
 
@@ -1095,33 +1021,30 @@ static void rygel_playbin_player_real_set_uri (RygelMediaPlayer *base, const gch
   }
   _tmp16_ = value;
   g_debug ("rygel-playbin-player.vala:179: URI set to %s.", _tmp16_);
-  g_object_notify ((GObject *) self, "uri");
+  g_object_notify (G_OBJECT (self), "uri");
 }
 
 
 static gchar *rygel_playbin_player_real_get_mime_type (RygelMediaPlayer *base) {
-  gchar *result;
-  RygelPlaybinPlayer *self;
-  const gchar *_tmp0_;
-  gchar *_tmp1_;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = self->priv->_mime_type;
-  _tmp1_ = g_strdup (_tmp0_);
-  result = _tmp1_;
-  return result;
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_val_if_fail (self, NULL);
+
+  return g_strdup (self->priv->_mime_type);
 }
 
 
 static void rygel_playbin_player_real_set_mime_type (RygelMediaPlayer *base, const gchar *value) {
-  RygelPlaybinPlayer *self;
-  const gchar *_tmp0_;
-  gchar *_tmp1_;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = value;
-  _tmp1_ = g_strdup (_tmp0_);
-  g_free (self->priv->_mime_type);
-  self->priv->_mime_type = _tmp1_;
-  g_object_notify ((GObject *) self, "mime-type");
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_if_fail (self);
+
+  if (self->priv->_mime_type)
+    g_free (self->priv->_mime_type);
+
+  self->priv->_mime_type = g_strdup (value);
+
+  g_object_notify (G_OBJECT (self), "mime-type");
 }
 
 
@@ -1139,15 +1062,16 @@ static gchar *rygel_playbin_player_real_get_metadata (RygelMediaPlayer *base) {
 
 
 static void rygel_playbin_player_real_set_metadata (RygelMediaPlayer *base, const gchar *value) {
-  RygelPlaybinPlayer *self;
-  const gchar *_tmp0_;
-  gchar *_tmp1_;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = value;
-  _tmp1_ = g_strdup (_tmp0_);
-  g_free (self->priv->_metadata);
-  self->priv->_metadata = _tmp1_;
-  g_object_notify ((GObject *) self, "metadata");
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_if_fail (self);
+
+  if (self->priv->_metadata)
+    g_free (self->priv->_metadata);
+
+  self->priv->_metadata = g_strdup (value);
+
+  g_object_notify (G_OBJECT (self), "metadata");
 }
 
 
@@ -1180,15 +1104,11 @@ static gboolean rygel_playbin_player_real_get_can_seek (RygelMediaPlayer *base)
 
 
 static gchar *rygel_playbin_player_real_get_content_features (RygelMediaPlayer *base) {
-  gchar *result;
-  RygelPlaybinPlayer *self;
-  const gchar *_tmp0_;
-  gchar *_tmp1_;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = self->priv->_content_features;
-  _tmp1_ = g_strdup (_tmp0_);
-  result = _tmp1_;
-  return result;
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_val_if_fail (self, NULL);
+
+  return g_strdup (self->priv->_content_features);
 }
 
 
@@ -1276,7 +1196,7 @@ static void rygel_playbin_player_real_set_content_features (RygelMediaPlayer *ba
   g_free (self->priv->_content_features);
   self->priv->_content_features = _tmp16_;
   g_free (pi_string);
-  g_object_notify ((GObject *) self, "content-features");
+  g_object_notify (G_OBJECT (self), "content-features");
 }
 
 
@@ -1318,7 +1238,7 @@ static void rygel_playbin_player_real_set_volume (RygelMediaPlayer *base, gdoubl
   _dynamic_set_volume7 (_tmp0_, _tmp1_);
   _tmp2_ = value;
   g_debug ("rygel-playbin-player.vala:240: volume set to %f.", _tmp2_);
-  g_object_notify ((GObject *) self, "volume");
+  g_object_notify (G_OBJECT (self), "volume");
 }
 
 
@@ -1444,7 +1364,7 @@ static void rygel_playbin_player_finalize (GObject *obj) {
   self = G_TYPE_CHECK_INSTANCE_CAST (obj, RYGEL_TYPE_PLAYBIN_PLAYER, RygelPlaybinPlayer);
   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);
+  self->priv->_allowed_playback_speeds = (_vala_array_free (self->priv->_allowed_playback_speeds, self->priv->_allowed_playback_speeds_length, (GDestroyNotify) g_free), NULL);
   g_free (self->priv->_playback_speed);
   g_free (self->priv->transfer_mode);
   g_free (self->priv->_uri);
diff --git a/src/rygel-playbin-renderer.c b/src/rygel-playbin-renderer.c
index 8a7975a..46e872e 100644
--- a/src/rygel-playbin-renderer.c
+++ b/src/rygel-playbin-renderer.c
@@ -48,83 +48,49 @@
 G_DEFINE_TYPE (RygelPlaybinRenderer, rygel_playbin_renderer, RYGEL_TYPE_MEDIA_RENDERER)
 
 /**
-     * Create a new instance of Renderer.
-     *
-     * Renderer will instantiate its own instance of GstPlayBin2.
-     * The GstPlayBin2 can be accessed by using rygel_playbin_player_get_playbin().
-     *
-     * @param title Friendly name of the new UPnP renderer on the network.
-     */
-RygelPlaybinRenderer* rygel_playbin_renderer_construct (GType object_type, const gchar *title) {
-  RygelPlaybinRenderer *self = NULL;
-  const gchar *_tmp0_;
-  RygelPlaybinPlayer *_tmp1_ = NULL;
-  RygelPlaybinPlayer *_tmp2_;
-  g_return_val_if_fail (title != NULL, NULL);
-  _tmp0_ = title;
-  _tmp1_ = rygel_playbin_player_get_default ();
-  _tmp2_ = _tmp1_;
-  self = (RygelPlaybinRenderer*) g_object_new (object_type, "title", _tmp0_, "player", _tmp2_, NULL);
-  g_object_unref (_tmp2_);
-  return self;
-}
-
-
-RygelPlaybinRenderer* rygel_playbin_renderer_new (const gchar *title) {
-  return rygel_playbin_renderer_construct (RYGEL_TYPE_PLAYBIN_RENDERER, title);
+ * Create a new instance of Renderer.
+ *
+ * Renderer will instantiate its own instance of GstPlayBin2.
+ * The GstPlayBin2 can be accessed by using rygel_playbin_player_get_playbin().
+ *
+ * @param title Friendly name of the new UPnP renderer on the network.
+ */
+RygelPlaybinRenderer*
+rygel_playbin_renderer_new (const gchar *title) {
+  RygelPlaybinPlayer *player = rygel_playbin_player_get_default ();
+  return RYGEL_PLAYBIN_RENDERER (g_object_new (RYGEL_TYPE_PLAYBIN_RENDERER,
+    "title", title,
+    "player", player,
+    NULL));
 }
 
-
 /**
-     * Get the GstPlaybin2 used by this Renderer.
-     */
-static gpointer _gst_object_ref0 (gpointer self) {
-  return self ? gst_object_ref (self) : NULL;
-}
-
-
-GstElement* rygel_playbin_renderer_get_playbin (RygelPlaybinRenderer *self) {
-  GstElement *result = NULL;
-  RygelPlaybinPlayer *_tmp0_ = NULL;
+ * Get the GstPlaybin2 used by this Renderer.
+ */
+GstElement*
+rygel_playbin_renderer_get_playbin (RygelPlaybinRenderer *self) {
   RygelPlaybinPlayer *player;
-  GstElement *_tmp1_;
-  GstElement *_tmp2_;
-  GstElement *_tmp3_;
+  GstElement *result;
+
   g_return_val_if_fail (self != NULL, NULL);
-  _tmp0_ = rygel_playbin_player_get_default ();
-  player = _tmp0_;
+
+  player = rygel_playbin_player_get_default ();  /* TODO: Do not return a ref from this? */
   g_return_val_if_fail (player != NULL, NULL);
-  _tmp1_ = rygel_playbin_player_get_playbin (player);
-  _tmp2_ = _tmp1_;
-  _tmp3_ = _gst_object_ref0 (_tmp2_);
-  result = _tmp3_;
-  g_object_unref (player);
-  return result;
-}
 
+  result = rygel_playbin_player_get_playbin (player);
+  g_return_val_if_fail (result != NULL, NULL);
 
-static void rygel_playbin_renderer_prepare_upnp (RygelPlaybinRenderer *self, const gchar *title) {
-  RygelPlugin *_tmp0_;
-  RygelPlugin *_tmp1_;
-  const gchar *_tmp2_;
-  g_return_if_fail (self != NULL);
-  g_return_if_fail (title != NULL);
-  _tmp0_ = rygel_media_device_get_plugin ((RygelMediaDevice*) self);
-  _tmp1_ = _tmp0_;
-  _tmp2_ = title;
-  rygel_plugin_set_title (_tmp1_, _tmp2_);
-  rygel_media_device_add_interface ((RygelMediaDevice*) self, "lo");
+  g_object_unref (player);
+  gst_object_ref (result);
+  return result;
 }
 
 
-static void rygel_playbin_renderer_class_init (RygelPlaybinRendererClass *klass) {
+static void
+rygel_playbin_renderer_class_init (RygelPlaybinRendererClass *klass) {
   rygel_playbin_renderer_parent_class = g_type_class_peek_parent (klass);
 }
 
-
-static void rygel_playbin_renderer_init (RygelPlaybinRenderer *self) {
+static void
+rygel_playbin_renderer_init (RygelPlaybinRenderer *self) {
 }
-
-
-
-



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