ekiga r7072 - in trunk: lib/engine/components/gstreamer lib/engine/videoinput/mlogo lib/engine/videoinput/ptlib lib/engine/videoinput/skel src/devices



Author: mschneid
Date: Tue Sep 23 18:42:18 2008
New Revision: 7072
URL: http://svn.gnome.org/viewvc/ekiga?rev=7072&view=rev

Log:
Simplified get_frame_data.


Modified:
   trunk/lib/engine/components/gstreamer/gst-videoinput.cpp
   trunk/lib/engine/components/gstreamer/gst-videoinput.h
   trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.cpp
   trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.h
   trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.cpp
   trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.h
   trunk/lib/engine/videoinput/skel/videoinput-core.cpp
   trunk/lib/engine/videoinput/skel/videoinput-core.h
   trunk/lib/engine/videoinput/skel/videoinput-manager.h
   trunk/src/devices/videoinput.cpp

Modified: trunk/lib/engine/components/gstreamer/gst-videoinput.cpp
==============================================================================
--- trunk/lib/engine/components/gstreamer/gst-videoinput.cpp	(original)
+++ trunk/lib/engine/components/gstreamer/gst-videoinput.cpp	Tue Sep 23 18:42:18 2008
@@ -160,9 +160,7 @@
 }
 
 bool
-GST::VideoInputManager::get_frame_data (char* data,
-					unsigned& width,
-					unsigned& height)
+GST::VideoInputManager::get_frame_data (char* data)
 {
   bool result = false;
   GstBuffer* buffer = NULL;
@@ -187,9 +185,6 @@
     g_object_unref (sink);
   }
 
-  width = current_state.width;
-  height = current_state.height;
-
   return result;
 }
 

Modified: trunk/lib/engine/components/gstreamer/gst-videoinput.h
==============================================================================
--- trunk/lib/engine/components/gstreamer/gst-videoinput.h	(original)
+++ trunk/lib/engine/components/gstreamer/gst-videoinput.h	Tue Sep 23 18:42:18 2008
@@ -63,9 +63,7 @@
 
     void close ();
 
-    bool get_frame_data (char* data,
-			 unsigned& width,
-			 unsigned& height);
+    bool get_frame_data (char* data);
 
     bool has_device (const std::string& source,
 		     const std::string& device_name,

Modified: trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.cpp
==============================================================================
--- trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.cpp	(original)
+++ trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.cpp	Tue Sep 23 18:42:18 2008
@@ -116,9 +116,7 @@
   runtime.run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
 }
 
-bool GMVideoInputManager_mlogo::get_frame_data (char *data,
-                                                unsigned & width,
-                                                unsigned & height)
+bool GMVideoInputManager_mlogo::get_frame_data (char *data)
 {
   if (!current_state.opened) {
     PTRACE(1, "GMVideoInputManager_mlogo\tTrying to get frame from closed device");
@@ -142,8 +140,6 @@
   if (pos < 10) 
     increment = +1;
 
-  width  = current_state.width;
-  height = current_state.height;
   return true;
 }
 

Modified: trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.h
==============================================================================
--- trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.h	(original)
+++ trunk/lib/engine/videoinput/mlogo/videoinput-manager-mlogo.h	Tue Sep 23 18:42:18 2008
@@ -68,9 +68,7 @@
 
       virtual void close();
 
-      virtual bool get_frame_data (char *data,
-                                   unsigned & width,
-                                   unsigned & height);
+      virtual bool get_frame_data (char *data);
 
       virtual bool has_device (const std::string & source, const std::string & device_name, unsigned capabilities, Ekiga::VideoInputDevice & device);
 

Modified: trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.cpp
==============================================================================
--- trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.cpp	(original)
+++ trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.cpp	Tue Sep 23 18:42:18 2008
@@ -160,9 +160,7 @@
   runtime.run_in_main (sigc::bind (device_closed.make_slot (), current_state.device));
 }
 
