ekiga r5910 - in trunk: . src/endpoints
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r5910 - in trunk: . src/endpoints
- Date: Sun, 13 Jan 2008 18:56:33 +0000 (GMT)
Author: dsandras
Date: Sun Jan 13 18:56:32 2008
New Revision: 5910
URL: http://svn.gnome.org/viewvc/ekiga?rev=5910&view=rev
Log:
Have a much saner initialization process for the codecs, based on the
GmConfBridge.
Modified:
trunk/ChangeLog
trunk/src/endpoints/manager.cpp
trunk/src/endpoints/manager.h
trunk/src/endpoints/opal-gmconf-bridge.cpp
Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp (original)
+++ trunk/src/endpoints/manager.cpp Sun Jan 13 18:56:32 2008
@@ -225,62 +225,6 @@
static void
-audio_codecs_list_changed_nt (G_GNUC_UNUSED gpointer id,
- GmConfEntry *entry,
- gpointer data)
-{
- GMManager *ep = (GMManager *) data;
-
- if (gm_conf_entry_get_type (entry) == GM_CONF_LIST) {
-
- Ekiga::CodecList list;
- Ekiga::CodecList video_list;
- GSList *audio_codecs_config = gm_conf_entry_get_list (entry);
- GSList *video_codecs_config = gm_conf_get_string_list (VIDEO_CODECS_KEY "list");
-
- list = Ekiga::CodecList (audio_codecs_config);
- video_list = Ekiga::CodecList (video_codecs_config);
- list.insert (list.end (), video_list.begin (), video_list.end ());
-
- ep->set_codecs (list);
-
- g_slist_free (audio_codecs_config);
-
- g_slist_foreach (video_codecs_config, (GFunc) g_free, NULL);
- g_slist_free (video_codecs_config);
- }
-}
-
-
-static void
-video_codecs_list_changed_nt (G_GNUC_UNUSED gpointer id,
- GmConfEntry *entry,
- gpointer data)
-{
- GMManager *ep = (GMManager *) data;
-
- if (gm_conf_entry_get_type (entry) == GM_CONF_LIST) {
-
- Ekiga::CodecList list;
- Ekiga::CodecList video_list;
- GSList *video_codecs_config = gm_conf_entry_get_list (entry);
- GSList *audio_codecs_config = gm_conf_get_string_list (AUDIO_CODECS_KEY "list");
-
- list = Ekiga::CodecList (audio_codecs_config);
- video_list = Ekiga::CodecList (video_codecs_config);
- list.insert (list.end (), video_list.begin (), video_list.end ());
-
- ep->set_codecs (list);
-
- g_slist_free (video_codecs_config);
-
- g_slist_foreach (audio_codecs_config, (GFunc) g_free, NULL);
- g_slist_free (audio_codecs_config);
- }
-}
-
-
-static void
jitter_buffer_changed_nt (G_GNUC_UNUSED gpointer id,
GmConfEntry *entry,
gpointer data)
@@ -432,15 +376,7 @@
video_option_changed_nt, this);
gm_conf_notifier_trigger (VIDEO_CODECS_KEY "maximum_video_rx_bitrate");
- // Set Codecs from the Configuration
- detect_codecs ();
- gm_conf_notifier_add (AUDIO_CODECS_KEY "list",
- audio_codecs_list_changed_nt, this);
- gm_conf_notifier_trigger (AUDIO_CODECS_KEY "list");
-
- gm_conf_notifier_add (VIDEO_CODECS_KEY "list",
- video_codecs_list_changed_nt, this);
- gm_conf_notifier_trigger (VIDEO_CODECS_KEY "list");
+
// The jitter
gm_conf_notifier_add (AUDIO_CODECS_KEY "minimum_jitter_buffer",
@@ -912,57 +848,11 @@
Ekiga::CodecList GMManager::get_codecs ()
{
- GSList *codecs_config = NULL;
-
- Ekiga::CodecList all_codecs;
- Ekiga::CodecList config_codecs;
- Ekiga::CodecList video_config_codecs;
-
- OpalMediaFormatList full_list;
-
- // Build the Ekiga::CodecList from the available OpalMediaFormats
- GetAllowedFormats (full_list);
- all_codecs = Opal::CodecList (full_list);
-
- // Build the Ekiga::CodecList from the configuration
- codecs_config = gm_conf_get_string_list (AUDIO_CODECS_KEY "list");
- config_codecs = Ekiga::CodecList (codecs_config);
- g_slist_foreach (codecs_config, (GFunc) g_free, NULL);
- g_slist_free (codecs_config);
-
- codecs_config = gm_conf_get_string_list (VIDEO_CODECS_KEY "list");
- video_config_codecs = Ekiga::CodecList (codecs_config);
- config_codecs.insert (config_codecs.end (), video_config_codecs.begin (), video_config_codecs.end ());
- g_slist_foreach (codecs_config, (GFunc) g_free, NULL);
- g_slist_free (codecs_config);
-
- // Finally build the Ekiga::CodecList taken into account by the GMManager
- // It contains codecs from the configuration and other disabled codecs
- for (Ekiga::CodecList::iterator it = all_codecs.begin ();
- it != all_codecs.end ();
- it++) {
-
- Ekiga::CodecList::iterator i = search_n (config_codecs.begin (), config_codecs.end (), 1, *it, same_codec_desc);
- if (i == config_codecs.end ()) {
- config_codecs.push_back (*it);
- }
- }
-
- // Remove unsupported codecs
- for (Ekiga::CodecList::iterator it = config_codecs.begin ();
- it != config_codecs.end ();
- it++) {
-
- Ekiga::CodecList::iterator i = search_n (all_codecs.begin (), all_codecs.end (), 1, *it, same_codec_desc);
- if (i == config_codecs.end ())
- config_codecs.erase (it);
- }
-
- return config_codecs;
+ return codecs;
}
-void GMManager::set_codecs (Ekiga::CodecList _codecs)
+void GMManager::set_codecs (Ekiga::CodecList & _codecs)
{
PStringArray initial_order;
PStringArray initial_mask;
@@ -973,11 +863,46 @@
PStringArray order;
PStringArray mask;
+ // What do we support
+ GetAllowedFormats (all_media_formats);
+ Ekiga::CodecList all_codecs = Opal::CodecList (all_media_formats);
+
+ //
+ // Clean the CodecList given as paramenter : remove unsupported codecs and
+ // add missing codecs at the end of the list
+ //
+
+ // Build the Ekiga::CodecList taken into account by the GMManager
+ // It contains codecs given as argument to set_codecs, and other codecs
+ // supported by the manager
+ for (Ekiga::CodecList::iterator it = all_codecs.begin ();
+ it != all_codecs.end ();
+ it++) {
+
+ Ekiga::CodecList::iterator i =
+ search_n (_codecs.begin (), _codecs.end (), 1, *it, same_codec_desc);
+ if (i == _codecs.end ()) {
+ _codecs.push_back (*it);
+ }
+ }
+
+ // Remove unsupported codecs
+ for (Ekiga::CodecList::iterator it = _codecs.begin ();
+ it != _codecs.end ();
+ it++) {
+
+ Ekiga::CodecList::iterator i =
+ search_n (all_codecs.begin (), all_codecs.end (), 1, *it, same_codec_desc);
+ if (i == _codecs.end ())
+ _codecs.erase (it);
+ }
codecs = _codecs;
- GetAllowedFormats (all_media_formats);
+
+ //
+ // Update OPAL
+ //
- // Build order
Ekiga::CodecList::iterator codecs_it;
for (codecs_it = codecs.begin () ;
codecs_it != codecs.end () ;
@@ -1919,32 +1844,6 @@
}
-void GMManager::detect_codecs ()
-{
- Ekiga::CodecList gcodecs = get_codecs ();
- GSList *audio_codecs_list = NULL;
- GSList *video_codecs_list = NULL;
-
- for (Ekiga::CodecList::iterator it = gcodecs.begin ();
- it != gcodecs.end ();
- it++) {
-
- if ((*it).audio)
- audio_codecs_list = g_slist_append (audio_codecs_list, g_strdup ((*it).str ().c_str ()));
- else
- video_codecs_list = g_slist_append (video_codecs_list, g_strdup ((*it).str ().c_str ()));
- }
-
- gm_conf_set_string_list (AUDIO_CODECS_KEY "list", audio_codecs_list);
- g_slist_foreach (audio_codecs_list, (GFunc) g_free, NULL);
- g_slist_free (audio_codecs_list);
-
- gm_conf_set_string_list (VIDEO_CODECS_KEY "list", video_codecs_list);
- g_slist_foreach (video_codecs_list, (GFunc) g_free, NULL);
- g_slist_free (video_codecs_list);
-}
-
-
void
GMManager::OnMWIReceived (const PString & account,
const PString & mwi)
Modified: trunk/src/endpoints/manager.h
==============================================================================
--- trunk/src/endpoints/manager.h (original)
+++ trunk/src/endpoints/manager.h Sun Jan 13 18:56:32 2008
@@ -354,7 +354,7 @@
/** Enable the given codecs
* @param codecs is a set of the codecs and their descriptions
*/
- void set_codecs (Ekiga::CodecList codecs);
+ void set_codecs (Ekiga::CodecList & codecs);
/* DESCRIPTION : /
@@ -576,8 +576,6 @@
void on_message (std::string name,
std::string uri);
- void detect_codecs ();
-
protected:
Modified: trunk/src/endpoints/opal-gmconf-bridge.cpp
==============================================================================
--- trunk/src/endpoints/opal-gmconf-bridge.cpp (original)
+++ trunk/src/endpoints/opal-gmconf-bridge.cpp Sun Jan 13 18:56:32 2008
@@ -50,12 +50,15 @@
: Ekiga::ConfBridge (_service)
{
Ekiga::ConfKeys keys;
+ property_changed.connect (sigc::mem_fun (this, &ConfBridge::on_property_changed));
+
keys.push_back (AUDIO_CODECS_KEY "enable_silence_detection");
keys.push_back (AUDIO_CODECS_KEY "enable_echo_cancelation");
- load (keys);
+ keys.push_back (AUDIO_CODECS_KEY "list");
+ keys.push_back (VIDEO_CODECS_KEY "list");
- property_changed.connect (sigc::mem_fun (this, &ConfBridge::on_property_changed));
+ load (keys);
}
@@ -63,9 +66,62 @@
{
GMManager & manager = (GMManager &) service;
- if (key == AUDIO_CODECS_KEY "enable_silence_detection")
+ if (key == AUDIO_CODECS_KEY "enable_silence_detection") {
+
manager.set_silence_detection (gm_conf_entry_get_bool (entry));
- else if (key == AUDIO_CODECS_KEY "enable_echo_cancelation")
+ }
+ else if (key == AUDIO_CODECS_KEY "enable_echo_cancelation") {
+
manager.set_echo_cancelation (gm_conf_entry_get_bool (entry));
+ }
+ else if (key == AUDIO_CODECS_KEY "list"
+ || key == VIDEO_CODECS_KEY "list") {
+
+ GSList *audio_codecs = NULL;
+ GSList *video_codecs = NULL;
+
+ if (key == AUDIO_CODECS_KEY "list") {
+
+ audio_codecs = gm_conf_entry_get_list (entry);
+ video_codecs = gm_conf_get_string_list (VIDEO_CODECS_KEY "list");
+ }
+ else {
+
+ video_codecs = gm_conf_entry_get_list (entry);
+ audio_codecs = gm_conf_get_string_list (AUDIO_CODECS_KEY "list");
+ }
+
+ Ekiga::CodecList codecs;
+ Ekiga::CodecList a_codecs (audio_codecs);
+ Ekiga::CodecList v_codecs (video_codecs);
+
+ // Update the manager codecs
+ codecs = a_codecs;
+ codecs.append (v_codecs);
+ manager.set_codecs (codecs);
+
+ g_slist_foreach (audio_codecs, (GFunc) g_free, NULL);
+ g_slist_free (audio_codecs);
+ g_slist_foreach (video_codecs, (GFunc) g_free, NULL);
+ g_slist_free (video_codecs);
+
+ // Update the GmConf keys, in case we would have missed some codecs or
+ // used codecs we do not really support
+ if (a_codecs != codecs.get_audio_list ()) {
+
+ audio_codecs = codecs.get_audio_list ().gslist ();
+ gm_conf_set_string_list (AUDIO_CODECS_KEY "list", audio_codecs);
+ g_slist_foreach (audio_codecs, (GFunc) g_free, NULL);
+ g_slist_free (audio_codecs);
+ }
+
+ if (v_codecs != codecs.get_video_list ()) {
+
+ video_codecs = codecs.get_video_list ().gslist ();
+ gm_conf_set_string_list (VIDEO_CODECS_KEY "list", video_codecs);
+ g_slist_foreach (video_codecs, (GFunc) g_free, NULL);
+ g_slist_free (video_codecs);
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]