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



commit aeba7e6f072c9f971639d8b229aef8023380784f
Author: Murray Cumming <murrayc murrayc com>
Date:   Mon Jan 28 12:21:30 2013 +0100

    cleanup

 src/rygel-playbin-player.c |  186 +++++++++++++++++++++++---------------------
 1 files changed, 97 insertions(+), 89 deletions(-)
---
diff --git a/src/rygel-playbin-player.c b/src/rygel-playbin-player.c
index 66b06af..2898401 100644
--- a/src/rygel-playbin-player.c
+++ b/src/rygel-playbin-player.c
@@ -752,88 +752,48 @@ rygel_playbin_player_real_get_content_features (RygelMediaPlayer *base) {
 
 static void
 rygel_playbin_player_real_set_content_features (RygelMediaPlayer *base, const gchar *value) {
-  RygelPlaybinPlayer *self;
-  gchar *_tmp0_;
-  gchar *_tmp1_;
-  gchar *_tmp2_;
-  const gchar *_tmp3_;
-  gchar *_tmp4_ = NULL;
-  gchar *_tmp5_;
-  gchar *pi_string;
-  const gchar *_tmp15_;
-  gchar *_tmp16_;
-  GError *_inner_error_ = NULL;
-  self = (RygelPlaybinPlayer*) base;
-  _tmp0_ = rygel_media_player_get_mime_type (RYGEL_MEDIA_PLAYER (self));
-  _tmp1_ = _tmp0_;
-  _tmp2_ = _tmp1_;
-  _tmp3_ = value;
-  _tmp4_ = g_strdup_printf (RYGEL_PLAYBIN_PLAYER_PROTOCOL_INFO_TEMPLATE, _tmp2_, _tmp3_);
-  _tmp5_ = _tmp4_;
-  g_free (_tmp2_);
-  pi_string = _tmp5_;
-  {
-    GUPnPProtocolInfo *_tmp6_;
-    GUPnPProtocolInfo *_tmp7_;
-    GUPnPProtocolInfo *_tmp8_;
-    GUPnPDLNAFlags _tmp9_;
-    GUPnPDLNAFlags _tmp10_;
-    GUPnPDLNAFlags flags;
-    GUPnPDLNAFlags _tmp11_;
-    _tmp6_ = gupnp_protocol_info_new_from_string (pi_string, &_inner_error_);
-    _tmp7_ = _tmp6_;
-    if (_inner_error_) {
-      goto __catch0_g_error;
-    }
-    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_);
-    _tmp10_ = _tmp9_;
-    flags = _tmp10_;
-    _tmp11_ = flags;
-    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_free (self->priv->transfer_mode);
-      self->priv->transfer_mode = _tmp12_;
-    } else {
-      GUPnPDLNAFlags _tmp13_;
-      _tmp13_ = flags;
-      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_free (self->priv->transfer_mode);
-        self->priv->transfer_mode = _tmp14_;
-      } else {
-        g_free (self->priv->transfer_mode);
-        self->priv->transfer_mode = NULL;
-      }
-    }
-  }
-  goto __finally0;
-  __catch0_g_error:
-  {
-    GError *_error_ = NULL;
-    _error_ = _inner_error_;
-    _inner_error_ = NULL;
+  GError *inner_error = NULL;
+  RygelPlaybinPlayer *self = RYGEL_PLAYBIN_PLAYER (base);
+
+  g_return_if_fail (self);
+
+  gchar *mime_type = rygel_media_player_get_mime_type (RYGEL_MEDIA_PLAYER (self));
+  gchar *pi_string = g_strdup_printf (RYGEL_PLAYBIN_PLAYER_PROTOCOL_INFO_TEMPLATE,
+    mime_type, value);
+  g_free (mime_type);
+
+  if (self->priv->protocol_info)
     g_object_unref (self->priv->protocol_info);
+
+  self->priv->protocol_info = gupnp_protocol_info_new_from_string (pi_string, &inner_error);
+  if (inner_error) {
+    if (self->priv->protocol_info)
+     g_object_unref (self->priv->protocol_info);
     self->priv->protocol_info = NULL;
-    g_free (self->priv->transfer_mode);
+
+    if (self->priv->transfer_mode)
+      g_free (self->priv->transfer_mode);
     self->priv->transfer_mode = NULL;
-    g_error_free (_error_);
+
+    g_error_free (inner_error);
   }
-  __finally0:
-  if (_inner_error_) {
-    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;
+
+  if (self->priv->transfer_mode)
+    g_free (self->priv->transfer_mode);
+
+  GUPnPDLNAFlags flags = gupnp_protocol_info_get_dlna_flags (self->priv->protocol_info);
+  if ((flags & GUPNP_DLNA_FLAGS_INTERACTIVE_TRANSFER_MODE) == GUPNP_DLNA_FLAGS_INTERACTIVE_TRANSFER_MODE) {
+    self->priv->transfer_mode = g_strdup (RYGEL_PLAYBIN_PLAYER_TRANSFER_MODE_INTERACTIVE);
+  } else if ((flags & GUPNP_DLNA_FLAGS_STREAMING_TRANSFER_MODE) == GUPNP_DLNA_FLAGS_STREAMING_TRANSFER_MODE) {
+    self->priv->transfer_mode = g_strdup (RYGEL_PLAYBIN_PLAYER_TRANSFER_MODE_STREAMING);
+  } else {
+     self->priv->transfer_mode = NULL;
   }
-  _tmp15_ = value;
-  _tmp16_ = g_strdup (_tmp15_);
-  g_free (self->priv->_content_features);
-  self->priv->_content_features = _tmp16_;
+
+  if (self->priv->_content_features)
+    g_free (self->priv->_content_features);
+  self->priv->_content_features = g_strdup (value);
+
   g_free (pi_string);
   g_object_notify (G_OBJECT (self), "content-features");
 }
@@ -906,23 +866,71 @@ static void rygel_playbin_player_class_init (RygelPlaybinPlayerClass *klass) {
   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));