-bool GMVideoInputManager_ptlib::get_frame_data (char *data,
-                                                unsigned & width,
-                                                unsigned & height)
+bool GMVideoInputManager_ptlib::get_frame_data (char *data)
 {
   bool ret = false;
   if (!current_state.opened) {
@@ -170,9 +168,6 @@
     return false;
   }
 
-  width = current_state.width;
-  height = current_state.height;
-
   PINDEX I = 0;
 
   if (input_device)

Modified: trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.h
==============================================================================
--- trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.h	(original)
+++ trunk/lib/engine/videoinput/ptlib/videoinput-manager-ptlib.h	Tue Sep 23 18:42:18 2008
@@ -67,9 +67,7 @@
 
       virtual void close();
 
-      virtual bool get_frame_data (char *data,
-                                   unsigned & width,
-                                   unsigned & height);
+      virtual bool get_frame_data (char *data);
 
       virtual void set_colour     (unsigned colour     );
       virtual void set_brightness (unsigned brightness );

Modified: trunk/lib/engine/videoinput/skel/videoinput-core.cpp
==============================================================================
--- trunk/lib/engine/videoinput/skel/videoinput-core.cpp	(original)
+++ trunk/lib/engine/videoinput/skel/videoinput-core.cpp	Tue Sep 23 18:42:18 2008
@@ -49,6 +49,8 @@
     videoinput_core (_videoinput_core),
   videooutput_core (_videooutput_core)
 {
+  width = 176;
+  height = 144;;
   end_thread = false;
   frame = NULL;
   // Since windows does not like to restart a thread that 
@@ -63,9 +65,11 @@
     stop();
 }
 
-void VideoInputCore::VideoPreviewManager::start (unsigned width, unsigned height)
+void VideoInputCore::VideoPreviewManager::start (unsigned _width, unsigned _height)
 {
   PTRACE(4, "PreviewManager\tStarting Preview");
+  width = _width;
+  height = _height;
   end_thread = false;
   frame = (char*) malloc (unsigned (width * height * 3 / 2));
 
@@ -97,11 +101,9 @@
   if (!frame)
     return;
     
-  unsigned width = 176;
-  unsigned height = 144;;
   while (!end_thread) {
 
-    videoinput_core.get_frame_data(frame, width, height);
+    videoinput_core.get_frame_data(frame);
     videooutput_core.set_frame_data(frame, width, height, true, 1);
 
     // We have to sleep some time outside the mutex lock
@@ -366,14 +368,12 @@
   stream_config.active = false;
 }
 
-void VideoInputCore::get_frame_data (char *data,
-                                   unsigned & width,
-                                   unsigned & height)
+void VideoInputCore::get_frame_data (char *data)
 {
   PWaitAndSignal m(core_mutex);
 
   if (current_manager) {
-    if (!current_manager->get_frame_data(data, width, height)) {
+    if (!current_manager->get_frame_data(data)) {
 
       internal_close();
 
@@ -386,7 +386,7 @@
         internal_open(stream_config.width, stream_config.height, stream_config.fps);
 
       if (current_manager)
-        current_manager->get_frame_data(data, width, height); // the default device must always return true
+        current_manager->get_frame_data(data); // the default device must always return true
     }
     internal_apply_settings();
   }

Modified: trunk/lib/engine/videoinput/skel/videoinput-core.h
==============================================================================
--- trunk/lib/engine/videoinput/skel/videoinput-core.h	(original)
+++ trunk/lib/engine/videoinput/skel/videoinput-core.h	Tue Sep 23 18:42:18 2008
@@ -261,12 +261,8 @@
        * get_frame_data() always returns a frame.
        * In case a new brightness, whiteness, etc. has bee set, it will be applied here.
        * @param data a pointer to the frame buffer that is to be filled. The memory has to be allocated already.
-       * @param width returns the actual width of the frame read.
-       * @param height returns the actual height of the frame read.
        */
-      void get_frame_data (char *data,
-                           unsigned & width,
-                           unsigned & height);
+      void get_frame_data (char *data);
 
 
       /** See vidinput-manager.h for the API
@@ -346,7 +342,7 @@
         * @param width the frame width in pixels of the preview video.
         * @param height the frame width in pixels of the preview video.
         */
-        virtual void start(unsigned width, unsigned height);
+        virtual void start(unsigned _width, unsigned _height);
 
         /** Stop the preview thread.
         * Stop the thread represented by the Main() function. Blocks until the thread has terminated.
@@ -363,6 +359,8 @@
 
         VideoInputCore  & videoinput_core;
         VideoOutputCore & videooutput_core;
+        unsigned width;
+        unsigned height;
       };
 
       /** Class for storing the device configuration.

Modified: trunk/lib/engine/videoinput/skel/videoinput-manager.h
==============================================================================
--- trunk/lib/engine/videoinput/skel/videoinput-manager.h	(original)
+++ trunk/lib/engine/videoinput/skel/videoinput-manager.h	Tue Sep 23 18:42:18 2008
@@ -107,13 +107,9 @@
        * Requires the device to be opened.
        * Returns false if reading the device fails. Also sends a GUI callback to the main thread in that case.
        * @param data a pointer to the frame buffer that is to be filled. The memory has to be allocated already.
-       * @param width returns the actual width of the frame read.
-       * @param height returns the actual height of the frame read.
        * @return false if the reading failed.
        */
-      virtual bool get_frame_data (char * data,
-                                   unsigned & width,
-                                   unsigned & height) = 0;
+      virtual bool get_frame_data (char * data) = 0;
 
       virtual void set_image_data (unsigned /* width */, unsigned /* height */, const char* /*data*/ ) {};
 

Modified: trunk/src/devices/videoinput.cpp
==============================================================================
--- trunk/src/devices/videoinput.cpp	(original)
+++ trunk/src/devices/videoinput.cpp	Tue Sep 23 18:42:18 2008
@@ -178,11 +178,9 @@
 PVideoInputDevice_EKIGA::GetFrameData (BYTE *frame,
 				       PINDEX *i)
 {
-  unsigned width;
-  unsigned height;
-  videoinput_core.get_frame_data((char*)frame, width, height);
+  videoinput_core.get_frame_data((char*)frame);
 
-  *i = width * height * 3 / 2;
+  *i = frameWidth * frameHeight * 3 / 2;
  
   return true;
 }
@@ -191,11 +189,9 @@
 bool PVideoInputDevice_EKIGA::GetFrameDataNoDelay (BYTE *frame,
 						   PINDEX *i)
 {
-  unsigned width;
-  unsigned height;
-  videoinput_core.get_frame_data((char*)frame, width, height);
+  videoinput_core.get_frame_data((char*)frame);
 
-  *i = width * height * 3 / 2;
+  *i = frameWidth * frameHeight * 3 / 2;
   return true;
 }
 



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