ekiga r5929 - in trunk: . lib/engine/display/dx lib/engine/display/x



Author: mschneid
Date: Sun Jan 20 20:59:59 2008
New Revision: 5929
URL: http://svn.gnome.org/viewvc/ekiga?rev=5929&view=rev

Log:
Initial DirectX implementation.


Modified:
   trunk/ChangeLog
   trunk/lib/engine/display/dx/display-manager-dx.cpp
   trunk/lib/engine/display/dx/display-manager-dx.h
   trunk/lib/engine/display/x/display-manager-x.h

Modified: trunk/lib/engine/display/dx/display-manager-dx.cpp
==============================================================================
--- trunk/lib/engine/display/dx/display-manager-dx.cpp	(original)
+++ trunk/lib/engine/display/dx/display-manager-dx.cpp	Sun Jan 20 20:59:59 2008
@@ -37,7 +37,198 @@
 
 #include "display-manager-dx.h"
 
-GMDisplayManager_dx::GMDisplayManager_dx (Ekiga::ServiceCore & core)
-: GMDisplayManager(core)
+GMDisplayManager_dx::GMDisplayManager_dx (Ekiga::ServiceCore & _core)
+: GMDisplayManager(_core)
 {
+  dxWindow = NULL;
+}
+
+GMDisplayManager_dx::~GMDisplayManager_dx ()
+{
+}
+
+bool
+GMDisplayManager_dx::frame_display_change_needed ()
+{
+  if (!dxWindow)
+    return true;
+
+  return GMDisplayManager::frame_display_change_needed ();
+}
+
+void
+GMDisplayManager_dx::setup_frame_display ()
+{
+  Display local_display_info;
+
+  get_display_info(local_display_info);
+
+//  runtime.run_in_main (force_redraw.make_slot ()); //FIXME: check
+
+  switch (current_frame.display) {
+  case LOCAL_VIDEO:
+    runtime.run_in_main (sigc::bind (display_size_changed.make_slot (), (unsigned) (current_frame.local_width * current_frame.zoom / 100), (unsigned) (current_frame.local_height * current_frame.zoom / 100)));
+    break;
+  case REMOTE_VIDEO:
+  case PIP:
+    runtime.run_in_main (sigc::bind (display_size_changed.make_slot (), (unsigned) (current_frame.remote_width * current_frame.zoom / 100), (unsigned) (current_frame.remote_height * current_frame.zoom / 100)));
+    break;
+  case FULLSCREEN:
+    runtime.run_in_main (sigc::bind (display_size_changed.make_slot (), 176, 144));
+    break;
+  case PIP_WINDOW:
+    runtime.run_in_main (sigc::bind (display_size_changed.make_slot (), 176, 144));
+    break;
+  case UNSET:
+  default:
+    PTRACE (1, "GMDisplayManager_DX\tDisplay variable not set");
+    return;
+    break; 
+  }
+
+  if ((!local_display_info.widget_info_set) || (!local_display_info.config_info_set)) 
+      (local_display_info.display == UNSET) || (local_display_info.zoom == 0) || (current_frame.zoom == 0)) {
+    PTRACE(4, "GMDisplayManager_DX\tWidget not yet realized or gconf info not yet set, not opening display");
+    return;
+  }
+
+  close_frame_display ();
+
+  runtime.run_in_main (sigc::bind (display_mode_changed.make_slot (), current_frame.display));
+
+  HwAccelStatus hw_accel_stats = NONE;
+
+  switch (current_frame.display) {
+  case LOCAL_VIDEO:
+    PTRACE(4, "GMDisplayManager_DX\tOpening LOCAL_VIDEO display with image of " << current_frame.local_width << "x" << current_frame.local_height);
+    dxWindow = new DXWindow();
+    hw_accel_stats = (HwAccelStatus) 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);
+
+    lastFrame.embeddedX = local_display_info.x;
+    lastFrame.embeddedY = local_display_info.y;
+
+    last_frame.display = LOCAL_VIDEO;
+    last_frame.local_width = current_frame.local_width;
+    last_frame.local_height = current_frame.local_height;
+    last_frame.zoom = current_frame.zoom;
+    break;
+
+  case REMOTE_VIDEO:
+    PTRACE(4, "GMDisplayManager_DX\tOpening REMOTE_VIDEO display with image of " << current_frame.remote_width << "x" << current_frame.remote_height);
+    dxWindow = new DXWindow();
+    hw_accel_stats = (HwAccelStatus) 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); 
+
+    lastFrame.embeddedX = local_display_info.x;
+    lastFrame.embeddedY = local_display_info.y;
+
+    last_frame.display = REMOTE_VIDEO;
+    last_frame.remote_width = current_frame.remote_width;
+    last_frame.remote_height = current_frame.remote_height;
+    last_frame.zoom = current_frame.zoom;
+    break;
+
+  case FULLSCREEN:
+  case PIP:
+  case PIP_WINDOW:
+    PTRACE(4, "GMDisplayManager_DX\tOpening display " << current_frame.display << " with images of " 
+            << current_frame.local_width << "x" << current_frame.local_height << "(local) and " 
+	    << current_frame.remote_width << "x" << current_frame.remote_height << "(remote)");
+    dxWindow = new DXWindow();
+    hw_accel_stats = (HwAccelStatus) dxWindow->Init ((current_frame.display == PIP) ? local_display_info.hwnd : NULL,
+                          (current_frame.display == PIP) ? local_display_info.x : 0,
+                          (current_frame.display == 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.display == FULLSCREEN) 
+      dxWindow->ToggleFullscreen ();
+
+    lastFrame.embeddedX = local_display_info.x;
+    lastFrame.embeddedY = local_display_info.y;
+
+    last_frame.display = current_frame.display;
+    last_frame.local_width = current_frame.local_width;
+    last_frame.local_height = current_frame.local_height;
+    last_frame.remote_width = current_frame.remote_width;
+    last_frame.remote_height = current_frame.remote_height;
+    last_frame.zoom = current_frame.zoom;
+    break;
+
+  case UNSET:
+  default:
+    return;
+    break;
+  }
+  PTRACE (4, "GMVideoDisplay_DX\tSetup display " << display << " with zoom value of " << zoom );
+
+  if (local_display_info.on_top && dxWindow)
+      dxWindow->ToggleOntop ();
+
+//   if (!status)
+//     close_frame_display ();
+
+  runtime.run_in_main (sigc::bind (hw_accel_status_changed.make_slot (), hw_accel_status));
+}
+
+void
+GMDisplayManager_dx::close_frame_display ()
+{
+  runtime.run_in_main (sigc::bind (hw_accel_status_changed.make_slot (), NO_VIDEO));
+
+  if (dxWindow) {
+
+    delete dxWindow;
+    dxWindow = NULL;
+  }
+}
+
+void
+GMDisplayManager_dx::display_frame (const char *frame,
+                             unsigned width,
+                             unsigned height)
+{
+// FIXME processEvents
+  if  (dxWindow)
+    dxWindow->PutFrame ((uint8_t *) frame, width, height);
+}
+
+void
+GMDisplayManager_dx::display_pip_frames (const char *local_frame,
+                                 unsigned lf_width,
+                                 unsigned lf_height,
+                                 const char *remote_frame,
+                                 unsigned rf_width,
+                                 unsigned rf_height)
+{
+// FIXME processEvents
+  if (currentFrame.display == FULLSCREEN && dxWindow && !dxWindow->IsFullScreen ())
+    runtime.run_in_main (sigc::bind (fullscreen_mode_changed.make_slot (), OFF));
+
+//  if (dxWindow && (update_required.remote || (!update_required.remote && !update_required.local)))
+
+  if (dxWindow)
+    dxWindow->PutFrame ((uint8_t *) remote_frame, rf_width, rf_height, 
+                        (uint8_t *) local_frame, lf_width, lf_height);
+}
+
+void
+GMDisplayManager_x::sync (UpdateRequired sync_required)
+{
+  // FIXME sync
 }

