[ekiga/ds-clutter: 1/8] VideoOutput: Simplified signals and code.



commit 509d874da62f497501f553c7ccc6afe68198571e
Author: Damien Sandras <dsandras beip be>
Date:   Sun Dec 29 13:59:00 2013 +0100

    VideoOutput: Simplified signals and code.
    
    Signal changes:
      - removed the fullscreen_changed signal: This is not responsability of
        the videooutput component to toggle fullscreen mode. The call window
        of the main application should handle fullscreen mode and display
        the video feeds according to the currently displayed video stream
        resolution.
      - simplified the device_opened signal: The main application handling
        the display only needs to know the number of video streams that are
        active and if there is an extended video stream available or not.
        Other types of information like the fullscreen mode or the current
        video display mode should be handled by the main application itself.
        The video output component should only output whatever signal it
        receives onto the appropriate video surface (in fullscreen mode or
        not).
    
    Other simplifications:
      - set_display_info and set_ext_display_info now directly use a
        gpointer which represents the video surface onto which the videooutput
        component is supposed to output the video stream. The main
        application is supposed to handle fullscreen and
        sizes. The videooutput component only outputs the video stream onto
        that surface.
      - video views have been removed from the component. There is no reason
        to switch from local video to remote video or to both streams. If
        both streams are active, we should display them in PIP mode. If not,
        we should display whatever stream is available. Again, the
        videooutput component does not handle this. The main application
        does. The videooutput component just outputs the stream onto the
        corresponding video surface.
    
    The videoooutput-core has not been 100% ported yet.

 .../videooutput-manager-common.cpp                 |   11 ++----
 .../videooutput-manager-common.h                   |    5 +--
 .../x-videooutput/videooutput-manager-x.cpp        |   20 ++---------
 .../x-videooutput/videooutput-manager-x.h          |    7 +---
 lib/engine/videooutput/videooutput-core.cpp        |   36 +++++++++-----------
 lib/engine/videooutput/videooutput-core.h          |   16 +++-----
 lib/engine/videooutput/videooutput-manager.h       |   30 ++++------------
 7 files changed, 40 insertions(+), 85 deletions(-)
