[ekiga/ds-clutter] Video: Simplified code again.



commit 8b99fe7f0df1025cb6cef8f400f77c0c18cc0b6d
Author: Damien Sandras <dsandras beip be>
Date:   Mon Dec 30 15:50:02 2013 +0100

    Video: Simplified code again.
    
    The videooutput-info.h file was removed as we do not need it anymore.
    Output statistics have been removed.
    Error codes have been removed from the output manager too. There was
    only one type of error possible.
    All references to DisplayInfo have been removed (or commented out for
    further processing).

 .../videooutput-manager-clutter-gst.cpp            |    8 +-
 .../videooutput-manager-clutter-gst.h              |    3 +-
 lib/engine/gui/gtk-frontend/call-window.cpp        |   63 +++----
 lib/engine/gui/gtk-frontend/ext-window.cpp         |    6 +-
 lib/engine/videooutput/videooutput-core.cpp        |   60 ++-----
 lib/engine/videooutput/videooutput-core.h          |   20 +--
 lib/engine/videooutput/videooutput-info.h          |  180 --------------------
 lib/engine/videooutput/videooutput-manager.h       |    5 +-
 8 files changed, 51 insertions(+), 294 deletions(-)
---
diff --git a/lib/engine/components/clutter-gst-videooutput/videooutput-manager-clutter-gst.cpp 
b/lib/engine/components/clutter-gst-videooutput/videooutput-manager-clutter-gst.cpp
index ca0ab69..cc463ee 100644
--- a/lib/engine/components/clutter-gst-videooutput/videooutput-manager-clutter-gst.cpp
+++ b/lib/engine/components/clutter-gst-videooutput/videooutput-manager-clutter-gst.cpp
@@ -44,7 +44,6 @@
 #include <clutter-gtk/clutter-gtk.h>
 
 #include "videooutput-manager-clutter-gst.h"
-#include "videooutput-info.h"
 #include "videoinput-info.h"
 
 #include "runtime.h"
@@ -112,8 +111,7 @@ GMVideoOutputManager_clutter_gst::open ()
     if (!videosink || !appsrc || !conv || !pipeline[i]) {
 
       Ekiga::Runtime::run_in_main (boost::bind (&GMVideoOutputManager_clutter_gst::device_error_in_main,
-                                                this,
-                                                Ekiga::VO_ERROR));
+                                                this));
       break;
     }
 
@@ -265,7 +263,7 @@ GMVideoOutputManager_clutter_gst::device_closed_in_main ()
 }
 
 void
-GMVideoOutputManager_clutter_gst::device_error_in_main (Ekiga::VideoOutputErrorCodes code)
+GMVideoOutputManager_clutter_gst::device_error_in_main ()
 {
-  device_error (code);
+  device_error ();
 }
diff --git a/lib/engine/components/clutter-gst-videooutput/videooutput-manager-clutter-gst.h 
b/lib/engine/components/clutter-gst-videooutput/videooutput-manager-clutter-gst.h
index 7aae0f4..e62bb59 100644
--- a/lib/engine/components/clutter-gst-videooutput/videooutput-manager-clutter-gst.h
+++ b/lib/engine/components/clutter-gst-videooutput/videooutput-manager-clutter-gst.h
@@ -40,7 +40,6 @@
 
 #include "services.h"
 #include "videooutput-manager.h"
-#include "videooutput-info.h"
 
 #include <glib.h>
 
@@ -83,7 +82,7 @@ private:
 
   void device_closed_in_main ();
 
-  void device_error_in_main (Ekiga::VideoOutputErrorCodes code);
+  void device_error_in_main ();
 
   // Variables
   PMutex device_mutex;