-  g_object_class_install_property (G_OBJECT_CLASS (klass), RYGEL_PLAYBIN_PLAYER_PLAYBACK_SPEED, g_param_spec_string ("playback-speed", "playback-speed", "playback-speed", 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_URI, g_param_spec_string ("uri", "uri", "uri", 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_MIME_TYPE, g_param_spec_string ("mime-type", "mime-type", "mime-type", 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_METADATA, g_param_spec_string ("metadata", "metadata", "metadata", 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_CAN_SEEK, g_param_spec_boolean ("can-seek", "can-seek", "can-seek", FALSE, 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_CONTENT_FEATURES, g_param_spec_string ("content-features", "content-features", "content-features", 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_VOLUME, g_param_spec_double ("volume", "volume", "volume", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0, 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_DURATION, g_param_spec_int64 ("duration", "duration", "duration", G_MININT64, G_MAXINT64, 0, 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_POSITION, g_param_spec_int64 ("position", "position", "position", G_MININT64, G_MAXINT64, 0, 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_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));
+
+  g_object_class_install_property (G_OBJECT_CLASS (klass),
+    RYGEL_PLAYBIN_PLAYER_PLAYBACK_SPEED,
+    g_param_spec_string ("playback-speed", "playback-speed", "playback-speed", 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_URI,
+     g_param_spec_string ("uri", "uri", "uri", 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_MIME_TYPE,
+     g_param_spec_string ("mime-type", "mime-type", "mime-type", 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_METADATA,
+    g_param_spec_string ("metadata", "metadata", "metadata", 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_CAN_SEEK,
+    g_param_spec_boolean ("can-seek", "can-seek", "can-seek", FALSE,
+      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_CONTENT_FEATURES,
+    g_param_spec_string ("content-features", "content-features", "content-features", 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_VOLUME,
+    g_param_spec_double ("volume", "volume", "volume", -G_MAXDOUBLE, G_MAXDOUBLE, 0.0,
+      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_DURATION,
+    g_param_spec_int64 ("duration", "duration", "duration", G_MININT64, G_MAXINT64, 0,
+      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_POSITION,
+    g_param_spec_int64 ("position", "position", "position", G_MININT64, G_MAXINT64, 0,
+      G_PARAM_STATIC_NAME | G_PARAM_STATIC_NICK | G_PARAM_STATIC_BLURB | G_PARAM_READABLE));
 }
 
 
 static void rygel_playbin_player_rygel_media_player_interface_init (RygelMediaPlayerIface *iface) {
   rygel_playbin_player_rygel_media_player_parent_iface = g_type_interface_peek_parent (iface);
+
   iface->seek = (gboolean (*)(RygelMediaPlayer*, gint64)) rygel_playbin_player_real_seek;
   iface->get_protocols = (gchar **(*)(RygelMediaPlayer*, int*)) rygel_playbin_player_real_get_protocols;
   iface->get_mime_types = (gchar **(*)(RygelMediaPlayer*, int*)) rygel_playbin_player_real_get_mime_types;



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