---
diff --git a/lib/engine/components/common-videooutput/videooutput-manager-common.cpp 
b/lib/engine/components/common-videooutput/videooutput-manager-common.cpp
index e61299a..d11982c 100644
--- a/lib/engine/components/common-videooutput/videooutput-manager-common.cpp
+++ b/lib/engine/components/common-videooutput/videooutput-manager-common.cpp
@@ -136,11 +136,12 @@ void GMVideoOutputManager::set_frame_data (const char* data,
 {
   Ekiga::DisplayInfo local_display_info;
 
+  /*
   if (type < 2)
     get_display_info (local_display_info);
   else
     get_ext_display_info (local_display_info);
-
+*/
   bool local = (type == 0);
 
   var_mutex.Wait();
@@ -326,7 +327,6 @@ void GMVideoOutputManager::update_gui_device ()
 
   Ekiga::Runtime::run_in_main
     (boost::bind (&GMVideoOutputManager::device_opened_in_main, this,
-                  current_frame.accel, current_frame.mode, current_frame.zoom,
                   current_frame.both_streams_active,
                   current_frame.ext_stream_active));
 }
@@ -458,12 +458,9 @@ GMVideoOutputManager::redraw ()
 
 
 void
-GMVideoOutputManager::device_opened_in_main (Ekiga::VideoOutputAccel accel,
-                                            Ekiga::VideoOutputMode mode,
-                                            unsigned zoom,
-                                            bool both, bool ext)
+GMVideoOutputManager::device_opened_in_main (bool both, bool ext)
 {
-  device_opened (accel, mode, zoom, both, ext);
+  device_opened (both, ext);
 }
 
 void
diff --git a/lib/engine/components/common-videooutput/videooutput-manager-common.h 
b/lib/engine/components/common-videooutput/videooutput-manager-common.h
index 732e197..7f01c35 100644
--- a/lib/engine/components/common-videooutput/videooutput-manager-common.h
+++ b/lib/engine/components/common-videooutput/videooutput-manager-common.h
@@ -279,10 +279,7 @@
 
   private:
 
-    void device_opened_in_main (Ekiga::VideoOutputAccel accel,
-                               Ekiga::VideoOutputMode mode,
-                               unsigned zoom,
-                               bool both, bool ext);
+    void device_opened_in_main (bool both, bool ext);
 
     void device_closed_in_main ();
 
diff --git a/lib/engine/components/x-videooutput/videooutput-manager-x.cpp 
b/lib/engine/components/x-videooutput/videooutput-manager-x.cpp
index 1db69e4..e345c51 100644
--- a/lib/engine/components/x-videooutput/videooutput-manager-x.cpp
+++ b/lib/engine/components/x-videooutput/videooutput-manager-x.cpp
@@ -208,11 +208,12 @@ GMVideoOutputManager_x::setup_frame_display ()
   if (video_disabled)
     return;
 
+  /*
   if (current_frame.mode == Ekiga::VO_MODE_REMOTE_EXT)
     get_ext_display_info (local_display_info);
   else
     get_display_info (local_display_info);
-
+*/
   switch (current_frame.mode) {
   case Ekiga::VO_MODE_LOCAL:
     Ekiga::Runtime::run_in_main
@@ -456,7 +457,6 @@ GMVideoOutputManager_x::setup_frame_display ()
   else {
     Ekiga::Runtime::run_in_main
       (boost::bind (&GMVideoOutputManager_x::device_opened_in_main, this,
-                    current_frame.accel, current_frame.mode, current_frame.zoom,
                     current_frame.both_streams_active,
                     current_frame.ext_stream_active));
   }
@@ -563,9 +563,6 @@ GMVideoOutputManager_x::display_pip_frames (const char *local_frame,
   if (lxWindow)
     lxWindow->ProcessEvents();
 
-  if (current_frame.mode == Ekiga::VO_MODE_FULLSCREEN && rxWindow && !rxWindow->IsFullScreen ())
-    Ekiga::Runtime::run_in_main (boost::bind (&GMVideoOutputManager_x::fullscreen_mode_changed_in_main, 
this, Ekiga::VO_FS_OFF));
-
   if (rxWindow && (update_required.remote || (!update_required.remote && !update_required.local)))
     rxWindow->PutFrame ((uint8_t *) remote_frame, rf_width, rf_height);
 
@@ -602,12 +599,9 @@ GMVideoOutputManager_x::size_changed_in_main (unsigned width,
 }
 
 void
-GMVideoOutputManager_x::device_opened_in_main (Ekiga::VideoOutputAccel accel,
-                                              Ekiga::VideoOutputMode mode,
-                                              unsigned zoom,
-                                              bool both, bool ext)
+GMVideoOutputManager_x::device_opened_in_main (bool both, bool ext)
 {
-  device_opened (accel, mode, zoom, both, ext);
+  device_opened (both, ext);
 }
 
 void
@@ -621,9 +615,3 @@ GMVideoOutputManager_x::device_error_in_main (Ekiga::VideoOutputErrorCodes code)
 {
   device_error (code);
 }
-
-void
-GMVideoOutputManager_x::fullscreen_mode_changed_in_main (Ekiga::VideoOutputFSToggle val)
-{
-  fullscreen_mode_changed (val);
-}
diff --git a/lib/engine/components/x-videooutput/videooutput-manager-x.h 
b/lib/engine/components/x-videooutput/videooutput-manager-x.h
index e772900..56d8bad 100644
--- a/lib/engine/components/x-videooutput/videooutput-manager-x.h
+++ b/lib/engine/components/x-videooutput/videooutput-manager-x.h
@@ -100,17 +100,12 @@ private:
                             unsigned height,
                             Ekiga::VideoOutputMode mode);
 
-  void device_opened_in_main (Ekiga::VideoOutputAccel accel,
-                             Ekiga::VideoOutputMode mode,
-                             unsigned zoom,
-                             bool both, bool ext);
+  void device_opened_in_main (bool both, bool ext);
 
   void device_closed_in_main ();
 
   void device_error_in_main (Ekiga::VideoOutputErrorCodes code);
 
-  void fullscreen_mode_changed_in_main (Ekiga::VideoOutputFSToggle val);
-
   struct WinitContinuation {
     Display *display;
     Window window;
diff --git a/lib/engine/videooutput/videooutput-core.cpp b/lib/engine/videooutput/videooutput-core.cpp
index 4ea1184..3eac6de 100644
--- a/lib/engine/videooutput/videooutput-core.cpp
+++ b/lib/engine/videooutput/videooutput-core.cpp
@@ -70,6 +70,7 @@ VideoOutputCore::~VideoOutputCore ()
 void VideoOutputCore::setup (std::string setting)
 {
   GSettings *s = settings->get_g_settings ();
+  /*
   if (setting.empty () || setting == "video-view")  {
 
     DisplayInfo display_info;
@@ -98,6 +99,7 @@ void VideoOutputCore::setup (std::string setting)
 
     set_display_info (display_info);
   }
+  */
 
   if (setting.empty () || setting == "ext-zoom") {
 
@@ -111,7 +113,8 @@ void VideoOutputCore::setup (std::string setting)
       g_settings_set_int (s, "ext-zoom", 100);
     }
 
-    set_ext_display_info(display_info);
+    // FIXME
+    //set_ext_display_info(display_info);
   }
 
   if (setting.empty () || setting == "stay-on-top" || setting == "disable-hw-accel"
@@ -130,7 +133,8 @@ void VideoOutputCore::setup (std::string setting)
     }
     display_info.config_info_set = TRUE;
 
-    set_display_info(display_info);
+    std::cout << "FIXME" << std::endl << std::flush;
+    //set_display_info(display_info);
   }
 }
 
@@ -141,10 +145,9 @@ void VideoOutputCore::add_manager (VideoOutputManager &manager)
   managers.insert (&manager);
   manager_added (manager);
 
-  manager.device_opened.connect (boost::bind (&VideoOutputCore::on_device_opened, this, _1, _2, _3, _4, _5, 
&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.fullscreen_mode_changed.connect (boost::bind (&VideoOutputCore::on_fullscreen_mode_changed, this, 
_1, &manager));
   manager.size_changed.connect (boost::bind (&VideoOutputCore::on_size_changed, this, _1, _2, _3, &manager));
 }
 
@@ -244,37 +247,35 @@ void VideoOutputCore::set_frame_data (const char *data,
   }
 }
 
-void VideoOutputCore::set_display_info (const DisplayInfo & _display_info)
+void VideoOutputCore::set_display_info (const gpointer _local,
+                                        const gpointer _remote)
 {
   PWaitAndSignal m(core_mutex);
 
   for (std::set<VideoOutputManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
        iter++) {
-    (*iter)->set_display_info (_display_info);
+    (*iter)->set_display_info (_local, _remote);
   }
 }
 
-void VideoOutputCore::set_ext_display_info (const DisplayInfo & _display_info)
+void VideoOutputCore::set_ext_display_info (const gpointer _ext)
 {
   PWaitAndSignal m(core_mutex);
 
   for (std::set<VideoOutputManager *>::iterator iter = managers.begin ();
        iter != managers.end ();
        iter++) {
-    (*iter)->set_ext_display_info (_display_info);
+    (*iter)->set_ext_display_info (_ext);
   }
 }
 
 
-void VideoOutputCore::on_device_opened (VideoOutputAccel videooutput_accel,
-                                        VideoOutputMode mode,
-                                        unsigned zoom,
-                                        bool both_streams,
+void VideoOutputCore::on_device_opened (bool both_streams,
                                         bool ext_stream,
                                         VideoOutputManager *manager)
 {
-  device_opened (*manager, videooutput_accel, mode, zoom, both_streams, ext_stream);
+  device_opened (*manager, both_streams, ext_stream);
 }
 
 void VideoOutputCore::on_device_closed ( VideoOutputManager *manager)
@@ -287,16 +288,11 @@ void VideoOutputCore::on_device_error (VideoOutputErrorCodes error_code, VideoOu
   device_error (*manager, error_code);
 }
 
-void VideoOutputCore::on_fullscreen_mode_changed ( VideoOutputFSToggle toggle, VideoOutputManager *manager)
-{
-  fullscreen_mode_changed (*manager, toggle);
-}
-
 void VideoOutputCore::on_size_changed (unsigned width,
                                        unsigned height,
-                                       VideoOutputMode mode,
+                                       unsigned type,
                                        VideoOutputManager *manager)
 {
-  size_changed (*manager, width, height, mode);
+  size_changed (*manager, width, height, type);
 }
 
diff --git a/lib/engine/videooutput/videooutput-core.h b/lib/engine/videooutput/videooutput-core.h
index 0c6a90e..3d8d019 100644
--- a/lib/engine/videooutput/videooutput-core.h
+++ b/lib/engine/videooutput/videooutput-core.h
@@ -145,8 +145,8 @@ namespace Ekiga
                            unsigned type,
                            int devices_nbr);
 
-      void set_display_info (const DisplayInfo & _display_info);
-      void set_ext_display_info (const DisplayInfo & _display_info);
+      void set_display_info (const gpointer _local, const gpointer _remote);
+      void set_ext_display_info (const gpointer _ext);
 
 
       /*** Statistics ***/
@@ -164,25 +164,21 @@ namespace Ekiga
 
       /** See videooutput-manager.h for the API
        */
-      boost::signals2::signal<void(VideoOutputManager &, VideoOutputAccel, VideoOutputMode, unsigned, bool, 
bool)> device_opened;
+      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 &, VideoOutputFSToggle)> fullscreen_mode_changed;
-      boost::signals2::signal<void(VideoOutputManager &, unsigned, unsigned, VideoOutputMode)> size_changed;
+      boost::signals2::signal<void(VideoOutputManager &, unsigned, unsigned, unsigned)> size_changed;
 
 
   private:
