ekiga r6111 - in trunk: . lib/engine lib/engine/vidinput/skel src src/devices src/endpoints src/gui



Author: mschneid
Date: Thu Apr  3 07:16:45 2008
New Revision: 6111
URL: http://svn.gnome.org/viewvc/ekiga?rev=6111&view=rev

Log:
New gconf device format. Switch audio input and
output to the engine.


Added:
   trunk/src/devices/audiodev.cpp
   trunk/src/devices/audiodev.h
Modified:
   trunk/ChangeLog
   trunk/ekiga.schemas.in.in
   trunk/lib/engine/engine.cpp
   trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp
   trunk/src/Makefile.am
   trunk/src/endpoints/ekiga.cpp
   trunk/src/endpoints/ekiga.h
   trunk/src/endpoints/manager.cpp
   trunk/src/endpoints/manager.h
   trunk/src/endpoints/pcss.cpp
   trunk/src/endpoints/pcss.h
   trunk/src/gui/assistant.cpp
   trunk/src/gui/conf.cpp
   trunk/src/gui/main.cpp
   trunk/src/gui/preferences.cpp
   trunk/src/gui/preferences.h

Modified: trunk/ekiga.schemas.in.in
==============================================================================
--- trunk/ekiga.schemas.in.in	(original)
+++ trunk/ekiga.schemas.in.in	Thu Apr  3 07:16:45 2008
@@ -3,22 +3,11 @@
 <gconfschemafile>
   <schemalist>
     <schema>
-      <key>/schemas/apps/@PACKAGE_NAME@/devices/audio/plugin</key>
-      <applyto>/apps/@PACKAGE_NAME@/devices/audio/plugin</applyto>
-      <owner>Ekiga</owner>
-      <type>string</type>
-      <default>ALSA</default>
-      <locale name="C">
-	<short>Audio plugin</short>
-	<long>The audio plugin that will be used to detect the devices and manage them</long>
-      </locale>
-    </schema>
-    <schema>
       <key>/schemas/apps/@PACKAGE_NAME@/devices/audio/output_device</key>
       <applyto>/apps/@PACKAGE_NAME@/devices/audio/output_device</applyto>
       <owner>Ekiga</owner>
       <type>string</type>
-      <default>None</default>
+      <default>PTLIB/ALSA/Default</default>
       <locale name="C">
 	<short>Audio output device</short>
 	<long>Select the audio output device to use</long>
@@ -29,29 +18,18 @@
       <applyto>/apps/@PACKAGE_NAME@/devices/audio/input_device</applyto>
       <owner>Ekiga</owner>
       <type>string</type>
-      <default>None</default>
+      <default>PTLIB/ALSA/Default</default>
       <locale name="C">
 	<short>Audio input device</short>
 	<long>Select the audio input device to use</long>
       </locale>
     </schema>
     <schema>
-      <key>/schemas/apps/@PACKAGE_NAME@/devices/video/plugin</key>
-      <applyto>/apps/@PACKAGE_NAME@/devices/video/plugin</applyto>
-      <owner>Ekiga</owner>
-      <type>string</type>
-      <default>PTLIB/V4L2</default>
-      <locale name="C">
-	<short>Video plugin</short>
-	<long>The video plugin that will be used to detect the devices and manage them</long>
-      </locale>
-    </schema>
-    <schema>
       <key>/schemas/apps/@PACKAGE_NAME@/devices/video/input_device</key>
       <applyto>/apps/@PACKAGE_NAME@/devices/video/input_device</applyto>
       <owner>Ekiga</owner>
       <type>string</type>
-      <default>/dev/video0</default>
+      <default>PTLIB/V4L2//dev/video0</default>
       <locale name="C">
 	<short>Video input device</short>
 	<long>Select the video input device to use. If an error occurs when using this device a test picture will be transmitted.</long>
@@ -250,7 +228,7 @@
       <applyto>/apps/@PACKAGE_NAME@/general/sound_events/output_device</applyto>
       <owner>Ekiga</owner>
       <type>string</type>
-      <default>None</default>
+      <default>PTLIB/ALSA/Default</default>
       <locale name="C">
 	<short>Alternative audio output device</short>
 	<long>Select an alternative audio output device to use for sound events.</long>

Modified: trunk/lib/engine/engine.cpp
==============================================================================
--- trunk/lib/engine/engine.cpp	(original)
+++ trunk/lib/engine/engine.cpp	Thu Apr  3 07:16:45 2008
@@ -239,16 +239,16 @@
 
   display_core->setup_conf_bridge();
   vidinput_core->setup_conf_bridge();
-//  audiooutput_core->setup_conf_bridge();
-//  audioinput_core->setup_conf_bridge();
+  audiooutput_core->setup_conf_bridge();
+  audioinput_core->setup_conf_bridge();
 
-//  sigc::connection conn;
-//  conn = hal_core->video_input_device_added.connect (sigc::mem_fun (vidinput_core, &Ekiga::VidInputCore::add_device));
-//  conn = hal_core->video_input_device_removed.connect (sigc::mem_fun (vidinput_core, &Ekiga::VidInputCore::remove_device));
-//  conn = hal_core->audio_output_device_added.connect (sigc::mem_fun (audiooutput_core, &Ekiga::AudioOutputCore::add_device));
-//  conn = hal_core->audio_output_device_removed.connect (sigc::mem_fun (audiooutput_core, &Ekiga::AudioOutputCore::remove_device));
-//  conn = hal_core->audio_input_device_added.connect (sigc::mem_fun (audioinput_core, &Ekiga::AudioInputCore::add_device));
-//  conn = hal_core->audio_input_device_removed.connect (sigc::mem_fun (audioinput_core, &Ekiga::AudioInputCore::remove_device));
+  sigc::connection conn;
+  conn = hal_core->video_input_device_added.connect (sigc::mem_fun (vidinput_core, &Ekiga::VidInputCore::add_device));
+  conn = hal_core->video_input_device_removed.connect (sigc::mem_fun (vidinput_core, &Ekiga::VidInputCore::remove_device));
+  conn = hal_core->audio_output_device_added.connect (sigc::mem_fun (audiooutput_core, &Ekiga::AudioOutputCore::add_device));
+  conn = hal_core->audio_output_device_removed.connect (sigc::mem_fun (audiooutput_core, &Ekiga::AudioOutputCore::remove_device));
+  conn = hal_core->audio_input_device_added.connect (sigc::mem_fun (audioinput_core, &Ekiga::AudioInputCore::add_device));
+  conn = hal_core->audio_input_device_removed.connect (sigc::mem_fun (audioinput_core, &Ekiga::AudioInputCore::remove_device));
   // std::vector<sigc::connection> connections;
   //connections.push_back (conn);
 }

