ekiga r7210 - in branches/gnome-2-24: . lib/engine/videooutput/dx lib/engine/videooutput/skel lib/engine/videooutput/x src/gui



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

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


Modified:
   branches/gnome-2-24/ChangeLog
   branches/gnome-2-24/NEWS
   branches/gnome-2-24/lib/engine/videooutput/dx/videooutput-manager-dx.cpp
   branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-core.cpp
   branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-core.h
   branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-info.h
   branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-manager.h
   branches/gnome-2-24/lib/engine/videooutput/x/videooutput-manager-x.cpp
   branches/gnome-2-24/src/gui/main.cpp

Modified: branches/gnome-2-24/NEWS
==============================================================================
--- branches/gnome-2-24/NEWS	(original)
+++ branches/gnome-2-24/NEWS	Sun Oct 12 16:59:25 2008
@@ -1,4 +1,5 @@
 Changes since Ekiga 3.00
+- Fix crash on windows when the only available accelerated surface is already taken.
 - Fix playing of audio files with samplerate != 8000Hz on windows (#555832).
 - Fix overlapping issue of font/smiley buttons (#554529) (Jan Schampera)
 - Fix flickering issues on XV due to the X Server's strange bookkeeping of used ports.

Modified: branches/gnome-2-24/lib/engine/videooutput/dx/videooutput-manager-dx.cpp
==============================================================================
--- branches/gnome-2-24/lib/engine/videooutput/dx/videooutput-manager-dx.cpp	(original)
+++ branches/gnome-2-24/lib/engine/videooutput/dx/videooutput-manager-dx.cpp	Sun Oct 12 16:59:25 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: branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-core.cpp
==============================================================================
--- branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-core.cpp	(original)
+++ branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-core.cpp	Sun Oct 12 16:59:25 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: branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-core.h
==============================================================================
--- branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-core.h	(original)
+++ branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-core.h	Sun Oct 12 16:59:25 2008
@@ -168,6 +168,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;
 
@@ -175,6 +176,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: branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-info.h
==============================================================================
--- branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-info.h	(original)
+++ branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-info.h	Sun Oct 12 16:59:25 2008
@@ -84,6 +84,11 @@
     VO_ACCEL_NO_VIDEO
   } VideoOutputAccel;
 
+  enum VideoOutputErrorCodes {
+    VO_ERROR_NONE = 0,
+    VO_ERROR,
+  };
+
 
   typedef struct {
     unsigned rx_fps;

Modified: branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-manager.h
==============================================================================
--- branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-manager.h	(original)
+++ branches/gnome-2-24/lib/engine/videooutput/skel/videooutput-manager.h	Sun Oct 12 16:59:25 2008
@@ -109,6 +109,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: branches/gnome-2-24/lib/engine/videooutput/x/videooutput-manager-x.cpp
==============================================================================
--- branches/gnome-2-24/lib/engine/videooutput/x/videooutput-manager-x.cpp	(original)
+++ branches/gnome-2-24/lib/engine/videooutput/x/videooutput-manager-x.cpp	Sun Oct 12 16:59:25 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: branches/gnome-2-24/src/gui/main.cpp
==============================================================================
--- branches/gnome-2-24/src/gui/main.cpp	(original)
+++ branches/gnome-2-24/src/gui/main.cpp	Sun Oct 12 16:59:25 2008
@@ -1041,6 +1041,13 @@
   gtk_menu_section_set_sensitive (mw->main_menu, "zoom_in", FALSE);
 }
 
+void 
+on_videooutput_device_error_cb (Ekiga::VideoOutputManager & /* manager */, 
+                                Ekiga::VideoOutputErrorCodes error_code, 
+                                gpointer self)
+{
+  PTRACE(1, "Error opening the output device");
+}
 
 void 
 on_fullscreen_mode_changed_cb (Ekiga::VideoOutputManager & /* manager */, Ekiga::VideoOutputFSToggle toggle,  gpointer self)
@@ -4167,6 +4174,9 @@
   conn = videooutput_core->device_closed.connect (sigc::bind (sigc::ptr_fun (on_videooutput_device_closed_cb), (gpointer) window));
   mw->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) window));
   mw->connections.push_back (conn);
 



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