[totem] backend: Use a gdouble for percentage in "buffering"



commit 2faabdc0cf06db9e6990ad2d8495d822147f99a5
Author: Bastien Nocera <hadess hadess net>
Date:   Wed Jul 4 21:06:59 2012 +0100

    backend: Use a gdouble for percentage in "buffering"
    
    Just like we do in "download-buffering"

 src/backend/bacon-video-widget-gst-0.10.c |   10 ++++++----
 src/backend/bacon-video-widget.h          |    2 +-
 2 files changed, 7 insertions(+), 5 deletions(-)
---
diff --git a/src/backend/bacon-video-widget-gst-0.10.c b/src/backend/bacon-video-widget-gst-0.10.c
index 0ae0b2b..2e5414a 100644
--- a/src/backend/bacon-video-widget-gst-0.10.c
+++ b/src/backend/bacon-video-widget-gst-0.10.c
@@ -1110,7 +1110,7 @@ bacon_video_widget_class_init (BaconVideoWidgetClass * klass)
                   G_SIGNAL_RUN_LAST,
                   G_STRUCT_OFFSET (BaconVideoWidgetClass, buffering),
                   NULL, NULL,
-                  g_cclosure_marshal_VOID__INT, G_TYPE_NONE, 1, G_TYPE_INT);
+                  g_cclosure_marshal_VOID__DOUBLE, G_TYPE_NONE, 1, G_TYPE_DOUBLE);
 
   /**
    * BaconVideoWidget::missing-plugins:
@@ -1320,8 +1320,10 @@ bvw_handle_element_message (BaconVideoWidget *bvw, GstMessage *msg)
     if (!bvw->priv->buffering) {
       gint percent = 0;
 
-      if (gst_structure_get_int (msg->structure, "percent", &percent))
-        g_signal_emit (bvw, bvw_signals[SIGNAL_BUFFERING], 0, percent);
+      if (gst_structure_get_int (msg->structure, "percent", &percent)) {
+	gdouble fraction = (gdouble) percent / 100.0;
+        g_signal_emit (bvw, bvw_signals[SIGNAL_BUFFERING], 0, fraction);
+      }
     }
     goto done;
   } else if (gst_is_missing_plugin_message (msg)) {
@@ -1880,7 +1882,7 @@ bvw_handle_buffering_message (GstMessage * message, BaconVideoWidget *bvw)
 
    /* Live, timeshift and stream buffering modes */
   gst_message_parse_buffering (message, &percent);
-  g_signal_emit (bvw, bvw_signals[SIGNAL_BUFFERING], 0, percent);
+  g_signal_emit (bvw, bvw_signals[SIGNAL_BUFFERING], 0, (gdouble) percent / 100.0);
 
   if (percent >= 100) {
     /* a 100% message means buffering is done */
diff --git a/src/backend/bacon-video-widget.h b/src/backend/bacon-video-widget.h
index 61bf2e4..21e424c 100644
--- a/src/backend/bacon-video-widget.h
+++ b/src/backend/bacon-video-widget.h
@@ -72,7 +72,7 @@ typedef struct {
 	void (*channels_change) (GtkWidget *bvw);
 	void (*tick) (GtkWidget *bvw, gint64 current_time, gint64 stream_length,
 			double current_position, gboolean seekable);
-	void (*buffering) (GtkWidget *bvw, guint progress);
+	void (*buffering) (GtkWidget *bvw, gdouble percentage);
 	void (*download_buffering) (GtkWidget *bvw, gdouble percentage);
 } BaconVideoWidgetClass;
 



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