Modified: trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp
==============================================================================
--- trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp	(original)
+++ trunk/lib/engine/vidinput/skel/vidinput-gmconf-bridge.cpp	Thu Apr  3 07:16:45 2008
@@ -87,17 +87,20 @@
                                       gm_conf_get_int (VIDEO_CODECS_KEY "max_frame_rate"));
   }
   else if ( (key == VIDEO_DEVICES_KEY "input_device") ||
-            (key == VIDEO_DEVICES_KEY "plugin") ||
             (key == VIDEO_DEVICES_KEY "channel") ||
             (key == VIDEO_DEVICES_KEY "format") ) {
 
     PTRACE(4, "VidInputCoreConfBridge\tUpdating device");
-    std::string type_source = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
+
+    std::string config_string = gm_conf_get_string (VIDEO_DEVICES_KEY "input_device");
     VidInputDevice vidinput_device;
+    unsigned type_sep = config_string.find_first_of("/");
+    unsigned source_sep = config_string.find_first_of("/", type_sep + 1);
+
+    vidinput_device.type   = config_string.substr ( 0, type_sep );
+    vidinput_device.source = config_string.substr ( type_sep + 1, source_sep - type_sep - 1);
+    vidinput_device.device = config_string.substr ( source_sep + 1, config_string.size() - source_sep );
 
-    vidinput_device.type   = type_source.substr ( 0, type_source.find_first_of("/"));
-    vidinput_device.source = type_source.substr ( type_source.find_first_of("/") + 1, type_source.size() - 1 );
-    vidinput_device.device = gm_conf_get_string (VIDEO_DEVICES_KEY "input_device");
     vidinput_core.set_vidinput_device (vidinput_device,
                                        gm_conf_get_int (VIDEO_DEVICES_KEY "channel"),
                                        (VideoFormat) gm_conf_get_int (VIDEO_DEVICES_KEY "format"));

Modified: trunk/src/Makefile.am
==============================================================================
--- trunk/src/Makefile.am	(original)
+++ trunk/src/Makefile.am	Thu Apr  3 07:16:45 2008
@@ -77,12 +77,12 @@
 
 # Devices 
 ekiga_SOURCES +=			\
-	devices/audio.h			\
-	devices/audio.cpp		\
 	devices/videoinput.h  	        \
 	devices/videoinput.cpp		\
 	devices/videooutput.h           \
-	devices/videooutput.cpp
+	devices/videooutput.cpp         \
+	devices/audiodev.h              \
+	devices/audiodev.cpp
 
 
 # Endpoints 

Added: trunk/src/devices/audiodev.cpp
==============================================================================
--- (empty file)
+++ trunk/src/devices/audiodev.cpp	Thu Apr  3 07:16:45 2008
@@ -0,0 +1,224 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         audiodev.cpp  -  description
+ *                         --------------------------------
+ *   begin                : Thu Mar 06 2008
+ *   copyright            : (C) 2008 by Matthias Schneider
+ *   description          : Audio dummy device to allow opal make use of 
+ *                          the Ekiga Engine 
+ *
+ */
+
+
+#define P_FORCE_STATIC_PLUGIN
+
+#pragma implementation "audiodev.h"
+
+#include "audiodev.h"
+#include "ekiga.h"
+
+/* Plugin definition */
+class PSoundChannel_EKIGA_PluginServiceDescriptor 
+: public PDevicePluginServiceDescriptor
+{
+  public:
+    virtual PObject *CreateInstance (int) const 
+      {
+	return new PSoundChannel_EKIGA (*(GnomeMeeting::Process ()->GetServiceCore ())); 
+      }
+    
+    
+    virtual PStringArray GetDeviceNames(int) const 
+      { 
+	return PStringList("EKIGA"); 
+      }
+    
+    virtual bool ValidateDeviceName (const PString & deviceName, 
+				     int) const 
+      { 
+	return deviceName.Find("EKIGA") == 0; 
+      }
+} PSoundChannel_EKIGA_descriptor;
+
+PCREATE_PLUGIN(EKIGA, PSoundChannel, &PSoundChannel_EKIGA_descriptor);
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+PSoundChannel_EKIGA::PSoundChannel_EKIGA (Ekiga::ServiceCore & _core)
+: core (_core), 
+  audioinput_core (*(dynamic_cast<Ekiga::AudioInputCore *> (_core.get ("audioinput-core")))),
+  audiooutput_core (*(dynamic_cast<Ekiga::AudioOutputCore *> (_core.get ("audiooutput-core"))))
+{
+  opened = false;
+}
+
+
+PSoundChannel_EKIGA::PSoundChannel_EKIGA (const PString & /*_device*/,
+                                          Directions dir,
+                                            unsigned numChannels,
+                                            unsigned sampleRate,
+                                            unsigned bitsPerSample,
+                                            Ekiga::ServiceCore & _core)
+: core (_core), 
+  audioinput_core (*(dynamic_cast<Ekiga::AudioInputCore *> (_core.get ("audioinput-core")))),
+  audiooutput_core (*(dynamic_cast<Ekiga::AudioOutputCore *> (_core.get ("audiooutput-core"))))
+{
+  opened = false;
+  Open (device, dir, numChannels, sampleRate, bitsPerSample);
+}
+
+
+PSoundChannel_EKIGA::~PSoundChannel_EKIGA()
+{
+  Close();
+}
+
+
+PString PSoundChannel_EKIGA::GetDefaultDevice(Directions dir)
+{
+  PStringArray devicenames;
+  devicenames = PSoundChannel_EKIGA::GetDeviceNames (dir);
+
+  return devicenames[0];
+}
+
+
+bool PSoundChannel_EKIGA::Open (const PString & /*_device*/,
+                              Directions _dir,
+                              unsigned _numChannels,
+                              unsigned _sampleRate,
+                              unsigned _bitsPerSample)
+{
+  direction = _dir;
+
+  if (_dir == Recorder) {
+    audioinput_core.start_stream(_numChannels, _sampleRate, _bitsPerSample);
+  }
+  else {
+    audiooutput_core.start (_numChannels, _sampleRate, _bitsPerSample);
+  }
+
+  mNumChannels   = _numChannels;
+  mSampleRate    = _sampleRate;
+  mBitsPerSample = _bitsPerSample;
+
+  opened = true;
+  return true;
+}
+
+
+bool PSoundChannel_EKIGA::Close()
+{
+  if (direction == Recorder) {
+    audioinput_core.stop_stream();
+  }
+  else {
+    audiooutput_core.stop();
+  }
+  opened = false;
+  return true;
+}
+
+
+bool PSoundChannel_EKIGA::Write (const void *buf, PINDEX len)
+{
+  unsigned bytesWritten;
+
+  if (direction == Player) {
+    audiooutput_core.set_frame_data((char*)buf, len, bytesWritten);
+  }
+
+  lastWriteCount = bytesWritten;
+  return true;
+}
+
+
+bool PSoundChannel_EKIGA::Read (void * buf, PINDEX len)
+{
+  unsigned bytesRead;
+
+  if (direction == Recorder) {
+    audioinput_core.get_frame_data((char*)buf, len, bytesRead);
+  }
+
+  lastReadCount = bytesRead;
+  return true;
+}
+
+
+unsigned PSoundChannel_EKIGA::GetChannels()   const
+{
+  return mNumChannels;
+}
+
+
+unsigned PSoundChannel_EKIGA::GetSampleRate() const
+{
+  return mSampleRate;
+}
+
+
+unsigned PSoundChannel_EKIGA::GetSampleSize() const
+{
+  return mBitsPerSample;
+}
+
+
+bool PSoundChannel_EKIGA::SetBuffers (PINDEX size, PINDEX count)
+{
+  if (direction == Recorder) {
+    audioinput_core.set_stream_buffer_size(size, count);
+  }
+  else {
+    audiooutput_core.set_buffer_size(size, count);
+  }
+
+  storedPeriods = count;
+  storedSize = size;
+
+  isInitialised = false;
+
+  return true;
+}
+
+
+bool PSoundChannel_EKIGA::GetBuffers(PINDEX & size, PINDEX & count)
+{
+  size = storedSize;
+  count = storedPeriods;
+  
+  return false;
+}
+
+bool PSoundChannel_EKIGA::IsOpen () const
+{
+  return opened;
+}
\ No newline at end of file

Added: trunk/src/devices/audiodev.h
==============================================================================
--- (empty file)
+++ trunk/src/devices/audiodev.h	Thu Apr  3 07:16:45 2008
@@ -0,0 +1,100 @@
+
+/* Ekiga -- A VoIP and Video-Conferencing application
+ * Copyright (C) 2000-2008 Damien Sandras
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ *
+ * Ekiga is licensed under the GPL license and as a special exception,
+ * you have permission to link or otherwise combine this program with the
+ * programs OPAL, OpenH323 and PWLIB, and distribute the combination,
+ * without applying the requirements of the GNU GPL to the OPAL, OpenH323
+ * and PWLIB programs, as long as you do follow the requirements of the
+ * GNU GPL for all the rest of the software thus combined.
+ */
+
+
+/*
+ *                         audiodev.h  -  description
+ *                         --------------------------------
+ *   begin                : Thu Mar 06 2008
+ *   copyright            : (C) 2008 by Matthias Schneider
+ *   description          : Audio dummy device to allow opal make use of 
+ *                          the Ekiga Engine 
+ *
+ */
+
+#ifndef _EKIGA_AUDIO_DEVICE_H_
+#define _EKIGA_AUDIO_DEVICE_H_
+
+#include <ptlib.h>
+#include <ptlib/sound.h>
+
+#include "audioinput-core.h"
+#include "audiooutput-core.h"
+
+class PSoundChannel_EKIGA : public PSoundChannel {
+  PCLASSINFO(PSoundChannel_EKIGA, PSoundChannel); 
+public:
+  PSoundChannel_EKIGA(Ekiga::ServiceCore & core);
+  PSoundChannel_EKIGA(const PString &device,
+		   PSoundChannel::Directions dir,
+		   unsigned numChannels,
+		   unsigned sampleRate,
+		   unsigned bitsPerSample,
+                   Ekiga::ServiceCore & _core);
+  ~PSoundChannel_EKIGA();
+  static PString GetDefaultDevice(PSoundChannel::Directions);
+  bool Open(const PString & _device,
+       Directions _dir,
+       unsigned _numChannels,
+       unsigned _sampleRate,
+       unsigned _bitsPerSample);
+  bool Close();
+  bool Write(const void * buf, PINDEX len);
+  bool Read(void * buf, PINDEX len);
+  unsigned GetChannels() const;
+  unsigned GetSampleRate() const;
+  unsigned GetSampleSize() const;
+  bool SetBuffers(PINDEX size, PINDEX count);
+  bool GetBuffers(PINDEX & size, PINDEX & count);
+  bool IsOpen() const;
+
+ private:
+
+  PSoundChannel::Directions direction;
+  PString device;
+  unsigned mNumChannels;
+  unsigned mSampleRate;
+  unsigned mBitsPerSample;
+  bool isInitialised;
+
+  PMutex device_mutex;
+
+  /**number of 30 (or 20) ms long sound intervals stored by EKIGA. Typically, 2.*/
+  PINDEX storedPeriods;
+
+  /**Total number of bytes of audio stored by EKIGA.  Typically, 2*480 or 960.*/
+  PINDEX storedSize;
+
+  PINDEX storedVolume;
+
+  Ekiga::ServiceCore & core;
+  Ekiga::AudioInputCore & audioinput_core;
+  Ekiga::AudioOutputCore & audiooutput_core;
+  bool opened;
+};
+
+#endif

Modified: trunk/src/endpoints/ekiga.cpp
==============================================================================
--- trunk/src/endpoints/ekiga.cpp	(original)
+++ trunk/src/endpoints/ekiga.cpp	Thu Apr  3 07:16:45 2008
@@ -40,7 +40,6 @@
 
 #include "ekiga.h"
 #include "callbacks.h"
-#include "audio.h"
 #include "urlhandler.h"
 #include "preferences.h"
 #include "chat-window.h"
@@ -50,8 +49,6 @@
 #include "main.h"
 #include "misc.h"
 
-#include "audio.h"
-
 #ifdef HAVE_DBUS
 #include "dbus.h"
 #endif
@@ -61,7 +58,6 @@
 #include "gmconf.h"
 
 #include "engine.h"
-#include "vidinput-core.h"
 
 #define new PNEW
 
@@ -208,144 +204,6 @@
   return res;
 
 }
-  
-
-bool
-GnomeMeeting::DetectDevices ()
-{
-  gchar *audio_plugin = NULL;
-
-  audio_plugin = gm_conf_get_string (AUDIO_DEVICES_KEY "plugin");
- 
-  PWaitAndSignal m(dev_access_mutex);
-  
-
-  /* Detect the devices */
-  gnomemeeting_sound_daemons_suspend ();
-
-  
-  /* Detect the plugins */
-  audio_managers = PSoundChannel::GetDriverNames ();
-  
-
-  PTRACE (1, "Detected audio plugins: " << setfill (',') << audio_managers
-	  << setfill (' '));
-
-#ifdef HAX_IXJ
-  audio_managers += PString ("Quicknet");
-#endif
-
-  PTRACE (1, "Detected audio plugins: " << setfill (',') << audio_managers
-	  << setfill (' '));
-  
-
-  /* No audio plugin => Exit */
-  if (audio_managers.GetSize () == 0)
-    return FALSE;
-  
-  
-  /* Detect the devices */
-
-  audio_input_devices = 
-    PSoundChannel::GetDeviceNames (audio_plugin, PSoundChannel::Recorder);
-  audio_output_devices = 
-    PSoundChannel::GetDeviceNames (audio_plugin, PSoundChannel::Player);
-
-  
-  if (audio_input_devices.GetSize () == 0) 
-    audio_input_devices += PString (_("No device found"));
-  if (audio_output_devices.GetSize () == 0)
-    audio_output_devices += PString (_("No device found"));
-
-  PTRACE (1, "Detected the following audio input devices: "
-	  << setfill (',') << audio_input_devices << setfill (' ')
-	  << " with plugin " << audio_plugin);
-  PTRACE (1, "Detected the following audio output devices: "
-	  << setfill (',') << audio_output_devices << setfill (' ')
-	  << " with plugin " << audio_plugin);
-  
-  PTRACE (1, "Detected the following audio input devices: " 
-	  << setfill (',') << audio_input_devices << setfill (' ') 
-	  << " with plugin " << audio_plugin);
-  PTRACE (1, "Detected the following audio output devices: " 
-	  << setfill (',') << audio_output_devices << setfill (' ') 
-	  << " with plugin " << audio_plugin);
-
-  g_free (audio_plugin);
-
-  gnomemeeting_sound_daemons_resume ();
-
-  /* Update the GUI, if it is already there */
-  if (prefs_window)
-    gm_prefs_window_update_devices_list (prefs_window, 
-					 audio_input_devices,
-					 audio_output_devices);
-  return TRUE;
-}
-
-
-bool
-GnomeMeeting::DetectCodecs ()
-{
-  OpalMediaFormatList list;
-
-  /* Audio codecs */
-  /*
-  list = endpoint->GetAvailableAudioMediaFormats ();
-
-  PTRACE (1, "Detected audio codecs: " << setfill (',') << list
-	  << setfill (' '));
-
-  if (list.GetSize () == 0)
-    return FALSE;
-
-  if (prefs_window)
-    gm_prefs_window_update_codecs_list (prefs_window, list);
-  */
-
-  /* Video codecs */
-  /*
-  list = endpoint->GetAvailableVideoMediaFormats ();
-  
-  PTRACE (1, "Detected video codecs: " << setfill (',') << list
-	  << setfill (' '));
-
-  if (prefs_window)
-    gm_prefs_window_update_codecs_list (prefs_window, list);
-*/
-
-  return TRUE;
-}
-
-
-void 
-GnomeMeeting::StartAudioTester (G_GNUC_UNUSED gchar *audio_manager,
-                                G_GNUC_UNUSED gchar *audio_player,
-                                G_GNUC_UNUSED gchar *audio_recorder)
-{
-  /* FIXME
-  PWaitAndSignal m(at_access_mutex);
-  
-  if (audio_tester)     
-    delete (audio_tester);
-
-  audio_tester =
-    new GMAudioTester (audio_manager, audio_player, audio_recorder, *this);
-    */
-}
-
-
-void 
-GnomeMeeting::StopAudioTester ()
-{
-  PWaitAndSignal m(at_access_mutex);
-
-  if (audio_tester) {
-   
-    delete (audio_tester);
-    audio_tester = NULL;
-  }
-}
 
 
 Ekiga::ServiceCore *
@@ -469,35 +327,6 @@
 }
 
 