diff --git a/lib/engine/gui/gtk-frontend/call-window.cpp b/lib/engine/gui/gtk-frontend/call-window.cpp
index f8d64f2..bbef01c 100644
--- a/lib/engine/gui/gtk-frontend/call-window.cpp
+++ b/lib/engine/gui/gtk-frontend/call-window.cpp
@@ -270,7 +270,6 @@ static void on_videooutput_device_closed_cb (Ekiga::VideoOutputManager & /* mana
                                              gpointer self);
 
 static void on_videooutput_device_error_cb (Ekiga::VideoOutputManager & /* manager */,
-                                            Ekiga::VideoOutputErrorCodes error_code,
                                             gpointer self);
 
 static void ekiga_call_window_set_video_size (EkigaCallWindow *cw,
@@ -438,9 +437,7 @@ static void ekiga_call_window_set_bandwidth (EkigaCallWindow *cw,
                                              float ta,
                                              float ra,
                                              float tv,
-                                             float rv,
-                                             int tfps,
-                                             int rfps);
+                                             float rv);
 
 static void ekiga_call_window_set_call_hold (EkigaCallWindow *cw,
                                              bool is_on_hold);
@@ -511,6 +508,7 @@ static void
 zoom_in_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
                    gpointer data)
 {
+  /*
   g_return_if_fail (data != NULL);
 
   Ekiga::DisplayInfo display_info;
@@ -525,12 +523,14 @@ zoom_in_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 
   cw->priv->video_display_settings->set_int ("zoom", display_info.zoom);
   ekiga_call_window_zooms_menu_update_sensitivity (cw, display_info.zoom);
+*/
 }
 
 static void
 zoom_out_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
                     gpointer data)
 {
+  /*
   g_return_if_fail (data != NULL);
 
   Ekiga::DisplayInfo display_info;
@@ -545,12 +545,14 @@ zoom_out_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 
   cw->priv->video_display_settings->set_int ("zoom", display_info.zoom);
   ekiga_call_window_zooms_menu_update_sensitivity (cw, display_info.zoom);
+*/
 }
 
 static void
 zoom_normal_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
                        gpointer data)
 {
+  /*
   g_return_if_fail (data != NULL);
 
   Ekiga::DisplayInfo display_info;
@@ -562,6 +564,7 @@ zoom_normal_changed_cb (G_GNUC_UNUSED GtkWidget *widget,
 
   cw->priv->video_display_settings->set_int ("zoom", display_info.zoom);
   ekiga_call_window_zooms_menu_update_sensitivity (cw, display_info.zoom);
+*/
 }
 
 static void
