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



commit 244b52208028891841e10f27dde1220b46a55b39
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Jan 28 11:47:42 2013 +0100

    cleanup

 src/rygel-playbin-player.c |  504 ++++++++++++++++----------------------------
 1 files changed, 187 insertions(+), 317 deletions(-)
---
diff --git a/src/rygel-playbin-player.c b/src/rygel-playbin-player.c
index 34d71da..66b06af 100644
--- a/src/rygel-playbin-player.c
+++ b/src/rygel-playbin-player.c
@@ -96,14 +96,9 @@ static gchar **rygel_playbin_player_real_get_protocols (RygelMediaPlayer *base,
 static gchar **rygel_playbin_player_real_get_mime_types (RygelMediaPlayer *base, int *result_length1);
 static gboolean rygel_playbin_player_is_rendering_image (RygelPlaybinPlayer *self);
 static void rygel_playbin_player_bus_handler (GstBus *bus, GstMessage *message, gpointer user_data);
-static inline gchar *_dynamic_get_uri1 (GstElement *obj);
-static inline gchar *_dynamic_get_uri2 (GstElement *obj);
 static gchar *rygel_playbin_player_generate_basic_didl (RygelPlaybinPlayer *self);
 static void rygel_playbin_player_on_source_setup (GstElement *sender, GstElement *source, gpointer user_data);
 static void rygel_playbin_player_on_uri_notify (GObject *sender, GParamSpec *pspec, gpointer user_data);
-static inline void _dynamic_set_auto_flush_bus4 (GstElement *obj, gboolean value);
-static inline void _dynamic_set_uri5 (GstElement *obj, const gchar *value);
-static inline void _dynamic_set_volume7 (GstElement *obj, gdouble value);
 static void rygel_playbin_player_finalize (GObject *obj);
 static void _vala_rygel_playbin_player_get_property (GObject *object, guint property_id, GValue *value, GParamSpec *pspec);
 static void _vala_rygel_playbin_player_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec);
@@ -146,7 +141,8 @@ rygel_playbin_player_get_default (void) {
 }
 
 