-
-PStringArray 
-GnomeMeeting::GetAudioInputDevices ()
-{
-  PWaitAndSignal m(dev_access_mutex);
-
-  return audio_input_devices;
-}
-
-
-
-PStringArray 
-GnomeMeeting::GetAudioOutpoutDevices ()
-{
-  PWaitAndSignal m(dev_access_mutex);
-
-  return audio_output_devices;
-}
-
-
-PStringArray 
-GnomeMeeting::GetAudioPlugins ()
-{
-  PWaitAndSignal m(dev_access_mutex);
-
-  return audio_managers;
-}
-
-
 void
 GnomeMeeting::InitEngine ()
 {

Modified: trunk/src/endpoints/ekiga.h
==============================================================================
--- trunk/src/endpoints/ekiga.h	(original)
+++ trunk/src/endpoints/ekiga.h	Thu Apr  3 07:16:45 2008
@@ -104,47 +104,6 @@
 
   
   /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Detects the available audio and video managers
-   *                 and audio, video devices corresponding to the managers
-   *                 selected in config. Returns FALSE if no audio manager
-   *                 is detected. Returns TRUE in other cases, even if no
-   *                 devices are found.
-   *                 Updates the preferences window.
-   * PRE          :  /
-   */
-  bool DetectDevices ();
-  
-  
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Detects the available audio and video codecs.
-   *                 Returns FALSE if no audio codecs are detected.
-   *                 Updates the preferences window.
-   * PRE          :  /
-   */
-  bool DetectCodecs ();
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Starts an audio tester that will play any recorded
-   *                 sound to the speakers in real time. Can be used to
-   *                 check if the audio volumes are correct before 
-   *                 a conference.
-   * PRE          :  /
-   */
-  void StartAudioTester (gchar *,
-			 gchar *,
-			 gchar *);
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Stops the current audio tester if any for the given
-   *                 audio manager, player and recorder.
-   * PRE          :  /
-   */
-  void StopAudioTester ();
-
-  
-  /* DESCRIPTION  :  /
    * BEHAVIOR     :  Returns a pointer to the GmWindow structure
    *                 of widgets.
    * PRE          :  /
@@ -219,35 +178,6 @@
    */
   PStringArray GetInterfaces ();
 
-
-  /* DESCRIPTION  : / 
-   * BEHAVIOR     : Returns the list of detected audio input devices. 
-   * 		    That doesn't force a redetection. Use DetectDevices 
-   * 		    for that.
-   * PRE          : /
-   */
-  PStringArray GetAudioInputDevices ();
-  
-  
-  /* DESCRIPTION  : / 
-   * BEHAVIOR     : Returns the list of detected audio output devices. 
-   * 		    That doesn't force a redetection. Use DetectDevices 
-   * 		    for that.
-   * PRE          : /
-   */
-  PStringArray GetAudioOutpoutDevices ();
-  
-  
-  /* DESCRIPTION  : / 
-   * BEHAVIOR     : Returns the list of detected audio plugins. 
-   * 		    That doesn't force a redetection. Use DetectDevices 
-   * 		    for that.
-   * PRE          : /
-   */
-  PStringArray GetAudioPlugins ();
-  
-  
-
  private:
   
   Ekiga::ServiceCore *service_core;
@@ -262,13 +192,6 @@
   int call_number;
 
 
-  /* Detected devices and plugins */
-  PStringArray audio_input_devices;
-  PStringArray audio_output_devices;
-  PStringArray audio_managers;
-  PStringArray video_managers;
-
-
   /* Detected interfaces */
   PStringArray interfaces;
 

Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp	(original)
+++ trunk/src/endpoints/manager.cpp	Thu Apr  3 07:16:45 2008
@@ -177,7 +177,10 @@
 
 /* The class */
 GMManager::GMManager (Ekiga::ServiceCore & _core)
-: core (_core), runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime"))))
+: core (_core), 
+  runtime (*(dynamic_cast<Ekiga::Runtime *> (core.get ("runtime")))),
+  audiooutput_core (*(dynamic_cast<Ekiga::AudioOutputCore *> (_core.get ("audiooutput-core")))) 
+  //FIXME: we shouldnt call sound events here but signal to the frontend which then triggers them
 {
   /* Initialise the endpoint paramaters */
   SetCallingState (GMManager::Standby);
@@ -222,8 +225,10 @@
 	
   sipEP = new GMSIPEndpoint (*this, core);
   AddRouteEntry("pc:.* = sip:<da>");
-  
-  pcssEP = new GMPCSSEndpoint (*this);
+
+  pcssEP = new GMPCSSEndpoint (*this, core);
+  pcssEP->SetSoundChannelPlayDevice("EKIGA");
+  pcssEP->SetSoundChannelRecordDevice("EKIGA");
   AddRouteEntry("h323:.* = pc:<db>");
   AddRouteEntry("sip:.* = pc:<db>");
   
@@ -1120,7 +1125,7 @@
   
   /* Play busy tone if we were connected */
   if (GetCallingState () == GMManager::Connected)
-    pcssEP->PlaySoundEvent ("busy_tone_sound"); 
+    audiooutput_core.play_event("busy_tone_sound");
 
   /* Update internal state */
   SetCallingState (GMManager::Standby);
@@ -1141,7 +1146,7 @@
   std::string uri = (const char *) from.AsString ();
   std::string message = (const char *) _body;
 
-  pcssEP->PlaySoundEvent ("new_message_sound"); // FIXME use signals here too
+  audiooutput_core.play_event("new_message_sound");
 
   runtime.run_in_main (sigc::bind (im_received.make_slot (), display_name, uri, message));
 }
@@ -1355,24 +1360,6 @@
 }
 
 
-bool
-GMManager::SetDeviceVolume (PSoundChannel *sound_channel,
-			     bool is_encoding,
-			     unsigned int vol)
-{
-  return DeviceVolume (sound_channel, is_encoding, TRUE, vol);
-}
-
-
-bool
-GMManager::GetDeviceVolume (PSoundChannel *sound_channel,
-                                 bool is_encoding,
-                                 unsigned int &vol)
-{
-  return DeviceVolume (sound_channel, is_encoding, FALSE, vol);
-}
-
-
 void
 GMManager::OnClosedMediaStream (const OpalMediaStream & stream)
 {
@@ -1536,7 +1523,8 @@
                                       total));
 
     /* Sound event if new voice mail */
-    pcssEP->PlaySoundEvent ("new_voicemail_sound");
+    audiooutput_core.play_event("new_voicemail_sound");
+
   }
 }
 

Modified: trunk/src/endpoints/manager.h
==============================================================================
--- trunk/src/endpoints/manager.h	(original)
+++ trunk/src/endpoints/manager.h	Thu Apr  3 07:16:45 2008
@@ -60,6 +60,7 @@
 #include "call-manager.h"
 #include "call-core.h"
 #include "call.h"
+#include "audiooutput-core.h"
 
 #include <sigc++/sigc++.h>
 #include <string>
@@ -446,20 +447,6 @@
    * PRE          :  /
    */
   void RemoveAccountsEndpoint ();
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Update the audio device volume (playing then recording). 
-   * PRE          :  /
-   */
-  bool SetDeviceVolume (PSoundChannel *, bool, unsigned int);
-
-  
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Returns the audio device volume (playing then recording). 
-   * PRE          :  /
-   */
-  bool GetDeviceVolume (PSoundChannel *, bool, unsigned int &);
   
 
   /* DESCRIPTION  :  /
@@ -600,6 +587,7 @@
   Ekiga::ConfBridge *bridge;
   Ekiga::CodecList codecs; 
   Ekiga::CallCore *call_core;
+  Ekiga::AudioOutputCore & audiooutput_core;
 };
 
 #endif

Modified: trunk/src/endpoints/pcss.cpp
==============================================================================
--- trunk/src/endpoints/pcss.cpp	(original)
+++ trunk/src/endpoints/pcss.cpp	Thu Apr  3 07:16:45 2008
@@ -57,12 +57,12 @@
 
 #define new PNEW
 
-GMPCSSEndpoint::GMPCSSEndpoint (GMManager & ep) 
-: OpalPCSSEndPoint (ep), endpoint (ep)
+GMPCSSEndpoint::GMPCSSEndpoint (GMManager & ep, Ekiga::ServiceCore & _core) 
+: OpalPCSSEndPoint (ep), 
+  endpoint (ep), 
+  core (_core),
+  audiooutput_core (*(dynamic_cast<Ekiga::AudioOutputCore *> (_core.get ("audiooutput-core"))))
 {
-  CallPendingTimer.SetNotifier (PCREATE_NOTIFIER (OnCallPending));
-  OutgoingCallTimer.SetNotifier (PCREATE_NOTIFIER (OnOutgoingCall));
-
 #ifdef WIN32
   SetSoundChannelBufferDepth (20);
 #else
@@ -70,16 +70,6 @@
 #endif
 }
 
-
-bool 
-GMPCSSEndpoint::MakeConnection (OpalCall & call, 
-                                const PString & party,  
-                                void * userData)
-{
-  return OpalPCSSEndPoint::MakeConnection (call, party, userData);
-}
-
-
 void GMPCSSEndpoint::AcceptCurrentIncomingCall ()
 {
   if (!incomingConnectionToken.IsEmpty ()) {
@@ -92,7 +82,6 @@
 
 bool GMPCSSEndpoint::OnShowIncoming (const OpalPCSSConnection & connection)
 {
-  guint interval = 2000;
   guint status = CONTACT_ONLINE;
 
   if (endpoint.GetCallingState() != GMManager::Called)
@@ -106,247 +95,11 @@
   /* The token identifying the current call */
   incomingConnectionToken = connection.GetToken ();
 
-  /* The timers */
-  CallPendingTimer.RunContinuous (interval);
-  
   return TRUE;
 }
 
 
-bool GMPCSSEndpoint::OnShowOutgoing (G_GNUC_UNUSED const OpalPCSSConnection & connection)
+bool GMPCSSEndpoint::OnShowOutgoing (const OpalPCSSConnection & /*connection*/)
 {
-  if (endpoint.GetCallingState () == GMManager::Calling)
-    OutgoingCallTimer.RunContinuous (PTimeInterval (5));
-
   return TRUE;
 }