-      void on_device_opened (VideoOutputAccel videooutput_accel,
-                             VideoOutputMode mode,
-                             unsigned zoom,
-                             bool both_streams,
+      void on_device_opened (bool both_streams,
                              bool ext_stream,
                              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,
-                            VideoOutputMode mode,
+                            unsigned type,
                             VideoOutputManager *manager);
       void on_fullscreen_mode_changed (VideoOutputFSToggle toggle, VideoOutputManager *manager);
 
diff --git a/lib/engine/videooutput/videooutput-manager.h b/lib/engine/videooutput/videooutput-manager.h
index d2c9ca4..63594f4 100644
--- a/lib/engine/videooutput/videooutput-manager.h
+++ b/lib/engine/videooutput/videooutput-manager.h
@@ -40,6 +40,7 @@
 
 #include <boost/signals2.hpp>
 #include <boost/bind.hpp>
+#include <glib.h>
 
 #include "videooutput-info.h"
 
@@ -96,20 +97,18 @@ namespace Ekiga
                                    unsigned type,
                                    int devices_nbr) = 0;
 
-      virtual void set_display_info (const DisplayInfo &) { };
-      virtual void set_ext_display_info (const DisplayInfo &) { };
+      virtual void set_display_info (G_GNUC_UNUSED const gpointer local,
+                                     G_GNUC_UNUSED const gpointer remote) { };
+      virtual void set_ext_display_info (G_GNUC_UNUSED const gpointer ext) { };
 
 
       /*** API to act on VideoOutputDevice events ***/
 
       /** This signal is emitted when a video output device is opened.
-       * @param videooutput_accel actual hardware acceleration support active on the video output device 
opened.
-       * @param mode the mode in which the device was initially opened.
-       * @param zoom the initial zoom level when de device was opened.
        * @param both_streams if a frame from both local and remote stream has been received.
        * @param ext_stream if a frame from an extended video stream has been received.
        */
