ekiga r7211 - in trunk: . lib/engine/videooutput/dx lib/engine/videooutput/skel lib/engine/videooutput/x src/gui



Author: mschneid
Date: Sun Oct 12 16:59:38 2008
New Revision: 7211
URL: http://svn.gnome.org/viewvc/ekiga?rev=7211&view=rev

Log:
Add signal when unable to open any video output.
Do not crash on windows in that case.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/videooutput/dx/videooutput-manager-dx.cpp
   trunk/lib/engine/videooutput/skel/videooutput-core.cpp
   trunk/lib/engine/videooutput/skel/videooutput-core.h
   trunk/lib/engine/videooutput/skel/videooutput-info.h
   trunk/lib/engine/videooutput/skel/videooutput-manager.h
   trunk/lib/engine/videooutput/x/videooutput-manager-x.cpp
   trunk/src/gui/main.cpp

Modified: trunk/lib/engine/videooutput/dx/videooutput-manager-dx.cpp
==============================================================================
--- trunk/lib/engine/videooutput/dx/videooutput-manager-dx.cpp	(original)
+++ trunk/lib/engine/videooutput/dx/videooutput-manager-dx.cpp	Sun Oct 12 16:59:38 2008
@@ -71,6 +71,9 @@
 {
   Ekiga::DisplayInfo local_display_info;
 
+  if (video_disabled)
+    return;
+    
   get_display_info(local_display_info);
 
 //  runtime.run_in_main (force_redraw.make_slot ()); //FIXME: check
@@ -110,13 +113,13 @@
   case Ekiga::VO_MODE_LOCAL:
     PTRACE(4, "GMVideoOutputManager_DX\tOpening :VO_MODE_LOCAL display with image of " << current_frame.local_width << "x" << current_frame.local_height);
     dxWindow = new DXWindow();
-    current_frame.accel = (Ekiga::VideoOutputAccel) dxWindow->Init (local_display_info.hwnd,
-                          local_display_info.x,
-                          local_display_info.y,
-                            (int) (current_frame.local_width * current_frame.zoom / 100), 
-                            (int) (current_frame.local_height * current_frame.zoom / 100),
-                            current_frame.local_width, 
-                            current_frame.local_height);
+    video_disabled = !dxWindow->Init (local_display_info.hwnd,
+                                      local_display_info.x,
+                                      local_display_info.y,
+                                      (int) (current_frame.local_width * current_frame.zoom / 100), 
+                                      (int) (current_frame.local_height * current_frame.zoom / 100),
+                                      current_frame.local_width, 
+                                      current_frame.local_height);
 
     last_frame.embedded_x = local_display_info.x;
     last_frame.embedded_y = local_display_info.y;
@@ -130,13 +133,13 @@
   case Ekiga::VO_MODE_REMOTE:
     PTRACE(4, "GMVideoOutputManager_DX\tOpening VO_MODE_REMOTE display with image of " << current_frame.remote_width << "x" << current_frame.remote_height);
     dxWindow = new DXWindow();
-    current_frame.accel = (Ekiga::VideoOutputAccel) dxWindow->Init (local_display_info.hwnd,
-                          local_display_info.x,
-                          local_display_info.y,
-                          (int) (current_frame.remote_width * current_frame.zoom / 100), 
-                          (int) (current_frame.remote_height * current_frame.zoom / 100),
-                          current_frame.remote_width, 
-                          current_frame.remote_height); 
+    video_disabled = !dxWindow->Init (local_display_info.hwnd,
+                                      local_display_info.x,
+                                      local_display_info.y,
+                                      (int) (current_frame.remote_width * current_frame.zoom / 100), 
+                                      (int) (current_frame.remote_height * current_frame.zoom / 100),
+                                      current_frame.remote_width, 
+                                      current_frame.remote_height); 
 
     last_frame.embedded_x = local_display_info.x;
     last_frame.embedded_y = local_display_info.y;
@@ -154,15 +157,15 @@
             << current_frame.local_width << "x" << current_frame.local_height << "(local) and " 
 	    << current_frame.remote_width << "x" << current_frame.remote_height << "(remote)");
     dxWindow = new DXWindow();