-
-
-void 
-GMPCSSEndpoint::PlaySoundEvent (PString ev)
-{
-  PWaitAndSignal m(sound_event_mutex);
-
-  GMSoundEvent c (ev);
-}
-
-
-PSoundChannel * 
-GMPCSSEndpoint::CreateSoundChannel (G_GNUC_UNUSED const OpalPCSSConnection & connection,
-				    const OpalMediaFormat & format,
-				    bool is_source)
-{
-  PTRACE(3, "Ekiga\tCreating Sound Channel");
-  GtkWidget *main_window = NULL;
-
-  PSoundChannel *sound_channel = NULL;
-
-  gchar *plugin = NULL;
-  gchar *device = NULL;
-
-  unsigned int play_vol = 0;
-  unsigned int record_vol = 0;
-
-  main_window = GnomeMeeting::Process ()->GetMainWindow ();
-
-  /* Stop the Timers */
-  CallPendingTimer.Stop ();
-  OutgoingCallTimer.Stop ();
-
-  /* Suspend the daemons */
-  gnomemeeting_sound_daemons_suspend ();
-
-  /* Open the channel */
-  gnomemeeting_threads_enter ();
-  plugin = gm_conf_get_string (AUDIO_DEVICES_KEY "plugin");
-  if (is_source)
-    device = gm_conf_get_string (AUDIO_DEVICES_KEY "input_device");
-  else
-    device = gm_conf_get_string (AUDIO_DEVICES_KEY "output_device");
-  gnomemeeting_threads_leave ();
-
-  if (PString (device).Find (_("No device found")) == P_MAX_INDEX) {
-
-    PWaitAndSignal m(sound_event_mutex);
-
-    sound_channel = 
-      PSoundChannel::CreateOpenedChannel (plugin,
-					  device,
-					  is_source ?
-					  PSoundChannel::Recorder
-					  : PSoundChannel::Player, 
-					  1, format.GetClockRate (), 16);
-    if (sound_channel) {
-
-      
-      /* Update the volume sliders */
-      if (is_source) 
-	sound_channel->GetVolume (record_vol);
-      else 
-	sound_channel->GetVolume (play_vol);
-
-      /* Translators : the full sentence is "Opening %s for playing with
-	 plugin %s" or "Opening %s for recording with plugin" */
-      gnomemeeting_threads_enter ();
-      gm_main_window_set_volume_sliders_values (main_window, 
-						is_source?-1:(int) play_vol,
-						is_source?(int)record_vol:-1);
-      gnomemeeting_threads_leave ();
-
-      g_free (plugin);
-      g_free (device);
-
-      return sound_channel;
-    }
-
-
-    gnomemeeting_threads_enter ();
-    if (is_source) 
-      gnomemeeting_error_dialog (GTK_WINDOW (main_window), _("Could not open audio channel for audio transmission"), _("An error occurred while trying to record from the soundcard for the audio transmission. Please check that your soundcard is not busy and that your driver supports full-duplex.\nThe audio transmission has been disabled."));
-    else
-      gnomemeeting_error_dialog (GTK_WINDOW (main_window), _("Could not open audio channel for audio reception"), _("An error occurred while trying to play audio to the soundcard for the audio reception. Please check that your soundcard is not busy and that your driver supports full-duplex.\nThe audio reception has been disabled."));
-    gnomemeeting_threads_leave ();
-  }  
-
-  g_free (plugin);
-  g_free (device);
-
-  return NULL;
-}
-  
-
-void 
-GMPCSSEndpoint::OnEstablished (OpalConnection &connection)
-{
-  CallPendingTimer.Stop ();
-  OutgoingCallTimer.Stop ();
-
-  PTRACE (3, "GMPCSSEndpoint\t PCSS connection established");
-  OpalPCSSEndPoint::OnEstablished (connection);
-}
-
-
-void 
-GMPCSSEndpoint::OnReleased (OpalConnection &connection)
-{
-  PTimeInterval t;
-
-  CallPendingTimer.Stop ();
-  OutgoingCallTimer.Stop ();
-
-  gnomemeeting_sound_daemons_resume ();
-
-  PTRACE (3, "GMPCSSEndpoint\t PCSS connection released");
-  OpalPCSSEndPoint::OnReleased (connection);
-}
-
-
-PString 
-GMPCSSEndpoint::OnGetDestination (G_GNUC_UNUSED const OpalPCSSConnection &connection)
-{
-  return PString ();
-}
-
-
-void 
-GMPCSSEndpoint::GetDeviceVolume (unsigned int &play_vol,
-				 unsigned int &record_vol)
-{
-  PSafePtr<OpalCall> call = NULL;
-  PSafePtr<OpalConnection> connection = NULL;
-  PSafePtr<OpalMediaStream> stream = NULL;
-  PSoundChannel *channel = NULL;
-
-  call = endpoint.FindCallWithLock (endpoint.GetCurrentCallToken ());
-  
-  if (call != NULL) {
-
-    connection = endpoint.GetConnection (call, FALSE);
-
-    if (connection) {
-
-      stream = connection->GetMediaStream (OpalMediaFormat::DefaultAudioSessionID,
-					   FALSE);
-      if (stream) {
-	channel = (PSoundChannel *) ((OpalRawMediaStream &) *stream).GetChannel ();
-	channel->GetVolume (play_vol);
-      }
-
-      stream = connection->GetMediaStream (OpalMediaFormat::DefaultAudioSessionID,
-					   TRUE);
-
-      if (stream) {
-	channel = (PSoundChannel *) ((OpalRawMediaStream &) *stream).GetChannel ();
-	channel->GetVolume (record_vol);
-      }
-    }
-  }
-}
-
-
-bool
-GMPCSSEndpoint::SetDeviceVolume (unsigned int play_vol,
-				 unsigned int record_vol)
-{
-  bool success1 = FALSE;
-  bool success2 = FALSE;
-
-  PSafePtr<OpalCall> call = NULL;
-  PSafePtr<OpalConnection> connection = NULL;
-  PSafePtr<OpalMediaStream> stream = NULL;
-  PSoundChannel *channel = NULL;
-
-  g_return_val_if_fail (play_vol <= 100, FALSE);
-  g_return_val_if_fail (record_vol <= 100, FALSE);
-  
-  call = endpoint.FindCallWithLock (endpoint.GetCurrentCallToken ());
-  
-  if (call != NULL) {
-
-    connection = endpoint.GetConnection (call, FALSE);
-
-    if (connection) {
-
-      stream = connection->GetMediaStream (OpalMediaFormat::DefaultAudioSessionID,
-					   FALSE);
-
-      if (stream) {
-	channel = (PSoundChannel *) ((OpalRawMediaStream &) *stream).GetChannel ();
-	channel->SetVolume (play_vol);
-	success1 = TRUE;
-      }
-      
-      stream = connection->GetMediaStream (OpalMediaFormat::DefaultAudioSessionID,
-					   TRUE);
-
-      if (stream) {
-	channel = (PSoundChannel *) ((OpalRawMediaStream &) *stream).GetChannel ();
-	channel->SetVolume (record_vol);
-	success2 = TRUE;
-      }
-    }
-  }
-
-  return (success1 && success2);
-}
-
-
-void
-GMPCSSEndpoint::OnOutgoingCall (PTimer &,
-                                INT) 
-{
-  PlaySoundEvent ("ring_tone_sound");
-
-  if (OutgoingCallTimer.IsRunning ())
-    OutgoingCallTimer.RunContinuous (PTimeInterval (0, 3));
-}
-
-
-void
-GMPCSSEndpoint::OnCallPending (PTimer &,
-			       INT) 
-{
-  PlaySoundEvent ("incoming_call_sound");
-}
-
-

Modified: trunk/src/endpoints/pcss.h
==============================================================================
--- trunk/src/endpoints/pcss.h	(original)
+++ trunk/src/endpoints/pcss.h	Thu Apr  3 07:16:45 2008
@@ -41,6 +41,7 @@
 
 #include "common.h"
 #include "manager.h"
+#include "audiooutput-core.h"
 
 
 class GMPCSSEndpoint : public OpalPCSSEndPoint
@@ -48,16 +49,7 @@
   PCLASSINFO (GMPCSSEndpoint, OpalPCSSEndPoint);
 
 public:
-  GMPCSSEndpoint (GMManager &);
-
-  
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Starts a call, play the dialtone.
-   * PRE          :  /
-   */
-  bool MakeConnection (OpalCall & call, 
-                       const PString & party,  
-                       void * userData);
+  GMPCSSEndpoint (GMManager &, Ekiga::ServiceCore & _core);
 
 
   /* DESCRIPTION  :  /
@@ -85,91 +77,16 @@
    * 		     to generate a ring tone.
    * PRE          :  /
    */
-  virtual bool OnShowOutgoing (const OpalPCSSConnection &connection);
-  
-  
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Plays a sound event on its device.
-   * PRE          :  /
-   */
-  void PlaySoundEvent (PString ev);
-  
-  
-  /* DESCRIPTION  :  This callback is called when an audio channel has to
-   *                 be opened.
-   * BEHAVIOR     :  Open the Audio Channel or warn the user if it was
-   *                 impossible.
-   * PRE          :  /
-   */
-  PSoundChannel *CreateSoundChannel (const OpalPCSSConnection &connection,
-				     const OpalMediaFormat &format,
-				     bool is_source);
-
-  
-  /* DESCRIPTION  :  This callback is called when the connection is 
-   *                 established and everything is ok.
-   * BEHAVIOR     :  Stops the timers.
-   * PRE          :  /
-   */
-  void OnEstablished (OpalConnection &);
-
-  
-  /* DESCRIPTION  :  This callback is called when a connection to a remote
-   *                 endpoint is cleared.
-   * BEHAVIOR     :  Stops the timers.
-   * PRE          :  /
-   */
-  void OnReleased (OpalConnection &connection);
-
-
-  // FIXME
-  virtual PString OnGetDestination (const OpalPCSSConnection &connection);  
-  
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Returns the playing and recording volume levels.
-   * PRE          :  /
-   */
-  void GetDeviceVolume (unsigned int &play_vol,
-			unsigned int &record_vol);
-
-
-  /* DESCRIPTION  :  /
-   * BEHAVIOR     :  Updates the playing and recording volume levels.
-   *                 Returns FALSE if it fails.
-   * PRE          :  /
-   */
-  bool SetDeviceVolume (unsigned int play_vol,
-			unsigned int record_vol);
+  virtual bool OnShowOutgoing (const OpalPCSSConnection &connection);  
 
 private:
 
-  /* DESCRIPTION  :  Notifier called every second while waiting for an answer
-   *                 for an incoming call.
-   * BEHAVIOR     :  Display an animation in the docklet and play a ring
-   *                 sound.
-   * PRE          :  /
-   */
-  PDECLARE_NOTIFIER(PTimer, GMPCSSEndpoint, OnCallPending);
-
-  
-  /* DESCRIPTION  :  Notifier called every 2 seconds while waiting for an
-   *                 answer for an outging call.
-   * BEHAVIOR     :  Display an animation in the main winow and play a ring
-   *                 sound.
-   * PRE          :  /
-   */
-  PDECLARE_NOTIFIER(PTimer, GMPCSSEndpoint, OnOutgoingCall);
-  
-
-  PTimer CallPendingTimer;
-  PTimer OutgoingCallTimer;
-  
   GMManager & endpoint;
 
   PString incomingConnectionToken; 
 
-  PMutex sound_event_mutex;
+  Ekiga::ServiceCore & core;
+  Ekiga::AudioOutputCore & audiooutput_core;
 };
 
 #endif

Modified: trunk/src/gui/assistant.cpp
==============================================================================
--- trunk/src/gui/assistant.cpp	(original)
+++ trunk/src/gui/assistant.cpp	Thu Apr  3 07:16:45 2008
@@ -41,11 +41,12 @@
 #include "ekiga.h"
 #include "gmconf.h"
 #include "misc.h"
-#include "devices/audio.h"
 #include "toolbox/toolbox.h"
 #include "assistant.h"
 
 #include "vidinput-core.h"
+#include "audioinput-core.h"
+#include "audiooutput-core.h"
 
 G_DEFINE_TYPE(EkigaAssistant, ekiga_assistant, GTK_TYPE_ASSISTANT)
 
@@ -58,9 +59,8 @@
   GtkWidget *personal_data_page;
   GtkWidget *ekiga_net_page;
   GtkWidget *connection_type_page;
-  GtkWidget *audio_manager_page;
   GtkWidget *audio_devices_page;
-  GtkWidget *video_manager_page;
+  GtkWidget *video_devices_page;
   GtkWidget *summary_page;
 
   GtkWidget *name;
@@ -71,12 +71,10 @@
 
   GtkWidget *connection_type;
 
-  GtkWidget *audio_manager;
-
   GtkWidget *audio_player;
   GtkWidget *audio_recorder;
 
-  GtkWidget *video_manager;
+  GtkWidget *video_device;
 
   GtkListStore *summary_model;
 };
@@ -126,6 +124,19 @@
   gtk_assistant_set_page_complete (assistant, current_page, complete);
 }
 
+void 
+get_audio_output_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & device_list);
+void 
+get_audio_input_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & device_list);
+void 
+get_video_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & device_list);
+
+gchar**
+convert_string_list (const std::vector<std::string> & list);
+
 static void
 update_combo_box (GtkComboBox         *combo_box,
                   const gchar * const *options,
@@ -571,74 +582,6 @@
   gm_conf_set_int (GENERAL_KEY "kind_of_net", connection_type);
 }
 
-/**********************
- * Audio manager page *
- **********************/
-
-static void
-create_audio_manager_page (EkigaAssistant *assistant)
-{
-  GtkWidget *vbox;
-  GtkWidget *label;
-  gchar *text;
-
-  vbox = create_page (assistant, _("Audio Manager"), GTK_ASSISTANT_PAGE_CONTENT);
-
-  label = gtk_label_new (_("Please choose your audio manager:"));
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
-
-  assistant->priv->audio_manager = gtk_combo_box_new_text ();
-  gtk_box_pack_start (GTK_BOX (vbox), assistant->priv->audio_manager, FALSE, FALSE, 0);
-
-  label = gtk_label_new (NULL);
-#ifdef WIN32
-  text = g_strdup_printf ("<i>%s</i>", _("The audio manager is the plugin that "
-                          "will manage your audio devices. WindowsMultimedia "
-                          "is probably the best choice when available."));
-#else
-  text = g_strdup_printf ("<i>%s</i>", _("The audio manager is the plugin that "
-                          "will manage your audio devices. ALSA is probably "
-                          "the best choice when available."));
-#endif
-  gtk_label_set_markup (GTK_LABEL (label), text);
-  g_free (text);
-  gtk_label_set_line_wrap (GTK_LABEL (label), TRUE);
-  gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
-  gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
-
-  assistant->priv->audio_manager_page = vbox;
-  gtk_widget_show_all (vbox);
-  gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox, TRUE);
-}
-
-static void
-prepare_audio_manager_page (EkigaAssistant *assistant)
-{
-  char **array;
-  gchar *audio_manager;
-
-  array = GnomeMeeting::Process ()->GetAudioPlugins ().ToCharArray ();
-  audio_manager = gm_conf_get_string (AUDIO_DEVICES_KEY "plugin");
-
-  update_combo_box (GTK_COMBO_BOX (assistant->priv->audio_manager),
-                    array, audio_manager);
-  free (array);
-}
-
-static void
-apply_audio_manager_page (EkigaAssistant *assistant)
-{
-  GtkComboBox *combo_box;
-  gchar *audio_manager;
-
-  combo_box = GTK_COMBO_BOX (assistant->priv->audio_manager);
-  audio_manager = gtk_combo_box_get_active_text (combo_box);
-  if (audio_manager) {
-    gm_conf_set_string (AUDIO_DEVICES_KEY "plugin", audio_manager);
-    g_free (audio_manager);
-  }
-}
 
 /**********************
  * Audio devices page *
@@ -702,7 +645,6 @@
 prepare_audio_devices_page (EkigaAssistant *assistant)
 {
   GMManager *manager;
-  gchar *audio_manager;
   gchar *player;
   gchar *recorder;
   PStringArray devices;
@@ -710,8 +652,6 @@
 
   manager = dynamic_cast<GMManager *> (assistant->priv->core->get ("opal-component"));
 
-  audio_manager = gtk_combo_box_get_active_text (GTK_COMBO_BOX (assistant->priv->audio_manager));
-
   player = gm_conf_get_string (AUDIO_DEVICES_KEY "output_device");
   recorder = gm_conf_get_string (AUDIO_DEVICES_KEY "input_device");
 
@@ -719,25 +659,18 @@
    * works only for the currently selected audio and video plugins,
    * not for a random one.
    */