@@ -796,24 +799,13 @@ on_videooutput_device_closed_cb (Ekiga::VideoOutputManager & /* manager */, gpoi
 
 static void
 on_videooutput_device_error_cb (Ekiga::VideoOutputManager & /* manager */,
-                                Ekiga::VideoOutputErrorCodes error_code,
                                 gpointer self)
 {
   GtkWidget *dialog = NULL;
 
   const gchar *dialog_title =  _("Error while initializing video output");
   const gchar *tmp_msg = _("No video will be displayed on your machine during this call");
-  gchar *dialog_msg = NULL;
-
-  switch (error_code) {
-
-    case Ekiga::VO_ERROR_NONE:
-      break;
-    case Ekiga::VO_ERROR:
-    default:
-      dialog_msg = g_strconcat (_("There was an error opening or initializing the video output. Please 
verify that no other application is using the accelerated video output."), "\n\n", tmp_msg, NULL);
-      break;
-  }
+  gchar *dialog_msg = g_strconcat (_("There was an error opening or initializing the video output. Please 
verify that no other application is using the accelerated video output."), "\n\n", tmp_msg, NULL);
 
   dialog = gtk_message_dialog_new (GTK_WINDOW (self), GTK_DIALOG_MODAL,
                                    GTK_MESSAGE_ERROR, GTK_BUTTONS_OK,
@@ -1236,7 +1228,7 @@ on_cleared_call_cb (G_GNUC_UNUSED boost::shared_ptr<Ekiga::CallManager> manager,
     gdk_window_set_keep_above (gtk_widget_get_window (GTK_WIDGET (cw)), false);
   ekiga_call_window_update_calling_state (cw, Standby);
   ekiga_call_window_set_status (cw, _("Standby"));
-  ekiga_call_window_set_bandwidth (cw, 0.0, 0.0, 0.0, 0.0, 0, 0);
+  ekiga_call_window_set_bandwidth (cw, 0.0, 0.0, 0.0, 0.0);
   ekiga_call_window_clear_stats (cw);
 
   if (cw->priv->ext_video_win) {
@@ -1372,18 +1364,14 @@ on_stats_refresh_cb (gpointer self)
 
   if (cw->priv->calling_state == Connected && cw->priv->current_call) {
 
-    Ekiga::VideoOutputStats videooutput_stats;
-    cw->priv->videooutput_core->get_videooutput_stats(videooutput_stats);
-
-    ekiga_call_window_set_status (cw, _("Connected with %s\n%s"), 
cw->priv->current_call->get_remote_party_name ().c_str (),
+    ekiga_call_window_set_status (cw, _("Connected with %s\n%s"),
+                                  cw->priv->current_call->get_remote_party_name ().c_str (),
                                   cw->priv->current_call->get_duration ().c_str ());
     ekiga_call_window_set_bandwidth (cw,
                                      cw->priv->current_call->get_transmitted_audio_bandwidth (),
                                      cw->priv->current_call->get_received_audio_bandwidth (),
                                      cw->priv->current_call->get_transmitted_video_bandwidth (),
-                                     cw->priv->current_call->get_received_video_bandwidth (),
-                                     videooutput_stats.tx_fps,
-                                     videooutput_stats.rx_fps);
+                                     cw->priv->current_call->get_received_video_bandwidth ());
 
     unsigned int jitter = cw->priv->current_call->get_jitter_size ();
     double lost = cw->priv->current_call->get_lost_packets ();
@@ -1391,10 +1379,10 @@ on_stats_refresh_cb (gpointer self)
     double out_of_order = cw->priv->current_call->get_out_of_order_packets ();
 
     ekiga_call_window_update_stats (cw, lost, late, out_of_order, jitter,
-                                    videooutput_stats.rx_width,
-                                    videooutput_stats.rx_height,
-                                    videooutput_stats.tx_width,
-                                    videooutput_stats.tx_height,
+                                    cw->priv->local_video_natural_width,
+                                    cw->priv->local_video_natural_height,
+                                    cw->priv->remote_video_natural_width,
+                                    cw->priv->remote_video_natural_height,
                                     cw->priv->transmitted_audio_codec.c_str (),
                                     cw->priv->transmitted_video_codec.c_str ());
   }
@@ -1758,18 +1746,16 @@ ekiga_call_window_set_bandwidth (EkigaCallWindow *cw,
                                  float ta,
                                  float ra,
                                  float tv,
-                                 float rv,
-                                 int tfps,
-                                 int rfps)
+                                 float rv)
 {
   gchar *msg = NULL;
 
   g_return_if_fail (EKIGA_IS_CALL_WINDOW (cw));
 
-  if (ta > 0.0 || ra > 0.0 || tv > 0.0 || rv > 0.0 || tfps > 0 || rfps > 0)
-    /* Translators: A = Audio, V = Video, FPS = Frames per second */
-    msg = g_strdup_printf (_("A:%.1f/%.1f V:%.1f/%.1f FPS:%d/%d"),
-                           ta, ra, tv, rv, tfps, rfps);
+  if (ta > 0.0 || ra > 0.0 || tv > 0.0 || rv > 0.0)
+    /* Translators: A = Audio, V = Video */
+    msg = g_strdup_printf (_("A:%.1f/%.1f V:%.1f/%.1f"),
+                           ta, ra, tv, rv);
 
   if (msg)
     gm_statusbar_push_message (GM_STATUSBAR (cw->priv->statusbar), "%s", msg);
@@ -2402,7 +2388,7 @@ ekiga_call_window_connect_engine_signals (EkigaCallWindow *cw)
   conn = cw->priv->videooutput_core->device_closed.connect (boost::bind (&on_videooutput_device_closed_cb, 
_1, (gpointer) cw));
   cw->priv->connections.add (conn);
 
-  conn = cw->priv->videooutput_core->device_error.connect (boost::bind (&on_videooutput_device_error_cb, _1, 
_2, (gpointer) cw));
+  conn = cw->priv->videooutput_core->device_error.connect (boost::bind (&on_videooutput_device_error_cb, _1, 
(gpointer) cw));
   cw->priv->connections.add (conn);
 
   conn = cw->priv->videooutput_core->size_changed.connect (boost::bind (&on_size_changed_cb, _1, _2, _3, _4, 
(gpointer) cw));
@@ -2684,7 +2670,7 @@ ekiga_call_window_init_gui (EkigaCallWindow *cw)
 
   /* Init */
   ekiga_call_window_set_status (cw, _("Standby"));
-  ekiga_call_window_set_bandwidth (cw, 0.0, 0.0, 0.0, 0.0, 0, 0);
+  ekiga_call_window_set_bandwidth (cw, 0.0, 0.0, 0.0, 0.0);
 
   gtk_widget_hide (cw->priv->call_frame);
 }
@@ -2754,6 +2740,7 @@ ekiga_call_window_draw (GtkWidget *widget,
                         cairo_t *context)
 {
   return true; //FIXME
+  /*
   EkigaCallWindow *cw = EKIGA_CALL_WINDOW (widget);
   GtkWidget* video_widget = cw->priv->main_video_image;
   Ekiga::DisplayInfo display_info;
@@ -2785,7 +2772,7 @@ ekiga_call_window_draw (GtkWidget *widget,
 
   display_info.widget_info_set = true;
 
-  return handled;
+  return handled;*/
 }
 
 static gboolean
diff --git a/lib/engine/gui/gtk-frontend/ext-window.cpp b/lib/engine/gui/gtk-frontend/ext-window.cpp
index 5826e5e..c33db07 100644
--- a/lib/engine/gui/gtk-frontend/ext-window.cpp
+++ b/lib/engine/gui/gtk-frontend/ext-window.cpp
@@ -133,6 +133,7 @@ gui_layout (EkigaExtWindow *ew)
 static inline void
 clear_display_info (EkigaExtWindow *ew)
 {
+  /*
   Ekiga::DisplayInfo info;
 
   info.x = 0;
@@ -147,7 +148,7 @@ clear_display_info (EkigaExtWindow *ew)
   info.gc = 0;
   info.window = 0;
 #endif
-
+*/
   // FIXME
   //ew->priv->vocore->set_ext_display_info (info);
 }
@@ -205,6 +206,7 @@ static gboolean
 draw_event (GtkWidget *widget,
             cairo_t *context)
 {
+  /*
   EkigaExtWindow *ew = EKIGA_EXT_WINDOW (widget);
   Ekiga::DisplayInfo info;
   gboolean handled;
@@ -241,6 +243,8 @@ draw_event (GtkWidget *widget,
   //ew->priv->vocore->set_ext_display_info (info);
 
   return handled;
+*/
+  return true;
 }
 
 static void
diff --git a/lib/engine/videooutput/videooutput-core.cpp b/lib/engine/videooutput/videooutput-core.cpp
index 3eac6de..3e80b02 100644
--- a/lib/engine/videooutput/videooutput-core.cpp
+++ b/lib/engine/videooutput/videooutput-core.cpp
@@ -45,10 +45,6 @@ VideoOutputCore::VideoOutputCore ()
 {
   PWaitAndSignal m(core_mutex);
 
-  videooutput_stats.rx_width = videooutput_stats.rx_height = videooutput_stats.rx_fps = 0;
-  videooutput_stats.tx_width = videooutput_stats.tx_height = videooutput_stats.tx_fps = 0;
-  videooutput_stats.rx_frames = 0;
-  videooutput_stats.tx_frames = 0;
   number_times_started = 0;
 
   settings = new Settings (VIDEO_DISPLAY_SCHEMA);
@@ -103,6 +99,7 @@ void VideoOutputCore::setup (std::string setting)
 
   if (setting.empty () || setting == "ext-zoom") {
 
+    /*
     DisplayInfo display_info;
 
     display_info.zoom = g_settings_get_int (s, "ext-zoom");
@@ -112,7 +109,7 @@ void VideoOutputCore::setup (std::string setting)
       display_info.zoom = 100;
       g_settings_set_int (s, "ext-zoom", 100);
     }
-
+*/
     // FIXME
     //set_ext_display_info(display_info);
   }
@@ -121,6 +118,7 @@ void VideoOutputCore::setup (std::string setting)
       || setting == "allow-pip-sw-scaling" || setting == "sw-scaling-algorithm") {
 
     PTRACE(4, "VideoOutputCore\tUpdating Video Settings");
+    /*
     DisplayInfo display_info;
 
     display_info.on_top = g_settings_get_boolean (s, "stay-on-top");
@@ -135,6 +133,7 @@ void VideoOutputCore::setup (std::string setting)
 
     std::cout << "FIXME" << std::endl << std::flush;
     //set_display_info(display_info);
+    */
   }
 }
 
@@ -147,7 +146,7 @@ void VideoOutputCore::add_manager (VideoOutputManager &manager)
 
   manager.device_opened.connect (boost::bind (&VideoOutputCore::on_device_opened, this, _1, _2, &manager));
   manager.device_closed.connect (boost::bind (&VideoOutputCore::on_device_closed, this, &manager));
-  manager.device_error.connect (boost::bind (&VideoOutputCore::on_device_error, this, _1, &manager));
+  manager.device_error.connect (boost::bind (&VideoOutputCore::on_device_error, this, &manager));
   manager.size_changed.connect (boost::bind (&VideoOutputCore::on_size_changed, this, _1, _2, _3, &manager));
 }
 
@@ -171,8 +170,6 @@ void VideoOutputCore::start ()
    if (number_times_started > 1)
      return;
 
-  g_get_current_time (&last_stats);
-
   for (std::set<VideoOutputManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
        iter++) {
@@ -193,52 +190,21 @@ void VideoOutputCore::stop ()
 
   if (number_times_started != 0)
     return;
-    
+
   for (std::set<VideoOutputManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
        iter++) {
     (*iter)->close ();
   }
-  videooutput_stats.rx_width = videooutput_stats.rx_height = videooutput_stats.rx_fps = 0;
-  videooutput_stats.tx_width = videooutput_stats.tx_height = videooutput_stats.tx_fps = 0;
-  videooutput_stats.rx_frames = 0;
-  videooutput_stats.tx_frames = 0;
 }
 
 void VideoOutputCore::set_frame_data (const char *data,
-                                  unsigned width,
-                                  unsigned height,
-                                  unsigned type,
-                                  int devices_nbr)
+                                      unsigned width,
+                                      unsigned height,
+                                      unsigned type,
+                                      int devices_nbr)
 {
-  core_mutex.Wait ();
-
-  if (type == 0) { // LOCAL
-    videooutput_stats.tx_frames++;
-    videooutput_stats.tx_width = width;
-    videooutput_stats.tx_height = height;
-  }
-  else if (type == 1) { // REMOTE 1
-    videooutput_stats.rx_frames++;
-    videooutput_stats.rx_width = width;
-    videooutput_stats.rx_height = height;
-  }
-
-  GTimeVal current_time;
-  g_get_current_time (&current_time);
-
-  long unsigned milliseconds = ((current_time.tv_sec - last_stats.tv_sec) * 1000)
-                             + ((current_time.tv_usec - last_stats.tv_usec) / 1000);
-
-  if (milliseconds > 2000) {
-    videooutput_stats.tx_fps = round ((videooutput_stats.tx_frames * 1000) / milliseconds);
-    videooutput_stats.rx_fps = round ((videooutput_stats.rx_frames * 1000) / milliseconds);
-    videooutput_stats.rx_frames = 0;
-    videooutput_stats.tx_frames = 0;
-    g_get_current_time (&last_stats);
-  }
-
-  core_mutex.Signal ();
+  PWaitAndSignal m(core_mutex);
 
   for (std::set<VideoOutputManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
@@ -283,9 +249,9 @@ void VideoOutputCore::on_device_closed ( VideoOutputManager *manager)
   device_closed (*manager);
 }
 
-void VideoOutputCore::on_device_error (VideoOutputErrorCodes error_code, VideoOutputManager *manager)
+void VideoOutputCore::on_device_error (VideoOutputManager *manager)
 {
-  device_error (*manager, error_code);
+  device_error (*manager);
 }
 
 void VideoOutputCore::on_size_changed (unsigned width,
diff --git a/lib/engine/videooutput/videooutput-core.h b/lib/engine/videooutput/videooutput-core.h
index 3d8d019..6cf6f16 100644
--- a/lib/engine/videooutput/videooutput-core.h
+++ b/lib/engine/videooutput/videooutput-core.h
@@ -125,7 +125,7 @@ namespace Ekiga
       void start ();
 
       /** Stop the video output
-       * 
+       *
        */
       void stop ();
 
@@ -149,24 +149,13 @@ namespace Ekiga
       void set_ext_display_info (const gpointer _ext);
 
 
-      /*** Statistics ***/
-
-      /** Get the current video output statistics from the core
-       *
-       * @param _videooutput_stats the struct to be filled with the current values..
-       */
-      void get_videooutput_stats (VideoOutputStats & _videooutput_stats) {
-        _videooutput_stats = videooutput_stats;
-      };
-
-
       /*** Signals ***/
 
       /** See videooutput-manager.h for the API
        */
       boost::signals2::signal<void(VideoOutputManager &, bool, bool)> device_opened;
       boost::signals2::signal<void(VideoOutputManager &)> device_closed;
-      boost::signals2::signal<void(VideoOutputManager &, VideoOutputErrorCodes)> device_error;
+      boost::signals2::signal<void(VideoOutputManager &)> device_error;
       boost::signals2::signal<void(VideoOutputManager &, unsigned, unsigned, unsigned)> size_changed;
 
 
@@ -175,17 +164,14 @@ namespace Ekiga
                              bool ext_stream,
                              VideoOutputManager *manager);
       void on_device_closed (VideoOutputManager *manager);
-      void on_device_error (VideoOutputErrorCodes error_code, VideoOutputManager *manager);
+      void on_device_error (VideoOutputManager *manager);
       void on_size_changed (unsigned width,
                             unsigned height,
                             unsigned type,
                             VideoOutputManager *manager);
-      void on_fullscreen_mode_changed (VideoOutputFSToggle toggle, VideoOutputManager *manager);
 
       std::set<VideoOutputManager *> managers;
 
-      VideoOutputStats videooutput_stats;
-      GTimeVal last_stats;
       int number_times_started;
 
       PMutex core_mutex;
diff --git a/lib/engine/videooutput/videooutput-manager.h b/lib/engine/videooutput/videooutput-manager.h
index 63594f4..7571f89 100644
--- a/lib/engine/videooutput/videooutput-manager.h
+++ b/lib/engine/videooutput/videooutput-manager.h
@@ -42,8 +42,6 @@
 #include <boost/bind.hpp>
 #include <glib.h>
 
-#include "videooutput-info.h"
-
 namespace Ekiga
 {
 
@@ -115,9 +113,8 @@ namespace Ekiga
       boost::signals2::signal<void(void)> device_closed;
 
       /** This signal is emitted when an error occurs when opening a video output device.
-       * @param error_code the video output device error code.
        */
-      boost::signals2::signal<void(VideoOutputErrorCodes)> device_error;
+      boost::signals2::signal<void(void)> device_error;
 
       /** This signal is emitted the video output size has changed.
        * This signal is called whenever the size of the widget carrying the video signal


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