-    current_frame.accel = (Ekiga::VideoOutputAccel) dxWindow->Init ((current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.hwnd : NULL,
-                          (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.x : 0,
-                          (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.y : 0,
-                          (int) (current_frame.remote_width * current_frame.zoom  / 100), 
-                          (int) (current_frame.remote_height * current_frame.zoom  / 100),
-                             current_frame.remote_width, 
-                             current_frame.remote_height,
-                             current_frame.local_width, 
-                             current_frame.local_height); 
+    video_disabled = !dxWindow->Init ((current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.hwnd : NULL,
+                                      (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.x : 0,
+                                      (current_frame.mode == Ekiga::VO_MODE_PIP) ? local_display_info.y : 0,
+                                      (int) (current_frame.remote_width * current_frame.zoom  / 100), 
+                                      (int) (current_frame.remote_height * current_frame.zoom  / 100),
+                                      current_frame.remote_width, 
+                                      current_frame.remote_height,
+                                      current_frame.local_width, 
+                                      current_frame.local_height); 
 
     if (dxWindow && current_frame.mode == Ekiga::VO_MODE_FULLSCREEN) 
       dxWindow->ToggleFullscreen ();
@@ -192,7 +195,15 @@
 //     close_frame_display ();
 
   last_frame.both_streams_active = current_frame.both_streams_active;
-  runtime.run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
+  if (video_disabled) {
+    delete dxWindow;
+    dxWindow = NULL;
+    runtime.run_in_main (sigc::bind (device_error.make_slot (), Ekiga::VO_ERROR));
+  }
+  else {
+    current_frame.accel = Ekiga::VO_ACCEL_ALL; 
+    runtime.run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
+  }
 }
 
 void

Modified: trunk/lib/engine/videooutput/skel/videooutput-core.cpp
==============================================================================
--- trunk/lib/engine/videooutput/skel/videooutput-core.cpp	(original)
+++ trunk/lib/engine/videooutput/skel/videooutput-core.cpp	Sun Oct 12 16:59:38 2008
@@ -89,6 +89,7 @@
 
   manager.device_opened.connect (sigc::bind (sigc::mem_fun (this, &VideoOutputCore::on_device_opened), &manager));
   manager.device_closed.connect (sigc::bind (sigc::mem_fun (this, &VideoOutputCore::on_device_closed), &manager));
+  manager.device_error.connect (sigc::bind (sigc::mem_fun (this, &VideoOutputCore::on_device_error), &manager));
   manager.fullscreen_mode_changed.connect (sigc::bind (sigc::mem_fun (this, &VideoOutputCore::on_fullscreen_mode_changed), &manager));
   manager.size_changed.connect (sigc::bind (sigc::mem_fun (this, &VideoOutputCore::on_size_changed), &manager));
 }
@@ -211,6 +212,11 @@
   device_closed.emit (*manager);
 }
 
+void VideoOutputCore::on_device_error (VideoOutputErrorCodes error_code, VideoOutputManager *manager)
+{
+  device_error.emit (*manager, error_code);
+}
+
 void VideoOutputCore::on_fullscreen_mode_changed ( VideoOutputFSToggle toggle, VideoOutputManager *manager)
 {
   fullscreen_mode_changed.emit (*manager, toggle);

Modified: trunk/lib/engine/videooutput/skel/videooutput-core.h
==============================================================================
--- trunk/lib/engine/videooutput/skel/videooutput-core.h	(original)
+++ trunk/lib/engine/videooutput/skel/videooutput-core.h	Sun Oct 12 16:59:38 2008
@@ -166,6 +166,7 @@
        */
       sigc::signal<void, VideoOutputManager &, VideoOutputAccel, VideoOutputMode, unsigned, bool> device_opened;
       sigc::signal<void, VideoOutputManager &> device_closed;
+      sigc::signal<void, VideoOutputManager &, VideoOutputErrorCodes> device_error;
       sigc::signal<void, VideoOutputManager &, VideoOutputFSToggle> fullscreen_mode_changed;
       sigc::signal<void, VideoOutputManager &, unsigned, unsigned> size_changed;
 
@@ -173,6 +174,7 @@
   private:
       void on_device_opened (VideoOutputAccel videooutput_accel, VideoOutputMode mode, unsigned zoom, bool both_streams, VideoOutputManager *manager);
       void on_device_closed (VideoOutputManager *manager);
+      void on_device_error (VideoOutputErrorCodes error_code, VideoOutputManager *manager);
       void on_size_changed ( unsigned width, unsigned height, VideoOutputManager *manager);
       void on_fullscreen_mode_changed (VideoOutputFSToggle toggle, VideoOutputManager *manager);
 

Modified: trunk/lib/engine/videooutput/skel/videooutput-info.h
==============================================================================
--- trunk/lib/engine/videooutput/skel/videooutput-info.h	(original)
+++ trunk/lib/engine/videooutput/skel/videooutput-info.h	Sun Oct 12 16:59:38 2008
@@ -84,6 +84,11 @@
     VO_ACCEL_NO_VIDEO
   } VideoOutputAccel;
 
+  enum VideoOutputErrorCodes {
+    VO_ERROR_NONE = 0,
+    VO_ERROR,
+  };
+
 
   typedef struct {
     unsigned rx_fps;

Modified: trunk/lib/engine/videooutput/skel/videooutput-manager.h
==============================================================================
--- trunk/lib/engine/videooutput/skel/videooutput-manager.h	(original)
+++ trunk/lib/engine/videooutput/skel/videooutput-manager.h	Sun Oct 12 16:59:38 2008
@@ -111,6 +111,11 @@
        */
       sigc::signal<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.
+       */
+      sigc::signal<void, VideoOutputErrorCodes> device_error;
+
       /** This signal is emitted when a manager switches autonomously into or out of fullscreen mode.
        * Some managers like DX and XV  allow the user to switch between FS
        * by pressing a key or clicking a mouse button on top of the video. In order to

Modified: trunk/lib/engine/videooutput/x/videooutput-manager-x.cpp
==============================================================================
--- trunk/lib/engine/videooutput/x/videooutput-manager-x.cpp	(original)
+++ trunk/lib/engine/videooutput/x/videooutput-manager-x.cpp	Sun Oct 12 16:59:38 2008
@@ -419,7 +419,12 @@
   }
 
   last_frame.both_streams_active = current_frame.both_streams_active;
-  runtime.run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
+  if (video_disabled) {
+    runtime.run_in_main (sigc::bind (device_error.make_slot (), Ekiga::VO_ERROR));
+  }
+  else {
+    runtime.run_in_main (sigc::bind (device_opened.make_slot (), current_frame.accel, current_frame.mode, current_frame.zoom, current_frame.both_streams_active));
+  }
 }
 
 void

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Sun Oct 12 16:59:38 2008
@@ -946,6 +946,39 @@
   gtk_menu_section_set_sensitive (mw->priv->main_menu, "zoom_in", FALSE);
 }
 
+void 
+on_videooutput_device_error_cb (Ekiga::VideoOutputManager & /* manager */, 
+                                Ekiga::VideoOutputErrorCodes error_code, 
+                                gpointer self)
+{
+  gchar *dialog_title = NULL;
+  gchar *dialog_msg = NULL;
+  gchar *tmp_msg = NULL;
+
+  dialog_title =
+  g_strdup_printf (_("Error while initializing video output"));
+
+  tmp_msg = g_strdup (_("No video will be displayed during this call."));
+  switch (error_code) {
+
+    case Ekiga::VO_ERROR:
+    default:
+#ifdef WIN32  
+      dialog_msg = g_strconcat (_("There was an error opening initializing the video output. Please verify that no other applicating is using the accelerated video output."), "\n\n", tmp_msg, NULL);
+#else
+      dialog_msg = g_strconcat (_("There was an error opening initializing the video output. Please verify that you are using a color depth of 24 or 32 bits per pixel."), "\n\n", tmp_msg, NULL);
+#endif      
+      break;
+  }
+
+  gnomemeeting_warning_dialog_on_widget (GTK_WINDOW (GTK_WIDGET (self)),
+                                         "show_device_warnings",
+                                         dialog_title,
+                                         "%s", dialog_msg);
+  g_free (dialog_msg);
+  g_free (dialog_title);
+  g_free (tmp_msg);
+}
 
 void 
 on_fullscreen_mode_changed_cb (Ekiga::VideoOutputManager & /* manager */, Ekiga::VideoOutputFSToggle toggle,  gpointer self)
@@ -3856,6 +3889,9 @@
   conn = videooutput_core->device_closed.connect (sigc::bind (sigc::ptr_fun (on_videooutput_device_closed_cb), (gpointer) mw));
   mw->priv->connections.push_back (conn);
 
+  conn = videooutput_core->device_error.connect (sigc::bind (sigc::ptr_fun (on_videooutput_device_error_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
   conn = videooutput_core->size_changed.connect (sigc::bind (sigc::ptr_fun (on_size_changed_cb), (gpointer) mw));
   mw->priv->connections.push_back (conn);
 



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