Modified: trunk/lib/engine/display/dx/display-manager-dx.h
==============================================================================
--- trunk/lib/engine/display/dx/display-manager-dx.h	(original)
+++ trunk/lib/engine/display/dx/display-manager-dx.h	Sun Jan 20 20:59:59 2008
@@ -47,16 +47,32 @@
    : public  GMDisplayManager
 {
 public:
-  GMDisplayManager_dx (Ekiga::ServiceCore & core);
+  GMDisplayManager_dx (Ekiga::ServiceCore & _core);
 
-  virtual void setup_frame_display () {};
+  ~GMDisplayManager_dx ();
+
+  /* DESCRIPTION  :  /
+   * BEHAVIOR     :  Returns TRUE if the given settings require a
+   *                 reinitialization of the display, FALSE 
+   *                 otherwise.
+   * PRE          :  /
+   */
+  virtual bool frame_display_change_needed ();
+
+  /* DESCRIPTION  :  /
+   * BEHAVIOR     :  Setup the display following the display type,
+   *                 picture dimensions and zoom value.
+   *                 Returns FALSE in case of failure.
+   * PRE          :  /
+   */
+  virtual void setup_frame_display ();
 
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Closes the frame display and returns FALSE 
    *                 in case of failure.
    * PRE          :  /
    */
-  virtual void close_frame_display () {};
+  virtual void close_frame_display ();
 
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Display the given frame on the correct display.
@@ -65,7 +81,7 @@
    */
   virtual void display_frame (const char *frame,
                              unsigned width,
-                             unsigned height) {};
+                             unsigned height);
 
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Display the given frames as Picture in Picture.
@@ -77,13 +93,16 @@
                                  unsigned lf_height,
                                  const char *remote_frame,
                                  unsigned rf_width,
-                                 unsigned rf_height) {};
-  
+                                 unsigned rf_height);
+
+protected:
+
   /* DESCRIPTION  :  /
    * BEHAVIOR     :  Sync the output of the frame to the display
    * PRE          :  /
    */
-  virtual void sync(UpdateRequired sync_required) {};
+  virtual void sync(UpdateRequired sync_required);
 
+  DXWindow *dxWindow;
 };
 #endif /* VIDEODISPLAY_DX */

Modified: trunk/lib/engine/display/x/display-manager-x.h
==============================================================================
--- trunk/lib/engine/display/x/display-manager-x.h	(original)
+++ trunk/lib/engine/display/x/display-manager-x.h	Sun Jan 20 20:59:59 2008
@@ -48,7 +48,7 @@
    : public  GMDisplayManager
 {
 public:
-  GMDisplayManager_x (Ekiga::ServiceCore & core);
+  GMDisplayManager_x (Ekiga::ServiceCore & _core);
 
   ~GMDisplayManager_x ();
 



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