-static gboolean rygel_playbin_player_real_seek (RygelMediaPlayer *base, gint64 time) {
+static gboolean
+rygel_playbin_player_real_seek (RygelMediaPlayer *base, gint64 time) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
   g_return_val_if_fail (self, FALSE);
   g_return_val_if_fail (self->priv->_playbin, FALSE);
@@ -202,7 +198,8 @@ rygel_playbin_player_real_get_mime_types (RygelMediaPlayer *base, int *result_le
 }
 
 
-static gboolean rygel_playbin_player_is_rendering_image (RygelPlaybinPlayer *self) {
+static gboolean
+rygel_playbin_player_is_rendering_image (RygelPlaybinPlayer *self) {
   GstElement* typefind = NULL;
   GstCaps *caps = NULL;
   GstStructure *structure = NULL;
@@ -232,20 +229,6 @@ static gboolean rygel_playbin_player_is_rendering_image (RygelPlaybinPlayer *sel
   return result;
 }
 
-static inline gchar *_dynamic_get_uri1 (GstElement *obj) {
-  gchar *result;
-  g_object_get (obj, "uri", &result, NULL);
-  return result;
-}
-
-
-static inline gchar *_dynamic_get_uri2 (GstElement *obj) {
-  gchar *result;
-  g_object_get (obj, "uri", &result, NULL);
-  return result;
-}
-
-
 static void
 rygel_playbin_player_bus_handler (GstBus *bus, GstMessage *message, gpointer user_data) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (user_data);
@@ -399,7 +382,8 @@ rygel_playbin_player_bus_handler (GstBus *bus, GstMessage *message, gpointer use
  * 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) {
+static gchar*
+rygel_playbin_player_generate_basic_didl (RygelPlaybinPlayer *self) {
   GUPnPDIDLLiteWriter *writer = NULL;
   GUPnPDIDLLiteItem *item = NULL;
   GUPnPDIDLLiteResource *resource = NULL;
@@ -435,11 +419,8 @@ static gchar *rygel_playbin_player_generate_basic_didl (RygelPlaybinPlayer *self
 }
 
 
-static inline void _dynamic_set_auto_flush_bus4 (GstElement *obj, gboolean value) {
-  g_object_set (obj, "auto-flush-bus", value, NULL);
-}
-
-static void rygel_playbin_player_on_source_setup (GstElement *sender, GstElement *source, gpointer user_data) {
+static void
+rygel_playbin_player_on_source_setup (GstElement *sender, GstElement *source, gpointer user_data) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (user_data);
 
   GstStructure *structure = NULL;
@@ -462,7 +443,8 @@ static void rygel_playbin_player_on_source_setup (GstElement *sender, GstElement
   }
 }
 
-static void rygel_playbin_player_on_uri_notify (GObject *sender, GParamSpec *pspec, gpointer user_data) {
+static void
+rygel_playbin_player_on_uri_notify (GObject *sender, GParamSpec *pspec, gpointer user_data) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (user_data);
 
   g_return_if_fail (self);
@@ -471,7 +453,8 @@ static void rygel_playbin_player_on_uri_notify (GObject *sender, GParamSpec *psp
   self->priv->uri_update_hint = TRUE;
 }
 
-static void rygel_playbin_player_setup_playbin (RygelPlaybinPlayer *self) {
+static void
+rygel_playbin_player_setup_playbin (RygelPlaybinPlayer *self) {
   GstBus *bus = NULL;
 
   g_return_if_fail (self);
@@ -501,14 +484,16 @@ static void rygel_playbin_player_setup_playbin (RygelPlaybinPlayer *self) {
 }
 
 
-GstElement* rygel_playbin_player_get_playbin (RygelPlaybinPlayer *self) {
+GstElement*
+rygel_playbin_player_get_playbin (RygelPlaybinPlayer *self) {
   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) {
+static void
+rygel_playbin_player_set_playbin (RygelPlaybinPlayer *self, GstElement *value) {
   g_return_if_fail (self);
 
   if(self->priv->_playbin)
@@ -521,7 +506,8 @@ static void rygel_playbin_player_set_playbin (RygelPlaybinPlayer *self, GstEleme
 }
 
 
-static gchar *rygel_playbin_player_real_get_playback_state (RygelMediaPlayer *base) {
+static gchar*
+rygel_playbin_player_real_get_playback_state (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_val_if_fail (self, NULL);
@@ -530,150 +516,70 @@ static gchar *rygel_playbin_player_real_get_playback_state (RygelMediaPlayer *ba
 }
 
 
-static void rygel_playbin_player_real_set_playback_state (RygelMediaPlayer *base, const gchar *value) {
-  RygelPlaybinPlayer *self;
+static void
+rygel_playbin_player_real_set_playback_state (RygelMediaPlayer *base, const gchar *value) {
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_if_fail (self);
+
   GstState state = 0;
   GstState pending = 0;
-  GstElement *_tmp0_;
-  GstState _tmp1_ = 0;
-  GstState _tmp2_ = 0;
-  const gchar *_tmp3_;
-  const gchar *_tmp4_;
-  const gchar *_tmp5_;
-  GQuark _tmp7_ = 0U;
-  static GQuark _tmp6_label0 = 0;
-  static GQuark _tmp6_label1 = 0;
-  static GQuark _tmp6_label2 = 0;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = self->priv->_playbin;
-  gst_element_get_state (_tmp0_, &_tmp1_, &_tmp2_, (GstClockTime) GST_MSECOND);
-  state = _tmp1_;
-  pending = _tmp2_;
-  _tmp3_ = value;
-  g_debug ("rygel-playbin-player.vala:102: Changing playback state to %s.", _tmp3_);
-  _tmp4_ = value;
-  _tmp5_ = _tmp4_;
-  _tmp7_ = (NULL == _tmp5_) ? 0 : g_quark_from_string (_tmp5_);
-  if (_tmp7_ == ((0 != _tmp6_label0) ? _tmp6_label0 : (_tmp6_label0 = g_quark_from_static_string ("STOPPED")))) {
-    switch (0) {
-      default:
-      {
-        gboolean _tmp8_ = FALSE;
-        GstState _tmp9_;
-        gboolean _tmp11_;
-        _tmp9_ = state;
-        if (_tmp9_ != GST_STATE_NULL) {
-          _tmp8_ = TRUE;
-        } else {
-          GstState _tmp10_;
-          _tmp10_ = pending;
-          _tmp8_ = _tmp10_ != GST_STATE_VOID_PENDING;
-        }
-        _tmp11_ = _tmp8_;
-        if (_tmp11_) {
-          gchar *_tmp12_;
-          GstElement *_tmp13_;
-          _tmp12_ = g_strdup ("TRANSITIONING");
-          g_free (self->priv->_playback_state);
-          self->priv->_playback_state = _tmp12_;
-          _tmp13_ = self->priv->_playbin;
-          gst_element_set_state (_tmp13_, GST_STATE_NULL);
-        } else {
-          const gchar *_tmp14_;
-          gchar *_tmp15_;
-          _tmp14_ = value;
-          _tmp15_ = g_strdup (_tmp14_);
-          g_free (self->priv->_playback_state);
-          self->priv->_playback_state = _tmp15_;
-        }
-        break;
-      }
-    }
-  } else if (_tmp7_ == ((0 != _tmp6_label1) ? _tmp6_label1 : (_tmp6_label1 = g_quark_from_static_string ("PAUSED_PLAYBACK")))) {
-    switch (0) {
-      default:
-      {
-        gboolean _tmp16_ = FALSE;
-        GstState _tmp17_;
-        gboolean _tmp19_;
-        _tmp17_ = state;
-        if (_tmp17_ != GST_STATE_PAUSED) {
-          _tmp16_ = TRUE;
-        } else {
-          GstState _tmp18_;
-          _tmp18_ = pending;
-          _tmp16_ = _tmp18_ != GST_STATE_VOID_PENDING;
-        }
-        _tmp19_ = _tmp16_;
-        if (_tmp19_) {
-          gchar *_tmp20_;
-          GstElement *_tmp21_;
-          _tmp20_ = g_strdup ("TRANSITIONING");
-          g_free (self->priv->_playback_state);
-          self->priv->_playback_state = _tmp20_;
-          _tmp21_ = self->priv->_playbin;
-          gst_element_set_state (_tmp21_, GST_STATE_PAUSED);
-        } else {
-          const gchar *_tmp22_;
-          gchar *_tmp23_;
-          _tmp22_ = value;
-          _tmp23_ = g_strdup (_tmp22_);
-          g_free (self->priv->_playback_state);
-          self->priv->_playback_state = _tmp23_;
-        }
-        break;
-      }
+  gst_element_get_state (self->priv->_playbin, &state, &pending, (GstClockTime) GST_MSECOND);
+
+  g_debug ("rygel-playbin-player.c: Changing playback state to %s.", value);
+
+  if (g_strcmp0 (value, "STOPPED")) {
+    if (self->priv->_playback_state)
+      g_free (self->priv->_playback_state);
+
+    if (state != GST_STATE_NULL ||
+      pending != GST_STATE_VOID_PENDING) {
+      self->priv->_playback_state = g_strdup ("TRANSITIONING");
+      gst_element_set_state (self->priv->_playbin, GST_STATE_NULL);
+    } else {
+      self->priv->_playback_state = g_strdup (value);
     }
-  } else if (_tmp7_ == ((0 != _tmp6_label2) ? _tmp6_label2 : (_tmp6_label2 = g_quark_from_static_string ("PLAYING")))) {
-    switch (0) {
-      default:
-      {
-        gboolean _tmp24_ = FALSE;
-        GstState _tmp25_;
-        gboolean _tmp27_;
-        _tmp25_ = state;
-        if (_tmp25_ != GST_STATE_PLAYING) {
-          _tmp24_ = TRUE;
-        } else {
-          GstState _tmp26_;
-          _tmp26_ = pending;
-          _tmp24_ = _tmp26_ != GST_STATE_VOID_PENDING;
-        }
-        _tmp27_ = _tmp24_;
-        if (_tmp27_) {
-          gchar *_tmp28_;
-          GstElement *_tmp29_;
-          GstStateChangeReturn _tmp30_ = 0;
-          _tmp28_ = g_strdup ("TRANSITIONING");
-          g_free (self->priv->_playback_state);
-          self->priv->_playback_state = _tmp28_;
-          _tmp29_ = self->priv->_playbin;
-          _tmp30_ = gst_element_set_state (_tmp29_, GST_STATE_PLAYING);
-          self->priv->is_live = _tmp30_ == GST_STATE_CHANGE_NO_PREROLL;
-        } else {
-          const gchar *_tmp31_;
-          gchar *_tmp32_;
-          _tmp31_ = value;
-          _tmp32_ = g_strdup (_tmp31_);
-          g_free (self->priv->_playback_state);
-          self->priv->_playback_state = _tmp32_;
-        }
-        break;
-      }
+  } else if (g_strcmp0 (value, "PAUSED_PLAYBACK")) {
+    if (self->priv->_playback_state)
+      g_free (self->priv->_playback_state);
+
+    if (state != GST_STATE_PAUSED ||
+      pending != GST_STATE_VOID_PENDING) {
+      self->priv->_playback_state = g_strdup ("TRANSITIONING");
+      gst_element_set_state (self->priv->_playbin, GST_STATE_PAUSED);
+    } else {
+      self->priv->_playback_state = g_strdup (value);
     }
-  } else {
-    switch (0) {
-      default:
-      {
-        break;
-      }
+  } else if (g_strcmp0 (value, "PLAYING")) {
+    if (self->priv->_playback_state)
+      g_free (self->priv->_playback_state);
+
+    if (state != GST_STATE_PLAYING ||
+      pending != GST_STATE_VOID_PENDING) {
+      self->priv->_playback_state = g_strdup ("TRANSITIONING");
+
+      /* This needs a check if GStreamer and DLNA agree on
+       * the "liveness" of the source (s0/sn increase in
+       * protocol info.
+       */
+      self->priv->is_live = 
+        (gst_element_set_state (self->priv->_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_NO_PREROLL);
+    } else {
+      self->priv->_playback_state = g_strdup (value);
     }
+  } else if (g_strcmp0 (value, "EOS")) {
+    if (self->priv->_playback_state)
+      g_free (self->priv->_playback_state);
+
+    self->priv->_playback_state = g_strdup (value);
   }
+
   g_object_notify (G_OBJECT (self), "playback-state");
 }
 
 
-static gchar **rygel_playbin_player_real_get_allowed_playback_speeds (RygelMediaPlayer *base, int *result_length) {
+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;
@@ -694,7 +600,8 @@ static gchar **rygel_playbin_player_real_get_allowed_playback_speeds (RygelMedia
 }
 
 
-static gchar *rygel_playbin_player_real_get_playback_speed (RygelMediaPlayer *base) {
+static gchar*
+rygel_playbin_player_real_get_playback_speed (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_val_if_fail (self, NULL);
@@ -717,7 +624,8 @@ static void rygel_playbin_player_real_set_playback_speed (RygelMediaPlayer *base
 }
 
 
-static gchar *rygel_playbin_player_real_get_uri (RygelMediaPlayer *base) {
+static gchar*
+rygel_playbin_player_real_get_uri (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_val_if_fail (self, NULL);
@@ -726,107 +634,53 @@ static gchar *rygel_playbin_player_real_get_uri (RygelMediaPlayer *base) {
 }
 
 
-static inline void _dynamic_set_uri5 (GstElement *obj, const gchar *value) {
-  g_object_set (obj, "uri", value, NULL);
-}
+static void
+rygel_playbin_player_real_set_uri (RygelMediaPlayer *base, const gchar *value) {
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
+  g_return_if_fail (self);
 
-static void rygel_playbin_player_real_set_uri (RygelMediaPlayer *base, const gchar *value) {
-  RygelPlaybinPlayer *self;
-  const gchar *_tmp0_;
-  gchar *_tmp1_;
-  GstElement *_tmp2_;
-  GstElement *_tmp3_;
-  const gchar *_tmp4_;
-  const gchar *_tmp5_;
-  const gchar *_tmp16_;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = value;
-  _tmp1_ = g_strdup (_tmp0_);
-  g_free (self->priv->_uri);
-  self->priv->_uri = _tmp1_;
-  _tmp2_ = self->priv->_playbin;
-  gst_element_set_state (_tmp2_, GST_STATE_READY);
-  _tmp3_ = self->priv->_playbin;
-  _tmp4_ = value;
-  _dynamic_set_uri5 (_tmp3_, _tmp4_);
-  _tmp5_ = value;
-  if (g_strcmp0 (_tmp5_, "") != 0) {
-    const gchar *_tmp6_;
-    const gchar *_tmp7_;
-    GQuark _tmp9_ = 0U;
-    static GQuark _tmp8_label0 = 0;
-    static GQuark _tmp8_label1 = 0;
-    static GQuark _tmp8_label2 = 0;
-    static GQuark _tmp8_label3 = 0;
-    _tmp6_ = self->priv->_playback_state;
-    _tmp7_ = _tmp6_;
-    _tmp9_ = (NULL == _tmp7_) ? 0 : g_quark_from_string (_tmp7_);
-    if (_tmp9_ == ((0 != _tmp8_label0) ? _tmp8_label0 : (_tmp8_label0 = g_quark_from_static_string ("NO_MEDIA_PRESENT")))) {
-      switch (0) {
-        default:
-        {
-          gchar *_tmp10_;
-          _tmp10_ = g_strdup ("STOPPED");
-          g_free (self->priv->_playback_state);
-          self->priv->_playback_state = _tmp10_;
-          g_object_notify (G_OBJECT (self), "playback-state");
-          break;
-        }
-      }
-    } else if (_tmp9_ == ((0 != _tmp8_label1) ? _tmp8_label1 : (_tmp8_label1 = g_quark_from_static_string ("STOPPED")))) {
-      switch (0) {
-        default:
-        {
-          break;
-        }
-      }
-    } else if (_tmp9_ == ((0 != _tmp8_label2) ? _tmp8_label2 : (_tmp8_label2 = g_quark_from_static_string ("PAUSED_PLAYBACK")))) {
-      switch (0) {
-        default:
-        {
-          GstElement *_tmp11_;
-          GstStateChangeReturn _tmp12_ = 0;
-          _tmp11_ = self->priv->_playbin;
-          _tmp12_ = gst_element_set_state (_tmp11_, GST_STATE_PAUSED);
-          self->priv->is_live = _tmp12_ == GST_STATE_CHANGE_NO_PREROLL;
-          break;
-        }
-      }
-    } else if (_tmp9_ == ((0 != _tmp8_label3) ? _tmp8_label3 : (_tmp8_label3 = g_quark_from_static_string ("PLAYING")))) {
-      switch (0) {
-        default:
-        {
-          GstElement *_tmp13_;
-          GstStateChangeReturn _tmp14_ = 0;
-          _tmp13_ = self->priv->_playbin;
-          _tmp14_ = gst_element_set_state (_tmp13_, GST_STATE_PLAYING);
-          self->priv->is_live = _tmp14_ == GST_STATE_CHANGE_NO_PREROLL;
-          break;
-        }
-      }
-    } else {
-      switch (0) {
-        default:
-        {
-          break;
-        }
-      }
+  if (self->priv->_uri)
+    g_free (self->priv->_uri);
+  self->priv->_uri = g_strdup (value);
+
+  gst_element_set_state (self->priv->_playbin, GST_STATE_READY);
+  g_object_set (self->priv->_playbin, "uri", value, NULL);
+
+  if (g_strcmp0 (value, "") != 0) {
+    if (g_strcmp0 (self->priv->_playback_state, "NO_MEDIA_PRESENT") != 0) {
+      if (self->priv->_playback_state)
+        g_free (self->priv->_playback_state);
+
+      self->priv->_playback_state = g_strdup ("STOPPED");
+      g_object_notify (G_OBJECT (self), "playback-state");
+    } else if (g_strcmp0 (self->priv->_playback_state, "STOPPED") != 0) {
+    } else if (g_strcmp0 (self->priv->_playback_state, "PAUSED_PLAYBACK") != 0) {
+      self->priv->is_live = 
+        (gst_element_set_state (self->priv->_playbin, GST_STATE_PAUSED) == GST_STATE_CHANGE_NO_PREROLL);
+    } else if (g_strcmp0 (self->priv->_playback_state, "EOS") != 0 ||
+      g_strcmp0 (self->priv->_playback_state, "PLAYING") != 0) {
+      /* This needs a check if GStreamer and DLNA agree on
+       * the "liveness" of the source (s0/sn increase in
+       * protocol info.
+       */
+      self->priv->is_live = 
+        (gst_element_set_state (self->priv->_playbin, GST_STATE_PLAYING) == GST_STATE_CHANGE_NO_PREROLL);
     }
   } else {
-    gchar *_tmp15_;
-    _tmp15_ = g_strdup ("NO_MEDIA_PRESENT");
-    g_free (self->priv->_playback_state);
-    self->priv->_playback_state = _tmp15_;
+   if (self->priv->_playback_state)
+     g_free (self->priv->_playback_state);
+
+    self->priv->_playback_state = g_strdup ("NO_MEDIA_PRESENT");
     g_object_notify (G_OBJECT (self), "playback-state");
   }
-  _tmp16_ = value;
-  g_debug ("rygel-playbin-player.vala:179: URI set to %s.", _tmp16_);
-  g_object_notify (G_OBJECT (self), "uri");
+
+  g_debug ("rygel-playbin-player.c: URI set to %s.", value);
 }
 
 
-static gchar *rygel_playbin_player_real_get_mime_type (RygelMediaPlayer *base) {
+static gchar*
+rygel_playbin_player_real_get_mime_type (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_val_if_fail (self, NULL);
@@ -835,7 +689,8 @@ static gchar *rygel_playbin_player_real_get_mime_type (RygelMediaPlayer *base) {
 }
 
 
-static void rygel_playbin_player_real_set_mime_type (RygelMediaPlayer *base, const gchar *value) {
+static void
+rygel_playbin_player_real_set_mime_type (RygelMediaPlayer *base, const gchar *value) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_if_fail (self);
@@ -849,7 +704,8 @@ static void rygel_playbin_player_real_set_mime_type (RygelMediaPlayer *base, con
 }
 
 
-static gchar *rygel_playbin_player_real_get_metadata (RygelMediaPlayer *base) {
+static gchar*
+rygel_playbin_player_real_get_metadata (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_val_if_fail (self, NULL);
@@ -858,7 +714,8 @@ static gchar *rygel_playbin_player_real_get_metadata (RygelMediaPlayer *base) {
 }
 
 
-static void rygel_playbin_player_real_set_metadata (RygelMediaPlayer *base, const gchar *value) {
+static void
+rygel_playbin_player_real_set_metadata (RygelMediaPlayer *base, const gchar *value) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_if_fail (self);
@@ -872,7 +729,8 @@ static void rygel_playbin_player_real_set_metadata (RygelMediaPlayer *base, cons
 }
 
 
-static gboolean rygel_playbin_player_real_get_can_seek (RygelMediaPlayer *base) {
+static gboolean
+rygel_playbin_player_real_get_can_seek (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_val_if_fail (self, FALSE);
@@ -882,7 +740,8 @@ static gboolean rygel_playbin_player_real_get_can_seek (RygelMediaPlayer *base)
 }
 
 
-static gchar *rygel_playbin_player_real_get_content_features (RygelMediaPlayer *base) {
+static gchar*
+rygel_playbin_player_real_get_content_features (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_val_if_fail (self, NULL);
@@ -891,7 +750,8 @@ static gchar *rygel_playbin_player_real_get_content_features (RygelMediaPlayer *
 }
 
 
-static void rygel_playbin_player_real_set_content_features (RygelMediaPlayer *base, const gchar *value) {
+static void
+rygel_playbin_player_real_set_content_features (RygelMediaPlayer *base, const gchar *value) {
   RygelPlaybinPlayer *self;
   gchar *_tmp0_;
   gchar *_tmp1_;
@@ -978,7 +838,8 @@ static void rygel_playbin_player_real_set_content_features (RygelMediaPlayer *ba
   g_object_notify (G_OBJECT (self), "content-features");
 }
 
-static gdouble rygel_playbin_player_real_get_volume (RygelMediaPlayer *base) {
+static gdouble
+rygel_playbin_player_real_get_volume (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_val_if_fail (self, 0);
@@ -990,7 +851,8 @@ static gdouble rygel_playbin_player_real_get_volume (RygelMediaPlayer *base) {
 }
 
 
-static void rygel_playbin_player_real_set_volume (RygelMediaPlayer *base, gdouble value) {
+static void
+rygel_playbin_player_real_set_volume (RygelMediaPlayer *base, gdouble value) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
 
   g_return_if_fail (self);
@@ -1002,7 +864,8 @@ static void rygel_playbin_player_real_set_volume (RygelMediaPlayer *base, gdoubl
 }
 
 
-static gint64 rygel_playbin_player_real_get_duration (RygelMediaPlayer *base) {
+static gint64
+rygel_playbin_player_real_get_duration (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
   GstFormat format = GST_FORMAT_TIME;
   gint64 pos = 0LL;
@@ -1018,7 +881,8 @@ static gint64 rygel_playbin_player_real_get_duration (RygelMediaPlayer *base) {
 }
 
 
-static gint64 rygel_playbin_player_real_get_position (RygelMediaPlayer *base) {
+static gint64
+rygel_playbin_player_real_get_position (RygelMediaPlayer *base) {
   RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
   GstFormat format = GST_FORMAT_TIME;
   gint64 pos = 0LL;
@@ -1037,9 +901,11 @@ static gint64 rygel_playbin_player_real_get_position (RygelMediaPlayer *base) {
 static void rygel_playbin_player_class_init (RygelPlaybinPlayerClass *klass) {
   rygel_playbin_player_parent_class = g_type_class_peek_parent (klass);
   g_type_class_add_private (klass, sizeof (RygelPlaybinPlayerPrivate));
+
   G_OBJECT_CLASS (klass)->get_property = _vala_rygel_playbin_player_get_property;
   G_OBJECT_CLASS (klass)->set_property = _vala_rygel_playbin_player_set_property;
   G_OBJECT_CLASS (klass)->finalize = rygel_playbin_player_finalize;
+
   g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_PLAYBIN_PLAYER_PLAYBIN, g_param_spec_object ("playbin", "playbin", "playbin", GST_TYPE_ELEMENT, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
   g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_PLAYBIN_PLAYER_PLAYBACK_STATE, g_param_spec_string ("playback-state", "playback-state", "playback-state", NULL, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE | G_PARAM_WRITABLE));
   g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_PLAYBIN_PLAYER_ALLOWED_PLAYBACK_SPEEDS, g_param_spec_boxed ("allowed-playback-speeds", "allowed-playback-speeds", "allowed-playback-speeds", G_TYPE_STRV, G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
@@ -1140,86 +1006,90 @@ static void rygel_playbin_player_finalize (GObject *obj) {
 
 
 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);
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (object);
+
+  g_return_if_fail (self);
+
   switch (property_id) {
     case RYGEL_PLAYBIN_PLAYER_PLAYBIN:
-    g_value_set_object (value, rygel_playbin_player_get_playbin (self));
-    break;
+      g_value_set_object (value, rygel_playbin_player_get_playbin (self));
+      break;
     case RYGEL_PLAYBIN_PLAYER_PLAYBACK_STATE:
-    g_value_take_string (value, rygel_media_player_get_playback_state (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_take_string (value, rygel_media_player_get_playback_state (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_ALLOWED_PLAYBACK_SPEEDS:
     {
-      int length;
+      int length = 0;
       g_value_take_boxed (value, rygel_media_player_get_allowed_playback_speeds (RYGEL_MEDIA_PLAYER (self), &length));
+      break;
     }
-    break;
     case RYGEL_PLAYBIN_PLAYER_PLAYBACK_SPEED:
-    g_value_take_string (value, rygel_media_player_get_playback_speed (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_take_string (value, rygel_media_player_get_playback_speed (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_URI:
-    g_value_take_string (value, rygel_media_player_get_uri (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_take_string (value, rygel_media_player_get_uri (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_MIME_TYPE:
-    g_value_take_string (value, rygel_media_player_get_mime_type (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_take_string (value, rygel_media_player_get_mime_type (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_METADATA:
-    g_value_take_string (value, rygel_media_player_get_metadata (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_take_string (value, rygel_media_player_get_metadata (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_CAN_SEEK:
-    g_value_set_boolean (value, rygel_media_player_get_can_seek (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_set_boolean (value, rygel_media_player_get_can_seek (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_CONTENT_FEATURES:
-    g_value_take_string (value, rygel_media_player_get_content_features (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_take_string (value, rygel_media_player_get_content_features (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_VOLUME:
-    g_value_set_double (value, rygel_media_player_get_volume (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_set_double (value, rygel_media_player_get_volume (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_DURATION:
-    g_value_set_int64 (value, rygel_media_player_get_duration (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_set_int64 (value, rygel_media_player_get_duration (RYGEL_MEDIA_PLAYER (self)));
+      break;
     case RYGEL_PLAYBIN_PLAYER_POSITION:
-    g_value_set_int64 (value, rygel_media_player_get_position (RYGEL_MEDIA_PLAYER (self)));
-    break;
+      g_value_set_int64 (value, rygel_media_player_get_position (RYGEL_MEDIA_PLAYER (self)));
+      break;
     default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
     break;
   }
 }
 
 
 static void _vala_rygel_playbin_player_set_property (GObject *object, guint property_id, const GValue *value, GParamSpec *pspec) {
-  RygelPlaybinPlayer *self;
-  self = G_TYPE_CHECK_INSTANCE_CAST (object, RYGEL_TYPE_PLAYBIN_PLAYER, RygelPlaybinPlayer);
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (object);
+
+  g_return_if_fail (self);
+
   switch (property_id) {
     case RYGEL_PLAYBIN_PLAYER_PLAYBIN:
-    rygel_playbin_player_set_playbin (self, g_value_get_object (value));
-    break;
+      rygel_playbin_player_set_playbin (self, g_value_get_object (value));
+      break;
     case RYGEL_PLAYBIN_PLAYER_PLAYBACK_STATE:
-    rygel_media_player_set_playback_state (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
-    break;
+      rygel_media_player_set_playback_state (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
+      break;
     case RYGEL_PLAYBIN_PLAYER_PLAYBACK_SPEED:
-    rygel_media_player_set_playback_speed (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
-    break;
+      rygel_media_player_set_playback_speed (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
+      break;
     case RYGEL_PLAYBIN_PLAYER_URI:
-    rygel_media_player_set_uri (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
-    break;
+      rygel_media_player_set_uri (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
+      break;
     case RYGEL_PLAYBIN_PLAYER_MIME_TYPE:
-    rygel_media_player_set_mime_type (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
-    break;
+      rygel_media_player_set_mime_type (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
+      break;
     case RYGEL_PLAYBIN_PLAYER_METADATA:
-    rygel_media_player_set_metadata (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
-    break;
+      rygel_media_player_set_metadata (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
+      break;
     case RYGEL_PLAYBIN_PLAYER_CONTENT_FEATURES:
-    rygel_media_player_set_content_features (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
-    break;
+      rygel_media_player_set_content_features (RYGEL_MEDIA_PLAYER (self), g_value_get_string (value));
+      break;
     case RYGEL_PLAYBIN_PLAYER_VOLUME:
-    rygel_media_player_set_volume (RYGEL_MEDIA_PLAYER (self), g_value_get_double (value));
-    break;
+      rygel_media_player_set_volume (RYGEL_MEDIA_PLAYER (self), g_value_get_double (value));
+      break;
     default:
-    G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
-    break;
+      G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
+      break;
   }
 }
 



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