-  gnomemeeting_sound_daemons_suspend ();
-
-  devices = PSoundChannel::GetDeviceNames (audio_manager, PSoundChannel::Player);
-  if (devices.GetSize () == 0)
-    devices += PString (_("No device found"));
+  std::vector <std::string> device_list;
 
-  array = devices.ToCharArray ();
+  get_audio_output_devices_list (assistant->priv->core, device_list);
+  array = convert_string_list(device_list);
   update_combo_box (GTK_COMBO_BOX (assistant->priv->audio_player), array, player);
-  free (array);
+  g_free (array);
 
-  devices = PSoundChannel::GetDeviceNames (audio_manager, PSoundChannel::Recorder);
-  if (devices.GetSize () == 0)
-    devices += PString (_("No device found"));
 
-  array = devices.ToCharArray ();
+  get_audio_input_devices_list (assistant->priv->core, device_list);
+  array = convert_string_list(device_list);
   update_combo_box (GTK_COMBO_BOX (assistant->priv->audio_recorder), array, player);
-  free (array);
-
-  gnomemeeting_sound_daemons_resume ();
+  g_free (array);
 
   g_free (player);
   g_free (recorder);
@@ -770,20 +703,20 @@
  **********************/
 
 static void
-create_video_manager_page (EkigaAssistant *assistant)
+create_video_devices_page (EkigaAssistant *assistant)
 {
   GtkWidget *vbox;
   GtkWidget *label;
   gchar *text;
 
-  vbox = create_page (assistant, _("Video manager"), GTK_ASSISTANT_PAGE_CONTENT);
+  vbox = create_page (assistant, _("Video input device"), GTK_ASSISTANT_PAGE_CONTENT);
 
-  label = gtk_label_new (_("Please choose your video manager:"));
+  label = gtk_label_new (_("Please choose your video input device:"));
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, FALSE, 0);
 
-  assistant->priv->video_manager = gtk_combo_box_new_text ();
-  gtk_box_pack_start (GTK_BOX (vbox), assistant->priv->video_manager, FALSE, FALSE, 0);
+  assistant->priv->video_device = gtk_combo_box_new_text ();
+  gtk_box_pack_start (GTK_BOX (vbox), assistant->priv->video_device, FALSE, FALSE, 0);
 
   label = gtk_label_new (NULL);
   text = g_strdup_printf ("<i>%s</i>", _("The video manager is the plugin that "
@@ -795,51 +728,133 @@
   gtk_misc_set_alignment (GTK_MISC (label), 0.0, 0.5);
   gtk_box_pack_start (GTK_BOX (vbox), label, FALSE, TRUE, 0);
 
-  assistant->priv->video_manager_page = vbox;
+  assistant->priv->video_devices_page = vbox;
   gtk_widget_show_all (vbox);
   gtk_assistant_set_page_complete (GTK_ASSISTANT (assistant), vbox, TRUE);
 }
 
+static void
+prepare_video_devices_page (EkigaAssistant *assistant)
+{
+  std::vector <std::string> device_list;
+  gchar** array;
+  gchar* current_plugin;
+
+  get_video_devices_list (assistant->priv->core, device_list);
+  array = convert_string_list (device_list);
+  current_plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "input_device");
+  update_combo_box (GTK_COMBO_BOX (assistant->priv->video_device),
+                    array, current_plugin);
+  g_free (array);
+}
+
+static void
+apply_video_devices_page (EkigaAssistant *assistant)
+{
+
+  GtkComboBox *combo_box;
+  gchar *video_device;
+
+  combo_box = GTK_COMBO_BOX (assistant->priv->video_device);
+  video_device = gtk_combo_box_get_active_text (combo_box);
+
+  if (video_device) {
+    gm_conf_set_string (VIDEO_DEVICES_KEY "input_device", video_device);
+    g_free (video_device);
+  }
+}
+
+
 // FIXME: duplicate to gm_prefs_window_get_video_devices_list
 void 
+get_audio_output_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & device_list)
+{
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+  Ekiga::AudioOutputDevice audiooutput_device;
+  std::vector <Ekiga::AudioOutputDevice> audiooutput_devices;
+
+  std::string device_string;
+  device_list.clear();
+
+  audiooutput_core->get_audiooutput_devices(audiooutput_devices);
+
+  for (std::vector<Ekiga::AudioOutputDevice>::iterator iter = audiooutput_devices.begin ();
+       iter != audiooutput_devices.end ();
+       iter++) {
+
+    audiooutput_device = (*iter);
+    device_string = audiooutput_device.type + "/" + audiooutput_device.source + "/" + audiooutput_device.device;
+    device_list.push_back(device_string);
+  }
+
+  if (device_list.size() == 0) {
+    device_string = _("No device found");
+      device_list.push_back(device_string);
+  }
+
+}
+
+
+void 
+get_audio_input_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & device_list)
+{
+  Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (core->get ("audioinput-core"));
+  Ekiga::AudioInputDevice audioinput_device;
+  std::vector <Ekiga::AudioInputDevice> audioinput_devices;
+
+  std::string device_string;
+  device_list.clear();
+
+  audioinput_core->get_audioinput_devices(audioinput_devices);
+
+  for (std::vector<Ekiga::AudioInputDevice>::iterator iter = audioinput_devices.begin ();
+       iter != audioinput_devices.end ();
+       iter++) {
+
+    audioinput_device = (*iter);
+    device_string = audioinput_device.type + "/" + audioinput_device.source + "/" + audioinput_device.device;
+    device_list.push_back(device_string);
+  }
+
+  if (device_list.size() == 0) {
+    device_string = _("No device found");
+      device_list.push_back(device_string);
+  }
+
+}
+
+
+void 
 get_video_devices_list (Ekiga::ServiceCore *core,
-                                        std::vector<std::string> & plugin_list,
                                         std::vector<std::string> & device_list)
 {
   Ekiga::VidInputCore *vidinput_core = dynamic_cast<Ekiga::VidInputCore *> (core->get ("vidinput-core"));
   std::vector <Ekiga::VidInputDevice> vidinput_devices;
   Ekiga::VidInputDevice vidinput_device;
 
-  vidinput_core->get_vidinput_devices(vidinput_devices);
-
-  std::string plugin_string;
   std::string device_string;
+  device_list.clear();
 
-  gchar *current_plugin = NULL;
-  current_plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
+  vidinput_core->get_vidinput_devices(vidinput_devices);
 
   for (std::vector<Ekiga::VidInputDevice>::iterator iter = vidinput_devices.begin ();
        iter != vidinput_devices.end ();
        iter++) {
 
     vidinput_device = (*iter);
-    plugin_string = vidinput_device.type + "/" + vidinput_device.source;
-    plugin_list.push_back(plugin_string);
-
-    if (current_plugin && plugin_string == current_plugin) {
-      device_string = vidinput_device.device;
-      device_list.push_back(device_string);
-    }
+    device_string = vidinput_device.type + "/" + vidinput_device.source + "/" + vidinput_device.device;
+    device_list.push_back(device_string);
   }
 
   if (device_list.size() == 0) {
     device_string = _("No device found");
       device_list.push_back(device_string);
   }
+}
 
-  g_free (current_plugin);
 
-}
 // FIXME: duplicate to gm_prefs_window_convert_string_list
 gchar**
 convert_string_list (const std::vector<std::string> & list)
@@ -855,40 +870,6 @@
   return array;
 }
 
-static void
-prepare_video_manager_page (EkigaAssistant *assistant)
-{
-  std::vector <std::string> plugin_list;
-  std::vector <std::string> device_list;
-  gchar** array;
-  gchar* current_plugin;
-
-  get_video_devices_list (assistant->priv->core, plugin_list, device_list);
-
-  array = convert_string_list (plugin_list);
-
-  current_plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
-
-  update_combo_box (GTK_COMBO_BOX (assistant->priv->video_manager),
-                    array, current_plugin);
-
-  g_free (array);
-}
-
-static void
-apply_video_manager_page (EkigaAssistant *assistant)
-{
-  GtkComboBox *combo_box;
-  gchar *video_manager;
-
-  combo_box = GTK_COMBO_BOX (assistant->priv->video_manager);
-  video_manager = gtk_combo_box_get_active_text (combo_box);
-  if (video_manager) {
-    gm_conf_set_string (VIDEO_DEVICES_KEY "plugin", video_manager);
-    g_free (video_manager);
-  }
-}
-
 /****************
  * Summary page *
  ****************/
@@ -983,20 +964,11 @@
     g_free (value);
   }
 
-  /* The audio manager */
-  gtk_list_store_append (model, &iter);
-  value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (assistant->priv->audio_manager));
-  gtk_list_store_set (model, &iter,
-                      SUMMARY_KEY_COLUMN, "Audio manager",
-                      SUMMARY_VALUE_COLUMN, value,
-                      -1);
-  g_free (value);
-
   /* The audio playing device */
   gtk_list_store_append (model, &iter);
   value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (assistant->priv->audio_player));
   gtk_list_store_set (model, &iter,
-                      SUMMARY_KEY_COLUMN, "Audio player",
+                      SUMMARY_KEY_COLUMN, "Audio output device",
                       SUMMARY_VALUE_COLUMN, value,
                       -1);
   g_free (value);
@@ -1005,16 +977,16 @@
   gtk_list_store_append (model, &iter);
   value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (assistant->priv->audio_recorder));
   gtk_list_store_set (model, &iter,
-                      SUMMARY_KEY_COLUMN, "Audio recorder",
+                      SUMMARY_KEY_COLUMN, "Audio input device",
                       SUMMARY_VALUE_COLUMN, value,
                       -1);
   g_free (value);
 
   /* The video manager */
   gtk_list_store_append (model, &iter);
-  value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (assistant->priv->video_manager));
+  value = gtk_combo_box_get_active_text (GTK_COMBO_BOX (assistant->priv->video_device));
   gtk_list_store_set (model, &iter,
-                      SUMMARY_KEY_COLUMN, "Video manager",
+                      SUMMARY_KEY_COLUMN, "Video input device",
                       SUMMARY_VALUE_COLUMN, value,
                       -1);
   g_free (value);
@@ -1060,9 +1032,8 @@
   create_personal_data_page (assistant);
   create_ekiga_net_page (assistant);
   create_connection_type_page (assistant);
-  create_audio_manager_page (assistant);
   create_audio_devices_page (assistant);
-  create_video_manager_page (assistant);
+  create_video_devices_page (assistant);
   create_summary_page (assistant);
 
   /* FIXME: what the hell is it needed for? */
@@ -1098,18 +1069,13 @@
     return;
   }
 
-  if (page == assistant->priv->audio_manager_page) {
-    prepare_audio_manager_page (assistant);
-    return;
-  }
-
   if (page == assistant->priv->audio_devices_page) {
     prepare_audio_devices_page (assistant);
     return;
   }
 
-  if (page == assistant->priv->video_manager_page) {
-    prepare_video_manager_page (assistant);
+  if (page == assistant->priv->video_devices_page) {
+    prepare_video_devices_page (assistant);
     return;
   }
 
@@ -1135,9 +1101,8 @@
   apply_personal_data_page (assistant);
   apply_ekiga_net_page (assistant);
   apply_connection_type_page (assistant);
-  apply_audio_manager_page (assistant);
   apply_audio_devices_page (assistant);
-  apply_video_manager_page (assistant);
+  apply_video_devices_page (assistant);
 
   manager = dynamic_cast<GMManager *> (assistant->priv->core->get ("opal-component"));
   main_window = GnomeMeeting::Process ()->GetMainWindow ();
@@ -1147,12 +1112,6 @@
   gtk_assistant_set_current_page (gtkassistant, 0);
   gnomemeeting_window_show (main_window);
 
-  /* Will be done through the config if the manager changes, but not
-     if the manager doesn't change */
-  gdk_threads_leave ();
-  GnomeMeeting::Process ()->DetectDevices ();
-  gdk_threads_enter ();
-
   /* Update the version number */
   gm_conf_set_int (GENERAL_KEY "version", schema_version);
 }