-      boost::signals2::signal<void(VideoOutputAccel, VideoOutputMode, unsigned, bool, bool)> device_opened;
+      boost::signals2::signal<void(bool, bool)> device_opened;
 
       /** This signal is emitted when a video output device is closed.
        */
@@ -120,29 +119,16 @@ namespace Ekiga
        */
       boost::signals2::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
-       * This signal is called whenever the size of the widget carrying the video signal
-       * has to be changed. This happens when the displayed video changes in resolution
-       * or when it is being zoomed in or out.
-       * @param toggle VO_FS_ON or VO_FS_OFF depending on whether FS was activated or deactivated.
-       */
-      boost::signals2::signal<void(VideoOutputFSToggle)> fullscreen_mode_changed;
-
       /** This signal is emitted the video output size has changed.
        * This signal is called whenever the size of the widget carrying the video signal
-       * has to be changed. This happens when the displayed video changes in resolution
-       * or when it is being zoomed in or out.
+       * has to be changed. This happens when the displayed video changes in resolution.
        * @param width the new width of the widget.
        * @param height the new height of the widget.
-       * @param mode the current frame mode.
+       * @param type the current device type.
        */
-      boost::signals2::signal<void(unsigned, unsigned, VideoOutputMode)> size_changed;
+      boost::signals2::signal<void(unsigned, unsigned, unsigned)> size_changed;
 
   protected:
-      virtual void get_display_info (DisplayInfo &) { };
-      virtual void get_ext_display_info (DisplayInfo &) { };
     };
 
 /**


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