Modified: trunk/src/gui/conf.cpp
==============================================================================
--- trunk/src/gui/conf.cpp	(original)
+++ trunk/src/gui/conf.cpp	Thu Apr  3 07:16:45 2008
@@ -124,7 +124,7 @@
 {
   if (gm_conf_entry_get_type (entry) == GM_CONF_STRING) {
     gdk_threads_enter ();
-    GnomeMeeting::Process ()->DetectDevices ();
+//     GnomeMeeting::Process ()->DetectDevices (); //FIXME
     gdk_threads_leave ();
   }
 }

Modified: trunk/src/gui/main.cpp
==============================================================================
--- trunk/src/gui/main.cpp	(original)
+++ trunk/src/gui/main.cpp	Thu Apr  3 07:16:45 2008
@@ -47,7 +47,6 @@
 #include "callbacks.h"
 #include "statusicon.h"
 #include "dialpad.h"
-#include "audio.h"
 #include "urlhandler.h"
 #include "statusmenu.h"
 
@@ -92,6 +91,8 @@
 #include <libxml/parser.h>
 
 #include "vidinput-core.h"
+#include "audioinput-core.h"
+#include "audiooutput-core.h"
 
 #include "call-core.h"
 #include "gtk-frontend.h"
@@ -104,6 +105,8 @@
 {
   _GmMainWindow (Ekiga::ServiceCore & _core) : core (_core) { }
 
+  GtkWidget *input_signal;
+  GtkWidget *output_signal;
   GtkObject *adj_input_volume;
   GtkObject *adj_output_volume;
   GtkWidget *audio_volume_frame;
@@ -162,7 +165,7 @@
   std::string received_video_codec;
   std::string received_audio_codec;
   unsigned int timeout_id;
-
+  unsigned int levelmeter_timeout_id;
   Ekiga::Call *current_call;
   Ekiga::ServiceCore & core;
   std::vector<sigc::connection> connections;
@@ -288,6 +291,9 @@
 static void gm_main_window_hide_call_panel (GtkWidget *self);
 
 
+void
+gm_main_window_clear_signal_levels (GtkWidget *main_window);
+
 /* Callbacks */
 
 /* DESCRIPTION  :  This callback is called when the control panel 
@@ -600,8 +606,16 @@
                               Ekiga::Call & call,
                               gpointer self)
 {
-  if (!call.is_outgoing ())
+  GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
+
+  if (call.is_outgoing ()) {
+    audiooutput_core->start_play_event("ring_tone_sound", 3000, 256);
+  }
+  else {
+    audiooutput_core->start_play_event("incoming_call_sound", 3000, 256);
     gm_main_window_incoming_call_dialog_show (GTK_WIDGET (self), call);
+  }
 }
 
 
@@ -652,6 +666,19 @@
   return true;
 }
 
+static gboolean on_signal_level_refresh_cb (gpointer self) 
+{
+  gchar *msg = NULL;
+
+  GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
+
+  Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
+
+  gtk_levelmeter_set_level (GTK_LEVELMETER (mw->output_signal), audiooutput_core->get_average_level());
+  gtk_levelmeter_set_level (GTK_LEVELMETER (mw->input_signal), audioinput_core->get_average_level());
+  return true;
+}
 
 static void on_established_call_cb (Ekiga::CallManager & /*manager*/,
                                     Ekiga::Call & call,
@@ -673,6 +700,18 @@
   mw->current_call = &call;
 
   mw->timeout_id = g_timeout_add (1000, on_stats_refresh_cb, self);
+
+  Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
+
+  audiooutput_core->stop_play_event("incoming_call_sound");
+  audiooutput_core->stop_play_event("ring_tone_sound");
+
+  audioinput_core->start_average_collection();
+  audiooutput_core->start_average_collection();
+  mw->levelmeter_timeout_id = g_timeout_add_full (G_PRIORITY_DEFAULT_IDLE, 50, on_signal_level_refresh_cb, self, NULL);
+
+  // G_PRIORITY_HIGH ?
 }
 
 
@@ -703,12 +742,34 @@
     g_source_remove (mw->timeout_id);
     mw->timeout_id = -1;
   }
+  g_source_remove (mw->levelmeter_timeout_id);
+
+  Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
+
+  audiooutput_core->stop_play_event("incoming_call_sound");
+  audiooutput_core->stop_play_event("ring_tone_sound");
+
+  audioinput_core->stop_average_collection();
+  audiooutput_core->stop_average_collection();
+
+  gm_main_window_clear_signal_levels(GTK_WIDGET (self));
 }
 
 
 static void on_cleared_incoming_call_cb (std::string /*reason*/,
                                          gpointer self)
 {
+  GmMainWindow *mw = NULL;
+
+  GtkWidget *main_window = NULL;
+  
+  main_window = GnomeMeeting::Process ()->GetMainWindow ();
+  mw = gm_mw_get_mw (main_window);
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
+  audiooutput_core->stop_play_event("incoming_call_sound");
+  audiooutput_core->stop_play_event("ring_tone_sound");
+
   gtk_widget_destroy (GTK_WIDGET (self));
 }
 
@@ -750,6 +811,11 @@
                                gpointer self)
 {
   GmMainWindow *mw = gm_mw_get_mw (GTK_WIDGET (self));
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
+
+  audiooutput_core->stop_play_event("incoming_call_sound");
+  audiooutput_core->stop_play_event("ring_tone_sound");
+
   std::stringstream info;
 
   mw->missed_calls++;
@@ -932,12 +998,26 @@
 void
 on_vidinputdevice_opened_cb (Ekiga::VidInputManager & /* manager */,
                              Ekiga::VidInputDevice & /* vidinput_device */,
-                             Ekiga::VidInputConfig & /* vidinput_config */,
+                             Ekiga::VidInputConfig &  vidinput_config,
                              gpointer self)
 {
   gm_main_window_update_sensitivity (GTK_WIDGET (self), TRUE, FALSE, TRUE);
+
+  GmMainWindow *mw = NULL;
+  g_return_if_fail (self != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (self));
+  g_return_if_fail (mw != NULL);
+
+  GTK_ADJUSTMENT (mw->adj_whiteness)->value = vidinput_config.whiteness;
+  GTK_ADJUSTMENT (mw->adj_brightness)->value = vidinput_config.brightness;
+  GTK_ADJUSTMENT (mw->adj_colour)->value = vidinput_config.colour;
+  GTK_ADJUSTMENT (mw->adj_contrast)->value = vidinput_config.contrast;
+
+  gtk_widget_queue_draw (GTK_WIDGET (mw->video_settings_frame));
 }
 
+
+
 void 
 on_vidinputdevice_closed_cb (Ekiga::VidInputManager & /* manager */, Ekiga::VidInputDevice & /*vidinput_device*/, gpointer self)
 {
@@ -1002,6 +1082,70 @@
 }
 
 void
+on_audioinputdevice_opened_cb (Ekiga::AudioInputManager & /* manager */,
+                             Ekiga::AudioInputDevice & /* audioinput_device */,
+                             Ekiga::AudioInputConfig &  audioinput_config,
+                             gpointer self)
+{
+  GmMainWindow *mw = NULL;
+  g_return_if_fail (self != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (self));
+  g_return_if_fail (mw != NULL);
+
+  GTK_ADJUSTMENT (mw->adj_input_volume)->value = audioinput_config.volume;
+  
+  gtk_widget_queue_draw (GTK_WIDGET (mw->audio_volume_frame));
+}
+
+
+
+void 
+on_audioinputdevice_closed_cb (Ekiga::AudioInputManager & /* manager */, Ekiga::AudioInputDevice & /*audioinput_device*/, gpointer self)
+{
+}
+
+void 
+on_audioinputdevice_error_cb (Ekiga::AudioInputManager & /* manager */, 
+                            Ekiga::AudioInputDevice & audioinput_device, 
+                            Ekiga::AudioInputErrorCodes error_code, 
+                            gpointer self)
+{
+}
+
+void
+on_audiooutputdevice_opened_cb (Ekiga::AudioOutputManager & /* manager */,
+                             Ekiga::AudioOutputPrimarySecondary primarySecondary,
+                             Ekiga::AudioOutputDevice & /* audiooutput_device */,
+                             Ekiga::AudioOutputConfig &  audiooutput_config,
+                             gpointer self)
+{
+  GmMainWindow *mw = NULL;
+  g_return_if_fail (self != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (self));
+  g_return_if_fail (mw != NULL);
+
+  GTK_ADJUSTMENT (mw->adj_output_volume)->value = audiooutput_config.volume;
+
+  gtk_widget_queue_draw (GTK_WIDGET (mw->audio_volume_frame));
+}
+
+
+
+void 
+on_audiooutputdevice_closed_cb (Ekiga::AudioOutputManager & /* manager */, Ekiga::AudioOutputPrimarySecondary primarySecondary, Ekiga::AudioOutputDevice & /*audiooutput_device*/, gpointer self)
+{
+}
+
+void 
+on_audiooutputdevice_error_cb (Ekiga::AudioOutputManager & /* manager */, 
+                            Ekiga::AudioOutputPrimarySecondary primarySecondary,
+                            Ekiga::AudioOutputDevice & audiooutput_device, 
+                            Ekiga::AudioOutputErrorCodes error_code, 
+                            gpointer self)
+{
+}
+
+void
 on_logo_update_required_cb (Ekiga::DisplayManager & /* manager */, gpointer self)
 {
   gm_main_window_update_logo_have_window (GTK_WIDGET (self));
@@ -1685,6 +1829,9 @@
   gtk_scale_set_value_pos (GTK_SCALE (hscale_play), GTK_POS_RIGHT); 
   gtk_scale_set_draw_value (GTK_SCALE (hscale_play), FALSE);
   gtk_box_pack_start (GTK_BOX (small_vbox), hscale_play, TRUE, TRUE, 0);
+
+  mw->output_signal = gtk_levelmeter_new ();
+  gtk_box_pack_start (GTK_BOX (small_vbox), mw->output_signal, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (hbox), small_vbox, TRUE, TRUE, 2);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
 
@@ -1703,6 +1850,9 @@
   gtk_scale_set_value_pos (GTK_SCALE (hscale_rec), GTK_POS_RIGHT); 
   gtk_scale_set_draw_value (GTK_SCALE (hscale_rec), FALSE);
   gtk_box_pack_start (GTK_BOX (small_vbox), hscale_rec, TRUE, TRUE, 0);
+
+  mw->input_signal = gtk_levelmeter_new ();
+  gtk_box_pack_start (GTK_BOX (small_vbox), mw->input_signal, TRUE, TRUE, 0);
   gtk_box_pack_start (GTK_BOX (hbox), small_vbox, TRUE, TRUE, 2);
   gtk_box_pack_start (GTK_BOX (vbox), hbox, FALSE, FALSE, 3);
 
@@ -2264,83 +2414,36 @@
 
 
 static void 
-audio_volume_changed_cb (G_GNUC_UNUSED GtkAdjustment *adjustment,
-			 G_GNUC_UNUSED gpointer data)
+audio_volume_changed_cb (GtkAdjustment * /*adjustment*/,
+			 gpointer data)
 {
-  /*
-  GMManager *ep = NULL;
-  GMPCSSEndpoint *pcssEP = NULL;
-
-  bool success = FALSE;
-
-  int play_vol = 0; 
-  int rec_vol = 0;
-
+  GmMainWindow *mw = NULL;
   g_return_if_fail (data != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (data));
 
-  ep = GnomeMeeting::Process ()->GetManager ();
-  pcssEP = ep->GetPCSSEndpoint ();
-
-  gm_main_window_get_volume_sliders_values (GTK_WIDGET (data), 
-					    play_vol, rec_vol);
-
-  gdk_threads_leave ();
-  success = pcssEP->SetDeviceVolume (play_vol, rec_vol);
-  gdk_threads_enter ();
-
-  if (!success)
-    gm_main_window_set_volume_sliders_values (GTK_WIDGET (data), 0, 0);
-    */
+  Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
 
-  std::cout << "should be fixed" << std::endl << std::flush;
+  audiooutput_core->set_volume(Ekiga::primary, (unsigned)GTK_ADJUSTMENT (mw->adj_output_volume)->value);
+//  audioinput_core->set_volume((unsigned)GTK_ADJUSTMENT (mw->adj_input_volume)->value); //FIXME
 }
 
 
 static void 
-video_settings_changed_cb (G_GNUC_UNUSED GtkAdjustment *adjustment,
-			   G_GNUC_UNUSED gpointer data)
+video_settings_changed_cb (GtkAdjustment * /*adjustment*/,
+			   gpointer data)
 { 
-/*  GMManager *ep = NULL;
-
-  bool success = FALSE;
-
-  int brightness = -1;
-  int whiteness = -1;
-  int colour = -1;
-  int contrast = -1;
-
+  GmMainWindow *mw = NULL;
   g_return_if_fail (data != NULL);
+  mw = gm_mw_get_mw (GTK_WIDGET (data));
+  g_return_if_fail (mw != NULL);
 
-  ep = GnomeMeeting::Process ()->GetManager ();
-
-  gm_main_window_get_video_sliders_values (GTK_WIDGET (data),
-					   whiteness,
-					   brightness,
-					   colour,
-					   contrast);
-*/
-  /* Notice about mutexes:
-     The GDK lock is taken in the callback. We need to release it, because
-     if CreateVideoGrabber is called in another thread, it will only
-     release its internal mutex (also used by GetVideoGrabber) after it 
-     returns, but it will return only if it is opened, and it can't open 
-     if the GDK lock is held as it will wait on the GDK lock before 
-     updating the GUI */
-/*  gdk_threads_leave ();
-    if (whiteness > 0)
-      success = video_grabber->SetWhiteness (whiteness << 8);
-    if (brightness > 0)
-      success = video_grabber->SetBrightness (brightness << 8) || success;
-    if (colour > 0)
-      success = video_grabber->SetColour (colour << 8) || success;
-    if (contrast > 0)
-      success = video_grabber->SetContrast (contrast << 8) || success;
-
-  gdk_threads_enter ();
+  Ekiga::VidInputCore *vidinput_core = dynamic_cast<Ekiga::VidInputCore *> (mw->core.get ("vidinput-core"));
 
-  if (!success)
-    gm_main_window_set_video_sliders_values (GTK_WIDGET (data), 0, 0, 0, 0); */
-  std::cout << "should be fixed" << std::endl << std::flush;
+  vidinput_core->set_whiteness ((unsigned) GTK_ADJUSTMENT (mw->adj_whiteness)->value);
+  vidinput_core->set_brightness ((unsigned) GTK_ADJUSTMENT (mw->adj_brightness)->value);
+  vidinput_core->set_colour ((unsigned) GTK_ADJUSTMENT (mw->adj_colour)->value);
+  vidinput_core->set_contrast ((unsigned) GTK_ADJUSTMENT (mw->adj_contrast)->value);
 }
 
 
@@ -3106,6 +3209,21 @@
     gdk_window_set_cursor (GTK_WIDGET (main_window)->window, NULL);
 }
 
+void
+gm_main_window_clear_signal_levels (GtkWidget *main_window)
+{
+  GmMainWindow *mw = NULL;
+
+  g_return_if_fail (main_window != NULL);
+
+  mw = gm_mw_get_mw (main_window);
+
+  g_return_if_fail (mw != NULL);
+
+  gtk_levelmeter_clear (GTK_LEVELMETER (mw->output_signal));
+  gtk_levelmeter_clear (GTK_LEVELMETER (mw->input_signal));
+}
+
 
 void
 gm_main_window_set_volume_sliders_values (GtkWidget *main_window,
@@ -3179,26 +3297,6 @@
 }
 
 
-void
-gm_main_window_get_video_sliders_values (GtkWidget *main_window,
-					 int &whiteness, 
-					 int &brightness,
-					 int &colour,
-					 int &contrast)
-{
-  GmMainWindow *mw = NULL;
-
-  g_return_if_fail (main_window != NULL);
-
-  mw = gm_mw_get_mw (main_window);
-
-  g_return_if_fail (mw != NULL);
-
-  whiteness = (int) GTK_ADJUSTMENT (mw->adj_whiteness)->value;
-  brightness = (int) GTK_ADJUSTMENT (mw->adj_brightness)->value;
-  colour = (int) GTK_ADJUSTMENT (mw->adj_colour)->value;
-  contrast = (int) GTK_ADJUSTMENT (mw->adj_contrast)->value;
-}
 
 
 void 
@@ -3546,6 +3644,7 @@
   mw->transfer_call_popup = NULL;
   mw->current_call = NULL;
   mw->timeout_id = -1;
+  mw->levelmeter_timeout_id = -1;
   mw->x = 0;
   mw->y = 0;
   mw->missed_calls = mw->total_mwi = 0;
@@ -3705,6 +3804,30 @@
   conn = vidinput_core->vidinputdevice_error.connect (sigc::bind (sigc::ptr_fun (on_vidinputdevice_error_cb), (gpointer) window));
   mw->connections.push_back (conn);
 
+  /* New AudioInput Engine signals */
+  Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (mw->core.get ("audioinput-core"));
+
+  conn = audioinput_core->audioinputdevice_opened.connect (sigc::bind (sigc::ptr_fun (on_audioinputdevice_opened_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = audioinput_core->audioinputdevice_closed.connect (sigc::bind (sigc::ptr_fun (on_audioinputdevice_closed_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = audioinput_core->audioinputdevice_error.connect (sigc::bind (sigc::ptr_fun (on_audioinputdevice_error_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  /* New AudioOutput Engine signals */
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (mw->core.get ("audiooutput-core"));
+
+  conn = audiooutput_core->audiooutputdevice_opened.connect (sigc::bind (sigc::ptr_fun (on_audiooutputdevice_opened_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = audiooutput_core->audiooutputdevice_closed.connect (sigc::bind (sigc::ptr_fun (on_audiooutputdevice_closed_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+
+  conn = audiooutput_core->audiooutputdevice_error.connect (sigc::bind (sigc::ptr_fun (on_audiooutputdevice_error_cb), (gpointer) window));
+  mw->connections.push_back (conn);
+    
   /* New Call Engine signals */
   Ekiga::CallCore *call_core = dynamic_cast<Ekiga::CallCore *> (mw->core.get ("call-core"));
 
@@ -4168,10 +4291,6 @@
 
   GnomeMeeting::Process ()->InitEngine ();
   GnomeMeeting::Process ()->DetectInterfaces ();
-  if (!GnomeMeeting::Process ()->DetectCodecs ()) 
-    error = 2;
-  if (!GnomeMeeting::Process ()->DetectDevices ()) 
-    error = 1;
   GnomeMeeting::Process ()->BuildGUI ();
   
   /* Add depreciated notifiers */

Modified: trunk/src/gui/preferences.cpp
==============================================================================
--- trunk/src/gui/preferences.cpp	(original)
+++ trunk/src/gui/preferences.cpp	Thu Apr  3 07:16:45 2008
@@ -1,4 +1,4 @@
-
+ 
 /* Ekiga -- A VoIP and Video-Conferencing application
  * Copyright (C) 2000-2006 Damien Sandras
  *
@@ -45,7 +45,6 @@
 #include "h323.h"
 #include "sip.h"
 #include "ekiga.h"
-#include "audio.h"
 #include "misc.h"
 #include "urlhandler.h"
 #include "callbacks.h"
@@ -312,7 +311,19 @@
 static void audioev_filename_browse_play_cb (GtkWidget *playbutton,
                                              gpointer data);
 
+void 
+gm_prefs_window_get_audio_output_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & device_list);
+
+void 
+gm_prefs_window_get_audio_input_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & device_list);
 
+gchar**
+gm_prefs_window_convert_string_list (const std::vector<std::string> & list);
+
+void 
+gm_prefs_window_update_devices_list (GtkWidget *prefs_window);
 
 /* Implementation */
 static void
@@ -345,7 +356,7 @@
 {
   GtkWidget *alignment = NULL;
   GtkWidget *image = NULL;
-  GtkWidget *button = NULL;                                                    
+  GtkWidget *button = NULL;
 
 
   /* Update Button */
@@ -358,13 +369,13 @@
 
   gtk_box_pack_start (GTK_BOX (box), alignment, TRUE, TRUE, 0);
 
-  g_signal_connect (G_OBJECT (button), "clicked",                          
+  g_signal_connect (G_OBJECT (button), "clicked",
                     G_CALLBACK (func), 
                     (gpointer) data);
 
 
-  return button;                                                               
-}                                                                              
+  return button;
+}
 
 
 static void
@@ -392,7 +403,7 @@
 
   /* Add the update button */
   gm_pw_add_update_button (prefs_window, container, GTK_STOCK_APPLY, _("_Apply"), GTK_SIGNAL_FUNC (personal_data_update_cb), _("Click here to update the users directory you are registered to with the new First Name, Last Name, E-Mail, Comment and Location"), 0, prefs_window);
-}                                                                              
+}
 
 
 static void
@@ -474,8 +485,6 @@
 
   PStringArray devs;
 
-  gchar **array = NULL;
-
   pw = gm_pw_get_pw (prefs_window);
 
   subsection = gnome_prefs_subsection_new (prefs_window, container,
@@ -602,18 +611,6 @@
   /* Place it after the signals so that we can make sure they are run if
      required */
   gm_prefs_window_sound_events_list_build (prefs_window);
-
-
-  /* The audio output */
-  subsection = gnome_prefs_subsection_new (prefs_window, container,
-                                           _("Alternative Output Device"), 
-                                           1, 1);
-
-  devs = GnomeMeeting::Process ()->GetAudioOutpoutDevices ();
-  array = devs.ToCharArray ();
-  pw->sound_events_output =
-    gnome_prefs_string_option_menu_new (subsection, _("Alternative output device:"), (const gchar **)array, SOUND_EVENTS_KEY "output_device", _("Select an alternative audio output device to use for sound events"), 0);
-  free (array);
 }
 
 
@@ -769,71 +766,82 @@
 
   pw = gm_pw_get_pw (prefs_window);
 
-
-  subsection = gnome_prefs_subsection_new (prefs_window, container,
-                                           _("Audio Plugin"), 1, 2);
-
-  /* Add all the fields for the audio manager */
-  devs = GnomeMeeting::Process ()->GetAudioPlugins ();
-  array = devs.ToCharArray ();
-  gnome_prefs_string_option_menu_new (subsection, _("Audio plugin:"), (const gchar **)array, AUDIO_DEVICES_KEY "plugin", _("The audio plugin that will be used to detect the devices and manage them."), 0);
-  free (array);
-
-
   /* Add all the fields */
   subsection = gnome_prefs_subsection_new (prefs_window, container,
-                                           _("Audio Devices"), 4, 2);
+                                           _("Audio Devices"), 4, 3);
 
+  /* Add all the fields for the audio manager */
+  std::vector <std::string> device_list;
 
-  /* The player */
-  devs = GnomeMeeting::Process ()->GetAudioOutpoutDevices ();
-  array = devs.ToCharArray ();
+  gm_prefs_window_get_audio_output_devices_list (pw->core, device_list);
+  array = gm_prefs_window_convert_string_list(device_list);
+  pw->sound_events_output = 
+    gnome_prefs_string_option_menu_new (subsection, _("Ringing Device"), (const gchar **)array, SOUND_EVENTS_KEY "output_device", _("Select the ringing audio device to use"), 0);
   pw->audio_player =
-    gnome_prefs_string_option_menu_new (subsection, _("Output device:"), (const gchar **)array, AUDIO_DEVICES_KEY "output_device", _("Select the audio output device to use"), 0);
-  free (array);
+    gnome_prefs_string_option_menu_new (subsection, _("Output device:"), (const gchar **)array, AUDIO_DEVICES_KEY "output_device", _("Select the audio output device to use"), 1);
+  g_free (array);
 
   /* The recorder */
-  devs = GnomeMeeting::Process ()->GetAudioInputDevices ();
-  array = devs.ToCharArray ();
+  gm_prefs_window_get_audio_input_devices_list (pw->core, device_list);
+  array = gm_prefs_window_convert_string_list(device_list);
   pw->audio_recorder =
     gnome_prefs_string_option_menu_new (subsection, _("Input device:"), (const gchar **)array, AUDIO_DEVICES_KEY "input_device", _("Select the audio input device to use"), 2);
-  free (array);
+  g_free (array);
 
 
   /* That button will refresh the device list */
-  gm_pw_add_update_button (prefs_window, container, GTK_STOCK_REFRESH, _("_Detect devices"), GTK_SIGNAL_FUNC (refresh_devices_list_cb), _("Click here to refresh the device list."), 1, NULL);
+  gm_pw_add_update_button (prefs_window, container, GTK_STOCK_REFRESH, _("_Detect devices"), GTK_SIGNAL_FUNC (refresh_devices_list_cb), _("Click here to refresh the device list."), 1, prefs_window);
 }
 
 
 void 
 gm_prefs_window_get_video_devices_list (Ekiga::ServiceCore *core,
-                                        std::vector<std::string> & plugin_list,
                                         std::vector<std::string> & device_list)
 {
   Ekiga::VidInputCore *vidinput_core = dynamic_cast<Ekiga::VidInputCore *> (core->get ("vidinput-core"));
   std::vector <Ekiga::VidInputDevice> vidinput_devices;
   Ekiga::VidInputDevice vidinput_device;
 
-  vidinput_core->get_vidinput_devices(vidinput_devices);
-
-  std::string plugin_string;
   std::string device_string;
+  device_list.clear();
 
-  gchar *current_plugin = NULL;
-  current_plugin = gm_conf_get_string (VIDEO_DEVICES_KEY "plugin");
+  vidinput_core->get_vidinput_devices(vidinput_devices);
 
   for (std::vector<Ekiga::VidInputDevice>::iterator iter = vidinput_devices.begin ();
        iter != vidinput_devices.end ();
        iter++) {
 
     vidinput_device = (*iter);
-    plugin_string = vidinput_device.type + "/" + vidinput_device.source;
-    plugin_list.push_back(plugin_string);
+    device_string = vidinput_device.type + "/" + vidinput_device.source + "/" + vidinput_device.device;
+    device_list.push_back(device_string);
+  }
 
-    if (current_plugin && plugin_string == current_plugin) {
-      device_string = vidinput_device.device;
+  if (device_list.size() == 0) {
+    device_string = _("No device found");
       device_list.push_back(device_string);
-    }
+  }
+}
+
+void 
+gm_prefs_window_get_audio_output_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & device_list)
+{
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+  Ekiga::AudioOutputDevice audiooutput_device;
+  std::vector <Ekiga::AudioOutputDevice> audiooutput_devices;
+
+  std::string device_string;
+  device_list.clear();
+
+  audiooutput_core->get_audiooutput_devices(audiooutput_devices);
+
+  for (std::vector<Ekiga::AudioOutputDevice>::iterator iter = audiooutput_devices.begin ();
+       iter != audiooutput_devices.end ();
+       iter++) {
+
+    audiooutput_device = (*iter);
+    device_string = audiooutput_device.type + "/" + audiooutput_device.source + "/" + audiooutput_device.device;
+    device_list.push_back(device_string);
   }
 
   if (device_list.size() == 0) {
@@ -841,9 +849,39 @@
       device_list.push_back(device_string);
   }
 
-  g_free (current_plugin);
 }
 
+
+void 
+gm_prefs_window_get_audio_input_devices_list (Ekiga::ServiceCore *core,
+                                        std::vector<std::string> & device_list)
+{
+  Ekiga::AudioInputCore *audioinput_core = dynamic_cast<Ekiga::AudioInputCore *> (core->get ("audioinput-core"));
+  Ekiga::AudioInputDevice audioinput_device;
+  std::vector <Ekiga::AudioInputDevice> audioinput_devices;
+
+  std::string device_string;
+  device_list.clear();
+
+  audioinput_core->get_audioinput_devices(audioinput_devices);
+
+  for (std::vector<Ekiga::AudioInputDevice>::iterator iter = audioinput_devices.begin ();
+       iter != audioinput_devices.end ();
+       iter++) {
+
+    audioinput_device = (*iter);
+    device_string = audioinput_device.type + "/" + audioinput_device.source + "/" + audioinput_device.device;
+    device_list.push_back(device_string);
+  }
+
+  if (device_list.size() == 0) {
+    device_string = _("No device found");
+      device_list.push_back(device_string);
+  }
+
+}
+
+
 gchar**
 gm_prefs_window_convert_string_list (const std::vector<std::string> & list)
 {
@@ -901,20 +939,8 @@
   pw = gm_pw_get_pw (prefs_window); 
 
 
-  /* The video manager */
-  subsection = gnome_prefs_subsection_new (prefs_window, container,
-                                           _("Video Plugin"), 1, 2);
-
-  std::vector <std::string> plugin_list;
   std::vector <std::string> device_list;
 
-  gm_prefs_window_get_video_devices_list (pw->core, plugin_list, device_list);
-
-  array = gm_prefs_window_convert_string_list(plugin_list);
-
-  gnome_prefs_string_option_menu_new (subsection, _("Video plugin:"), (const gchar **)array, VIDEO_DEVICES_KEY "plugin", _("The video plugin that will be used to detect the devices and manage them"), 0);
-
-  g_free (array);
 
   /* The video devices related options */
   subsection = gnome_prefs_subsection_new (prefs_window, container,
@@ -922,14 +948,12 @@
 
   /* The video device */
 
+  gm_prefs_window_get_video_devices_list (pw->core, device_list);
   array = gm_prefs_window_convert_string_list(device_list);
-
   pw->video_device =
     gnome_prefs_string_option_menu_new (subsection, _("Input device:"), (const gchar **)array, VIDEO_DEVICES_KEY "input_device", _("Select the video input device to use. If an error occurs when using this device a test picture will be transmitted."), 0);
-
   g_free (array);
 
-
   /* Video Channel */
   gnome_prefs_spin_new (subsection, _("Channel:"), VIDEO_DEVICES_KEY "channel", _("The video channel number to use (to select camera, tv or other sources)"), 0.0, 10.0, 1.0, 3, NULL, false);
 
@@ -991,7 +1015,7 @@
                           (gpointer) VIDEO_DEVICES_KEY "image");
 
   /* That button will refresh the device list */
-  gm_pw_add_update_button (prefs_window, container, GTK_STOCK_REFRESH, _("_Detect devices"), GTK_SIGNAL_FUNC (refresh_devices_list_cb), _("Click here to refresh the device list."), 1, NULL);
+  gm_pw_add_update_button (prefs_window, container, GTK_STOCK_REFRESH, _("_Detect devices"), GTK_SIGNAL_FUNC (refresh_devices_list_cb), _("Click here to refresh the device list."), 1, prefs_window);
 
   for (i=0; i< NB_VIDEO_SIZES; i++) {
 
@@ -1078,9 +1102,13 @@
 /* GTK Callbacks */
 static void
 refresh_devices_list_cb (G_GNUC_UNUSED GtkWidget *widget,
-			 G_GNUC_UNUSED gpointer data)
+			 gpointer data)
 {
-  GnomeMeeting::Process ()->DetectDevices ();
+  g_return_if_fail (data != NULL);
+  GtkWidget *prefs_window = GTK_WIDGET (data);
+
+  gm_prefs_window_update_devices_list(prefs_window);
+
 }
 
 
@@ -1228,14 +1256,17 @@
 sound_event_play_cb (G_GNUC_UNUSED GtkWidget *widget,
 		     gpointer data)
 {
-  PString event;
-  
   g_return_if_fail (data != NULL);
 
-  event = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (data));
+  //FIXME
+  Ekiga::ServiceCore *core = GnomeMeeting::Process ()->GetServiceCore (); 
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+
+  gchar* file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (data));
+  std::string file_name_string = file_name;
+  audiooutput_core->play_file(file_name_string);
 
-  if (!event.IsEmpty ())
-    GMSoundEvent ev(event);
+  g_free (file_name);
 }
 
 
@@ -1307,19 +1338,21 @@
 
 
 static void
-audioev_filename_browse_play_cb (G_GNUC_UNUSED GtkWidget *playbutton,
+audioev_filename_browse_play_cb (GtkWidget* /* playbutton */,
 				 gpointer data)
 {
-  char *filename = NULL;
-
   g_return_if_fail (data != NULL);
 
-  filename = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (data));
-
-  if (filename)
-    GMSoundEvent ev((const char*) filename);
+  //FIXME
+  Ekiga::ServiceCore *core = GnomeMeeting::Process ()->GetServiceCore (); 
+  Ekiga::AudioOutputCore *audiooutput_core = dynamic_cast<Ekiga::AudioOutputCore *> (core->get ("audiooutput-core"));
+
+  gchar* file_name = gtk_file_chooser_get_filename (GTK_FILE_CHOOSER (data));
+  std::string file_name_string = file_name;
+  audiooutput_core->play_file(file_name_string);
+//FIXME: play_wav
 
-  g_free (filename);
+   g_free (file_name);
 }
 
 
@@ -1346,50 +1379,42 @@
 }
 
 void 
-gm_prefs_window_update_devices_list (GtkWidget *prefs_window, 
-				     PStringArray audio_input_devices,
-				     PStringArray audio_output_devices)
+gm_prefs_window_update_devices_list (GtkWidget *prefs_window)
 {
   GmPreferencesWindow *pw = NULL;
-
   gchar **array = NULL;
 
-
   g_return_if_fail (prefs_window != NULL);
   pw = gm_pw_get_pw (prefs_window);
 
+  std::vector <std::string> device_list;
 
   /* The player */
-  array = audio_output_devices.ToCharArray ();
+  gm_prefs_window_get_audio_output_devices_list (pw->core, device_list);
+  array = gm_prefs_window_convert_string_list(device_list);
   gnome_prefs_string_option_menu_update (pw->audio_player,
-					 (const gchar **)array,
-					 AUDIO_DEVICES_KEY "output_device");
-  gnome_prefs_string_option_menu_update (pw->sound_events_output,
-					 (const gchar **)array,
-					 SOUND_EVENTS_KEY "output_device");
-  free (array);
-
+ 					 (const gchar **)array,
+ 					 AUDIO_DEVICES_KEY "output_device");
+   gnome_prefs_string_option_menu_update (pw->sound_events_output,
+ 					 (const gchar **)array,
+ 					 SOUND_EVENTS_KEY "output_device");
+  g_free (array);
 
   /* The recorder */
-  array = audio_input_devices.ToCharArray ();
+  gm_prefs_window_get_audio_input_devices_list (pw->core, device_list);
+  array = gm_prefs_window_convert_string_list(device_list);
   gnome_prefs_string_option_menu_update (pw->audio_recorder,
-					 (const gchar **)array,
-					 AUDIO_DEVICES_KEY "input_device");
-  free (array);
+ 					 (const gchar **)array,
+ 					 AUDIO_DEVICES_KEY "input_device");
+  g_free (array);
 
 
   /* The Video player */
-  std::vector <std::string> plugin_list;
-  std::vector <std::string> device_list;
-
-  gm_prefs_window_get_video_devices_list (pw->core, plugin_list, device_list);
-
+  gm_prefs_window_get_video_devices_list (pw->core,  device_list);
   array = gm_prefs_window_convert_string_list(device_list);
-
   gnome_prefs_string_option_menu_update (pw->video_device,
 					 (const gchar **)array,
 					 VIDEO_DEVICES_KEY "input_device");
-
   g_free (array);
 }
 

Modified: trunk/src/gui/preferences.h
==============================================================================
--- trunk/src/gui/preferences.h	(original)
+++ trunk/src/gui/preferences.h	Thu Apr  3 07:16:45 2008
@@ -43,7 +43,8 @@
 #include "common.h"
 #include "framework/services.h"
 #include "vidinput-core.h"
-
+#include "audioinput-core.h"
+#include "audiooutput-core.h"
 
 /* DESCRIPTION  :  /
  * BEHAVIOR     :  Refreshes the interfaces list in the GUI to update them from
@@ -53,16 +54,6 @@
 void gm_prefs_window_update_interfaces_list (GtkWidget *prefs_window,
 					     PStringArray interfaces);
 
-/* DESCRIPTION  :  /
- * BEHAVIOR     :  Refreshes the devices list in the GUI to update them from
- *                 the GnomeMeeting available devices list.
- * PRE          :  The prefs window GMObject, the audio input devices list,
- * 		   the audio output devices list, the video input devices list.
- */
-void gm_prefs_window_update_devices_list (GtkWidget *prefs_window,
-					  PStringArray audio_input_devices,
-					  PStringArray audio_output_devices);
-
 
 /* DESCRIPTION  :  / 
  * BEHAVIOR     :  Builds the sound events list of the preferences window. 



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