[ekiga/ds-gsettings3] GSettings: More porting.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-gsettings3] GSettings: More porting.
- Date: Sun, 13 Oct 2013 15:57:17 +0000 (UTC)
commit fbeb41a442b7dcb65f385204c9fc3e75229d5efe
Author: Damien Sandras <dsandras beip be>
Date: Sun Oct 13 17:55:39 2013 +0200
GSettings: More porting.
- Ported Opal NAT key.
- Ported Audio & Video codecs settings.
- Moved the framerate setting to the video codecs sections.
- Ported the GTK CodecsBox to better code using std::list. Easier to manage.
lib/ekiga-settings.h | 4 +
lib/engine/components/opal/opal-call-manager.cpp | 129 +++++++++++++++++--
lib/engine/components/opal/opal-call-manager.h | 9 ++
lib/engine/components/opal/opal-gmconf-bridge.cpp | 143 +--------------------
lib/engine/gui/gtk-core/codecsbox.cpp | 145 +++++++++++----------
lib/engine/protocol/codec-description.cpp | 22 ++--
lib/engine/protocol/codec-description.h | 4 +-
lib/engine/videoinput/videoinput-core.cpp | 7 +-
lib/engine/videoinput/videoinput-core.h | 1 +
org.gnome.ekiga.gschema.xml.in.in | 10 +-
10 files changed, 230 insertions(+), 244 deletions(-)
---
diff --git a/lib/ekiga-settings.h b/lib/ekiga-settings.h
index 1f11a95..3e7be6d 100644
--- a/lib/ekiga-settings.h
+++ b/lib/ekiga-settings.h
@@ -58,7 +58,11 @@
#define SIP_SCHEMA PROTOCOLS_SCHEMA ".sip"
#define H323_SCHEMA PROTOCOLS_SCHEMA ".h323"
+#define GENERAL_SCHEMA "org.gnome." PACKAGE_NAME ".general"
+#define NAT_SCHEMA GENERAL_SCHEMA ".nat"
+
#define CODECS_SCHEMA "org.gnome." PACKAGE_NAME ".codecs"
+#define AUDIO_CODECS_SCHEMA CODECS_SCHEMA ".audio"
#define VIDEO_CODECS_SCHEMA CODECS_SCHEMA ".video"
namespace Ekiga {
diff --git a/lib/engine/components/opal/opal-call-manager.cpp
b/lib/engine/components/opal/opal-call-manager.cpp
index d2b27c3..6e29d63 100644
--- a/lib/engine/components/opal/opal-call-manager.cpp
+++ b/lib/engine/components/opal/opal-call-manager.cpp
@@ -174,6 +174,20 @@ CallManager::CallManager (Ekiga::ServiceCore& core)
h323_endpoint = boost::shared_ptr<H323::EndPoint> (new H323::EndPoint (*this), null_deleter ());
add_protocol_manager (h323_endpoint);
#endif
+
+ nat_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (NAT_SCHEMA));
+ nat_settings->changed.connect (boost::bind (&CallManager::setup, this, _1));
+
+ audio_codecs_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (AUDIO_CODECS_SCHEMA));
+ audio_codecs_settings->changed.connect (boost::bind (&CallManager::setup, this, _1));
+
+ video_codecs_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (VIDEO_CODECS_SCHEMA));
+ video_codecs_settings->changed.connect (boost::bind (&CallManager::setup, this, _1));
+
+ video_devices_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (VIDEO_DEVICES_SCHEMA));
+ video_devices_settings->changed.connect (boost::bind (&CallManager::setup, this, _1));
+
+ setup ();
}
@@ -257,6 +271,8 @@ void CallManager::set_echo_cancellation (bool enabled)
}
}
}
+
+ PTRACE (4, "Opal::CallManager\tEcho Cancellation: " << enabled);
}
@@ -270,8 +286,9 @@ bool CallManager::get_echo_cancellation () const
void CallManager::set_maximum_jitter (unsigned max_val)
{
- // Adjust general settings
- SetAudioJitterDelay (20, PMIN (PMAX (max_val, 20), 1000));
+ unsigned val = PMIN (PMAX (max_val, 20), 1000);
+
+ SetAudioJitterDelay (20, val);
// Adjust setting for all sessions of all connections of all calls
for (PSafePtr<OpalCall> call = activeCalls;
@@ -292,12 +309,14 @@ void CallManager::set_maximum_jitter (unsigned max_val)
if (session != NULL) {
unsigned units = session->GetJitterTimeUnits ();
- session->SetJitterBufferSize (20 * units, max_val * units, units);
+ session->SetJitterBufferSize (20 * units, val * units, units);
}
}
}
}
}
+
+ PTRACE (4, "Opal::CallManager\tSet Maximum Jitter to " << val);
}
@@ -338,6 +357,8 @@ void CallManager::set_silence_detection (bool enabled)
}
}
}
+
+ PTRACE (4, "Opal::CallManager\tSilence Detection: " << enabled);
}
@@ -568,7 +589,11 @@ CallManager::set_rtp_tos (unsigned tos)
void CallManager::set_stun_server (const std::string & server)
{
+ if (server.empty ())
+ stun_server = "stun.ekiga.net";
+
stun_server = server;
+ PTRACE (4, "Opal::CallManager\tSet STUN Server to " << stun_server);
}
@@ -583,6 +608,8 @@ void CallManager::set_stun_enabled (bool enabled)
Ekiga::Runtime::run_in_main (boost::bind (&CallManager::HandleSTUNResult, this), 1);
} else
ready ();
+
+ PTRACE (4, "Opal::CallManager\tSTUN Detection: " << enabled);
}
@@ -603,6 +630,10 @@ void CallManager::set_video_options (const CallManager::VideoOptions & options)
OpalMediaFormatList media_formats_list;
OpalMediaFormat::GetAllRegisteredMediaFormats (media_formats_list);
+ int maximum_frame_rate = PMIN (PMAX (options.maximum_frame_rate, 1), 30);
+ int maximum_received_bitrate = (options.maximum_received_bitrate > 0 ? options.maximum_received_bitrate :
4096);
+ int maximum_transmitted_bitrate = (options.maximum_transmitted_bitrate > 0 ?
options.maximum_transmitted_bitrate : 48);
+ int temporal_spatial_tradeoff = (options.temporal_spatial_tradeoff > 0 ? options.temporal_spatial_tradeoff
: 31);
// Configure all mediaOptions of all Video MediaFormats
for (int i = 0 ; i < media_formats_list.GetSize () ; i++) {
@@ -614,11 +645,11 @@ void CallManager::set_video_options (const CallManager::VideoOptions & options)
media_format.SetOptionInteger (OpalVideoFormat::FrameHeightOption (),
Ekiga::VideoSizes [options.size].height);
media_format.SetOptionInteger (OpalVideoFormat::FrameTimeOption (),
- (int) (90000 / (options.maximum_frame_rate > 0 ?
options.maximum_frame_rate : 30)));
+ (int) (90000 / maximum_frame_rate));
media_format.SetOptionInteger (OpalVideoFormat::MaxBitRateOption (),
- (options.maximum_received_bitrate > 0 ?
options.maximum_received_bitrate : 4096) * 1000);
+ maximum_received_bitrate * 1000);
media_format.SetOptionInteger (OpalVideoFormat::TargetBitRateOption (),
- (options.maximum_transmitted_bitrate > 0 ?
options.maximum_transmitted_bitrate : 48) * 1000);
+ maximum_transmitted_bitrate * 1000);
media_format.SetOptionInteger (OpalVideoFormat::MinRxFrameWidthOption(),
160);
media_format.SetOptionInteger (OpalVideoFormat::MinRxFrameHeightOption(),
@@ -629,9 +660,9 @@ void CallManager::set_video_options (const CallManager::VideoOptions & options)
1088);
media_format.AddOption(new OpalMediaOptionUnsigned (OpalVideoFormat::TemporalSpatialTradeOffOption (),
true, OpalMediaOption::NoMerge,
- options.temporal_spatial_tradeoff));
+ temporal_spatial_tradeoff));
media_format.SetOptionInteger (OpalVideoFormat::TemporalSpatialTradeOffOption(),
- (options.temporal_spatial_tradeoff > 0 ?
options.temporal_spatial_tradeoff : 31));
+ temporal_spatial_tradeoff);
media_format.AddOption(new OpalMediaOptionUnsigned (OpalVideoFormat::MaxFrameSizeOption (),
true, OpalMediaOption::NoMerge, 1400));
media_format.SetOptionInteger (OpalVideoFormat::MaxFrameSizeOption (),
@@ -685,15 +716,21 @@ void CallManager::set_video_options (const CallManager::VideoOptions & options)
OpalMediaFormat mediaFormat = stream->GetMediaFormat ();
mediaFormat.SetOptionInteger (OpalVideoFormat::TemporalSpatialTradeOffOption(),
- (options.temporal_spatial_tradeoff > 0 ?
options.temporal_spatial_tradeoff : 31));
+ temporal_spatial_tradeoff);
mediaFormat.SetOptionInteger (OpalVideoFormat::TargetBitRateOption (),
- (options.maximum_transmitted_bitrate > 0 ?
options.maximum_transmitted_bitrate : 48) * 1000);
+ maximum_transmitted_bitrate * 1000);
mediaFormat.ToNormalisedOptions();
stream->UpdateMediaFormat (mediaFormat);
}
}
}
}
+
+ PTRACE (4, "Opal::CallManager\tVideo Max Tx Bitrate: " << maximum_transmitted_bitrate);
+ PTRACE (4, "Opal::CallManager\tVideo Max Rx Bitrate: " << maximum_received_bitrate);
+ PTRACE (4, "Opal::CallManager\tVideo Temporal Spatial Tradeoff: " << temporal_spatial_tradeoff);
+ PTRACE (4, "Opal::CallManager\tVideo Size: " << options.size);
+ PTRACE (4, "Opal::CallManager\tVideo Max Frame Rate: " << maximum_frame_rate);
}
@@ -973,3 +1010,75 @@ CallManager::set_sip_endpoint (boost::shared_ptr<Opal::Sip::EndPoint> _sip_endpo
sip_endpoint = _sip_endpoint;
add_protocol_manager (sip_endpoint);
}
+
+void
+CallManager::setup (const std::string & setting)
+{
+ CallManager::VideoOptions options;
+ get_video_options (options);
+
+ if (setting.empty () || setting == "stun-server") {
+
+ set_stun_server (nat_settings->get_string ("stun-server"));
+ }
+ if (setting.empty () || setting == "enable-stun") {
+
+ set_stun_enabled (nat_settings->get_bool ("enable-stun"));
+ }
+ if (setting.empty () || setting == "maximum-jitter-buffer") {
+
+ set_maximum_jitter (audio_codecs_settings->get_int ("maximum-jitter-buffer"));
+ }
+ if (setting.empty () || setting == "enable-silence-detection") {
+
+ set_silence_detection (audio_codecs_settings->get_bool ("enable-silence-detection"));
+ }
+ if (setting.empty () || setting == "enable-echo-cancellation") {
+
+ set_echo_cancellation (audio_codecs_settings->get_bool ("enable-echo-cancellation"));
+ }
+ if (setting.empty () || setting == "maximum-video-tx-bitrate") {
+
+ options.maximum_transmitted_bitrate = video_codecs_settings->get_int ("maximum-video-tx-bitrate");
+ }
+ if (setting.empty () || setting == "temporal-spatial-tradeoff") {
+
+ options.temporal_spatial_tradeoff = video_codecs_settings->get_int ("temporal-spatial-tradeoff");
+ }
+ if (setting.empty () || setting == "size") {
+
+ options.size = video_devices_settings->get_int ("size");
+ }
+ if (setting.empty () || setting == "max-frame-rate") {
+
+ options.maximum_frame_rate = video_codecs_settings->get_int ("max-frame-rate");
+ }
+ if (setting.empty () || setting == "maximum-video-rx-bitrate") {
+
+ options.maximum_received_bitrate = video_codecs_settings->get_int ("maximum-video-rx-bitrate");
+ }
+ if (setting.empty () || setting == "media-list") {
+
+ std::list<std::string> audio_codecs = audio_codecs_settings->get_string_list ("media-list");
+ std::list<std::string> video_codecs = video_codecs_settings->get_string_list ("media-list");
+
+ Ekiga::CodecList fcodecs;
+ Ekiga::CodecList a_codecs (audio_codecs);
+ Ekiga::CodecList v_codecs (video_codecs);
+
+ // Update the manager codecs
+ fcodecs = a_codecs;
+ fcodecs.append (v_codecs);
+ set_codecs (fcodecs);
+
+ // Update the GmConf keys, in case we would have missed some codecs or
+ // used codecs we do not really support
+ if (a_codecs != fcodecs.get_audio_list ())
+ audio_codecs_settings->set_string_list ("media-list", fcodecs.get_audio_list ().slist ());
+
+ if (v_codecs != fcodecs.get_video_list ())
+ video_codecs_settings->set_string_list ("media-list", fcodecs.get_video_list ().slist ());
+ }
+
+ set_video_options (options);
+}
diff --git a/lib/engine/components/opal/opal-call-manager.h b/lib/engine/components/opal/opal-call-manager.h
index 6b50efd..88cfaf9 100644
--- a/lib/engine/components/opal/opal-call-manager.h
+++ b/lib/engine/components/opal/opal-call-manager.h
@@ -52,6 +52,8 @@
#include "call-manager.h"
#include "opal-call.h"
+#include "ekiga-settings.h"
+
#include <boost/enable_shared_from_this.hpp>
@@ -198,6 +200,9 @@ private:
PVideoOutputDevice * & device,
PBoolean & auto_delete);
+ /* Set up endpoint: all options or a specific setting */
+ void setup (const std::string & setting = "");
+
/* The various related endpoints */
GMPCSSEndpoint *pcssEP;
@@ -220,6 +225,10 @@ private:
bool stun_enabled;
bool auto_answer;
+ boost::shared_ptr<Ekiga::Settings> nat_settings;
+ boost::shared_ptr<Ekiga::Settings> audio_codecs_settings;
+ boost::shared_ptr<Ekiga::Settings> video_codecs_settings;
+ boost::shared_ptr<Ekiga::Settings> video_devices_settings;
/* FIXME: this piece of the api is because the code is getting turned around,
* this should disappear at some point! */
diff --git a/lib/engine/components/opal/opal-gmconf-bridge.cpp
b/lib/engine/components/opal/opal-gmconf-bridge.cpp
index 0d8ac42..00d2f13 100644
--- a/lib/engine/components/opal/opal-gmconf-bridge.cpp
+++ b/lib/engine/components/opal/opal-gmconf-bridge.cpp
@@ -93,150 +93,9 @@ ConfBridge::on_property_changed (std::string key,
GmConfEntry *entry)
{
//
- // Video options
- //
- if (key == VIDEO_CODECS_KEY "maximum_video_tx_bitrate") {
-
- CallManager::VideoOptions options;
- manager.get_video_options (options);
- options.maximum_transmitted_bitrate = gm_conf_entry_get_int (entry);
- PTRACE(4, "OpalConfBridge\tmaximum_video_tx_bitrate set to " << options.maximum_transmitted_bitrate <<
"kb/s");
- manager.set_video_options (options);
- }
- else if (key == VIDEO_CODECS_KEY "temporal_spatial_tradeoff") {
-
- CallManager::VideoOptions options;
- manager.get_video_options (options);
- options.temporal_spatial_tradeoff = gm_conf_entry_get_int (entry);
- manager.set_video_options (options);
- }
- else if (key == VIDEO_DEVICES_KEY "size") {
-
- CallManager::VideoOptions options;
- manager.get_video_options (options);
- options.size = gm_conf_entry_get_int (entry);
- manager.set_video_options (options);
- }
- else if (key == VIDEO_DEVICES_KEY "max_frame_rate") {
-
- CallManager::VideoOptions options;
- manager.get_video_options (options);
- options.maximum_frame_rate = gm_conf_entry_get_int (entry);
- if ( (options.maximum_frame_rate < 1) || (options.maximum_frame_rate > 30) ) {
- PTRACE(1, "OpalConfBridge\t" << VIDEO_DEVICES_KEY "max_frame_rate" << " out of range, ajusting to 30");
- options.maximum_frame_rate = 30;
- }
- manager.set_video_options (options);
- }
- else if (key == VIDEO_CODECS_KEY "maximum_video_rx_bitrate") {
-
- CallManager::VideoOptions options;
- manager.get_video_options (options);
- options.maximum_received_bitrate = gm_conf_entry_get_int (entry);
- manager.set_video_options (options);
- }
-
- //
- // NAT Key
- //
- else if (key == NAT_KEY "stun_server") {
-
- gchar* stun_server = gm_conf_entry_get_string (entry);
- manager.set_stun_server (stun_server ? stun_server : "stun.ekiga.net");
- g_free (stun_server);
- }
- else if (key == NAT_KEY "enable_stun") {
-
- manager.set_stun_enabled (gm_conf_entry_get_bool (entry));
- }
-
-
- //
- // Jitter buffer configuration
- //
- else if (key == AUDIO_CODECS_KEY "maximum_jitter_buffer") {
-
- manager.set_maximum_jitter (gm_conf_entry_get_int (entry));
- }
-
-
- //
- // Silence detection
- //
- else if (key == AUDIO_CODECS_KEY "enable_silence_detection") {
-
- manager.set_silence_detection (gm_conf_entry_get_bool (entry));
- }
-
-
- //
- // Echo cancellation
- //
- else if (key == AUDIO_CODECS_KEY "enable_echo_cancellation") {
-
- manager.set_echo_cancellation (gm_conf_entry_get_bool (entry));
- }
-
-
- //
- // Audio & video codecs
- //
- else if (key == AUDIO_CODECS_KEY "media_list"
- || key == VIDEO_CODECS_KEY "media_list") {
-
- // This is a bit longer, we are not sure the list stored in the
- // configuration is complete, and it could also contain unsupported codecs
- GSList *audio_codecs = NULL;
- GSList *video_codecs = NULL;
-
- if (key == AUDIO_CODECS_KEY "media_list") {
-
- audio_codecs = gm_conf_entry_get_list (entry);
- video_codecs = gm_conf_get_string_list (VIDEO_CODECS_KEY "media_list");
- }
- else {
-
- video_codecs = gm_conf_entry_get_list (entry);
- audio_codecs = gm_conf_get_string_list (AUDIO_CODECS_KEY "media_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 "media_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 "media_list", video_codecs);
- g_slist_foreach (video_codecs, (GFunc) g_free, NULL);
- g_slist_free (video_codecs);
- }
- }
-
- //
// Personal Data Key
//
- else if (key == PERSONAL_DATA_KEY "full_name") {
+ if (key == PERSONAL_DATA_KEY "full_name") {
gchar* str = gm_conf_entry_get_string (entry);
if (str != NULL)
diff --git a/lib/engine/gui/gtk-core/codecsbox.cpp b/lib/engine/gui/gtk-core/codecsbox.cpp
index a11cabc..f3b3278 100644
--- a/lib/engine/gui/gtk-core/codecsbox.cpp
+++ b/lib/engine/gui/gtk-core/codecsbox.cpp
@@ -41,8 +41,8 @@
#include <glib/gi18n.h>
-#include "gmconf.h"
#include "codec-description.h"
+#include "ekiga-settings.h"
/* Columns for the codecs page */
enum {
@@ -61,7 +61,9 @@ struct _CodecsBoxPrivate
{
Ekiga::Call::StreamType type;
GtkWidget *codecs_list;
- gpointer notifier;
+ boost::shared_ptr<Ekiga::Settings> audio_settings;
+ boost::shared_ptr<Ekiga::Settings> video_settings;
+ gulong handler;
};
enum { TYPE = 1 };
@@ -70,10 +72,14 @@ G_DEFINE_TYPE (CodecsBox, codecs_box, GTK_TYPE_BOX);
/* Static functions */
static void codecs_box_set_codecs (CodecsBox *self,
- GSList *list);
+ const std::list<std::string> list);
/* GTK+ Callbacks */
+static void settings_changed (G_GNUC_UNUSED GSettings *settings,
+ G_GNUC_UNUSED gchar *key,
+ gpointer data);
+
static void codec_toggled_cb (GtkCellRendererToggle *cell,
gchar *path_str,
gpointer data);
@@ -81,7 +87,7 @@ static void codec_toggled_cb (GtkCellRendererToggle *cell,
static void codec_moved_cb (GtkWidget *widget,
gpointer data);
-static GSList *codecs_box_to_gm_conf_list (CodecsBox *self);
+static std::list<std::string> codecs_box_to_list (CodecsBox *self);
static void codecs_box_class_init (CodecsBoxClass* klass);
@@ -101,22 +107,17 @@ static void codecs_box_set_property (GObject *obj,
static void
codecs_box_set_codecs (CodecsBox *self,
- GSList *list)
+ const std::list<std::string> list)
{
GtkTreeSelection *selection = NULL;
GtkTreeModel *model = NULL;
GtkTreeIter iter;
- GSList *codecs_data = NULL;
- GSList *codecs_data_iter = NULL;
-
gchar *selected_codec = NULL;
unsigned select_rate = 0;
bool selected = false;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->codecs_list));
- codecs_data = list;
-
selection = gtk_tree_view_get_selection (GTK_TREE_VIEW (self->priv->codecs_list));
if (gtk_tree_selection_get_selected (selection, &model, &iter))
@@ -125,10 +126,11 @@ codecs_box_set_codecs (CodecsBox *self,
COLUMN_CODEC_CLOCKRATE, &select_rate, -1);
gtk_list_store_clear (GTK_LIST_STORE (model));
- codecs_data_iter = codecs_data;
- while (codecs_data_iter) {
+ for (std::list<std::string>::const_iterator itr = list.begin ();
+ itr != list.end ();
+ itr++) {
- Ekiga::CodecDescription desc = Ekiga::CodecDescription ((char *) codecs_data_iter->data);
+ Ekiga::CodecDescription desc = Ekiga::CodecDescription (*itr);
if ((self->priv->type == Ekiga::Call::Audio && desc.audio)
|| (self->priv->type == Ekiga::Call::Video && !desc.audio)) {
@@ -163,8 +165,6 @@ codecs_box_set_codecs (CodecsBox *self,
gtk_tree_selection_select_iter (selection, &iter);
}
}
-
- codecs_data_iter = g_slist_next (codecs_data_iter);
}
if (!selected && gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter))
@@ -173,6 +173,31 @@ codecs_box_set_codecs (CodecsBox *self,
static void
+settings_changed (G_GNUC_UNUSED GSettings *settings,
+ G_GNUC_UNUSED gchar *key,
+ gpointer data)
+{
+ std::list<std::string> list;
+ CodecsBox *self = CODECS_BOX (data);
+
+ g_return_if_fail (self);
+
+ std::list<std::string> current_list = codecs_box_to_list (CODECS_BOX (self));
+
+ if (self->priv->type == Ekiga::Call::Audio)
+ list = self->priv->audio_settings->get_string_list ("media-list");
+ else if (self->priv->type == Ekiga::Call::Video)
+ list = self->priv->video_settings->get_string_list ("media-list");
+
+ Ekiga::CodecList clist (list);
+ Ekiga::CodecList curlist (current_list);
+
+ if (clist != curlist)
+ codecs_box_set_codecs (self, list);
+}
+
+
+static void
codec_toggled_cb (G_GNUC_UNUSED GtkCellRendererToggle *cell,
gchar *path_str,
gpointer data)
@@ -183,7 +208,7 @@ codec_toggled_cb (G_GNUC_UNUSED GtkCellRendererToggle *cell,
GtkTreePath *path = NULL;
GtkTreeIter iter;
- GSList *codecs_data = NULL;
+ std::list<std::string> list;
gboolean fixed = FALSE;
@@ -200,13 +225,11 @@ codec_toggled_cb (G_GNUC_UNUSED GtkCellRendererToggle *cell,
gtk_tree_path_free (path);
/* Update the gmconf key */
- codecs_data = codecs_box_to_gm_conf_list (self);
+ list = codecs_box_to_list (self);
if (self->priv->type == Ekiga::Call::Audio)
- gm_conf_set_string_list (AUDIO_CODECS_KEY "media_list", codecs_data);
+ self->priv->audio_settings->set_string_list ("media-list", list);
else if (self->priv->type == Ekiga::Call::Video)
- gm_conf_set_string_list (VIDEO_CODECS_KEY "media_list", codecs_data);
- g_slist_foreach (codecs_data, (GFunc) g_free, NULL);
- g_slist_free (codecs_data);
+ self->priv->video_settings->set_string_list ("media-list", list);
}
@@ -222,7 +245,7 @@ codec_moved_cb (GtkWidget *widget,
GtkTreeSelection *selection = NULL;
GtkTreePath *tree_path = NULL;
- GSList *codecs_data = NULL;
+ std::list<std::string> list;
gchar *path_str = NULL;
@@ -258,19 +281,17 @@ codec_moved_cb (GtkWidget *widget,
gtk_tree_iter_free (iter2);
g_free (path_str);
- /* Update the gmconf key */
- codecs_data = codecs_box_to_gm_conf_list (self);
+ /* Update the key */
+ list = codecs_box_to_list (self);
if (self->priv->type == Ekiga::Call::Audio)
- gm_conf_set_string_list (AUDIO_CODECS_KEY "media_list", codecs_data);
+ self->priv->audio_settings->set_string_list ("media-list", list);
else if (self->priv->type == Ekiga::Call::Video)
- gm_conf_set_string_list (VIDEO_CODECS_KEY "media_list", codecs_data);
- g_slist_foreach (codecs_data, (GFunc) g_free, NULL);
- g_slist_free (codecs_data);
+ self->priv->video_settings->set_string_list ("media-list", list);
}
-static GSList *
-codecs_box_to_gm_conf_list (CodecsBox *self)
+static std::list<std::string>
+codecs_box_to_list (CodecsBox *self)
{
GtkTreeModel *model = NULL;
GtkTreeIter iter;
@@ -281,7 +302,7 @@ codecs_box_to_gm_conf_list (CodecsBox *self)
gboolean active = false;
gboolean audio = false;
- GSList *codecs_data = NULL;
+ std::list<std::string> list;
model = gtk_tree_view_get_model (GTK_TREE_VIEW (self->priv->codecs_list));
if (gtk_tree_model_get_iter_first (GTK_TREE_MODEL (model), &iter)) {
@@ -298,7 +319,7 @@ codecs_box_to_gm_conf_list (CodecsBox *self)
Ekiga::CodecDescription desc;
desc = Ekiga::CodecDescription (name, atoi (rate) * 1000, audio, protocols, active);
- codecs_data = g_slist_append (codecs_data, g_strdup (desc.str ().c_str ()));
+ list.push_back (desc.str ());
g_free (name);
g_free (protocols);
@@ -307,30 +328,7 @@ codecs_box_to_gm_conf_list (CodecsBox *self)
} while (gtk_tree_model_iter_next (GTK_TREE_MODEL (model), &iter));
}
- return codecs_data;
-}
-
-
-static void
-codecs_list_changed_nt (G_GNUC_UNUSED gpointer id,
- GmConfEntry *entry,
- gpointer data)
-{
- CodecsBox *self = CODECS_BOX (data);
-
- GSList *list = gm_conf_entry_get_list (entry);
- GSList *current_list = codecs_box_to_gm_conf_list (self);
- Ekiga::CodecList clist (list);
- Ekiga::CodecList curlist (current_list);
-
- if (clist != curlist)
- codecs_box_set_codecs (self, list);
-
- g_slist_foreach (list, (GFunc) g_free, NULL);
- g_slist_free (list);
-
- g_slist_foreach (current_list, (GFunc) g_free, NULL);
- g_slist_free (current_list);
+ return list;
}
@@ -368,6 +366,10 @@ codecs_box_init (CodecsBox *self)
self->priv = G_TYPE_INSTANCE_GET_PRIVATE (self, CODECS_BOX_TYPE, CodecsBoxPrivate);
self->priv->type = Ekiga::Call::Audio;
+ self->priv->audio_settings =
+ boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (AUDIO_CODECS_SCHEMA));
+ self->priv->video_settings =
+ boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (VIDEO_CODECS_SCHEMA));
self->priv->codecs_list = gtk_tree_view_new ();
gtk_box_set_spacing (GTK_BOX (self), 6);
@@ -480,9 +482,13 @@ codecs_box_dispose (GObject *obj)
self = CODECS_BOX (obj);
- if (self->priv->notifier)
- gm_conf_notifier_remove (self->priv->notifier);
- self->priv->notifier = NULL;
+ if (self->priv->handler > 0) {
+ if (self->priv->type == Ekiga::Call::Audio)
+ g_signal_handler_disconnect (self->priv->audio_settings->get_g_settings (), self->priv->handler);
+ else if (self->priv->type == Ekiga::Call::Video)
+ g_signal_handler_disconnect (self->priv->video_settings->get_g_settings (), self->priv->handler);
+ }
+ self->priv->handler = 0;
self->priv->codecs_list = NULL;
G_OBJECT_CLASS (codecs_box_parent_class)->dispose (obj);
@@ -516,7 +522,7 @@ codecs_box_set_property (GObject *obj,
GParamSpec *spec)
{
CodecsBox *self = CODECS_BOX (obj);
- GSList *list = NULL;
+ std::list<std::string> list;
switch (prop_id) {
@@ -530,23 +536,20 @@ codecs_box_set_property (GObject *obj,
}
if (self->priv->type == Ekiga::Call::Audio)
- list = gm_conf_get_string_list (AUDIO_CODECS_KEY "media_list");
+ list = self->priv->audio_settings->get_string_list ("media-list");
else if (self->priv->type == Ekiga::Call::Video)
- list = gm_conf_get_string_list (VIDEO_CODECS_KEY "media_list");
+ list = self->priv->video_settings->get_string_list ("media-list");
codecs_box_set_codecs (self, list);
- g_slist_foreach (list, (GFunc) g_free, NULL);
- g_slist_free (list);
-
if (self->priv->type == Ekiga::Call::Audio)
- self->priv->notifier =
- gm_conf_notifier_add (AUDIO_CODECS_KEY "media_list",
- codecs_list_changed_nt, GTK_WIDGET (self));
+ self->priv->handler =
+ g_signal_connect (self->priv->audio_settings->get_g_settings (), "changed",
+ G_CALLBACK (settings_changed), self);
else
- self->priv->notifier =
- gm_conf_notifier_add (VIDEO_CODECS_KEY "media_list",
- codecs_list_changed_nt, GTK_WIDGET (self));
+ self->priv->handler =
+ g_signal_connect (self->priv->video_settings->get_g_settings (), "changed",
+ G_CALLBACK (settings_changed), self);
}
diff --git a/lib/engine/protocol/codec-description.cpp b/lib/engine/protocol/codec-description.cpp
index 6d8d098..304122c 100644
--- a/lib/engine/protocol/codec-description.cpp
+++ b/lib/engine/protocol/codec-description.cpp
@@ -149,19 +149,15 @@ CodecDescription::operator!= (const CodecDescription & c) const
}
-CodecList::CodecList (GSList *codecs_config)
+CodecList::CodecList (const std::list<std::string> & codecs_config)
{
- GSList *codecs_config_it = NULL;
-
- codecs_config_it = (GSList *) codecs_config;
- while (codecs_config_it) {
-
+ for (std::list<std::string>::const_iterator iter = codecs_config.begin ();
+ iter != codecs_config.end ();
+ iter++) {
- Ekiga::CodecDescription d = Ekiga::CodecDescription ((char *) codecs_config_it->data);
+ Ekiga::CodecDescription d = Ekiga::CodecDescription (*iter);
if (!d.name.empty ())
codecs.push_back (d);
-
- codecs_config_it = g_slist_next (codecs_config_it);
}
}
@@ -241,16 +237,16 @@ CodecList::get_video_list ()
}
-GSList*
-CodecList::gslist ()
+std::list<std::string>
+CodecList::slist ()
{
- GSList* result = NULL;
+ std::list<std::string> result;
for (iterator it = begin ();
it != end ();
it++) {
- result = g_slist_append (result, g_strdup ((*it).str ().c_str ()));
+ result.push_back ((*it).str ());
}
return result;
diff --git a/lib/engine/protocol/codec-description.h b/lib/engine/protocol/codec-description.h
index 4359264..546c43b 100644
--- a/lib/engine/protocol/codec-description.h
+++ b/lib/engine/protocol/codec-description.h
@@ -138,7 +138,7 @@ namespace Ekiga
/** Constructor that creates a CodecList from a GSList whose elements
* are CodecDescription objects formatted as a string.
*/
- CodecList (GSList *);
+ CodecList (const std::list<std::string> &);
virtual ~CodecList ()
{}
@@ -181,7 +181,7 @@ namespace Ekiga
/** Return the list of codecs descriptions under their str form
* @return the list of CodecDescription
*/
- GSList *gslist ();
+ std::list<std::string> slist ();
/** Return true if both CodecList are identical, false otherwise
diff --git a/lib/engine/videoinput/videoinput-core.cpp b/lib/engine/videoinput/videoinput-core.cpp
index 6c4d33c..41a654f 100644
--- a/lib/engine/videoinput/videoinput-core.cpp
+++ b/lib/engine/videoinput/videoinput-core.cpp
@@ -178,6 +178,9 @@ VideoInputCore::VideoInputCore (Ekiga::ServiceCore & _core,
device_settings = new Settings (VIDEO_DEVICES_SCHEMA);
device_settings->changed.connect (boost::bind (&VideoInputCore::setup, this, _1));
+
+ video_codecs_settings = new Settings (VIDEO_CODECS_SCHEMA);
+ video_codecs_settings->changed.connect (boost::bind (&VideoInputCore::setup, this, _1));
}
VideoInputCore::~VideoInputCore ()
@@ -194,12 +197,14 @@ VideoInputCore::~VideoInputCore ()
managers.clear();
delete device_settings;
+ delete video_codecs_settings;
}
void VideoInputCore::setup (std::string setting)
{
GSettings* settings = device_settings->get_g_settings ();
+ GSettings* codecs_settings = video_codecs_settings->get_g_settings ();
VideoInputDevice device;
/* Get device settings */
@@ -216,7 +221,7 @@ void VideoInputCore::setup (std::string setting)
/* Size and framerate */
if (setting == "any" || setting == "size" || setting == "max-frame-rate") {
unsigned size = g_settings_get_int (settings, "size");
- unsigned max_frame_rate = g_settings_get_int (settings, "max-frame-rate");
+ unsigned max_frame_rate = g_settings_get_int (codecs_settings, "max-frame-rate");
if (size >= NB_VIDEO_SIZES) {
PTRACE(1, "VidInputCore\t" << "size out of range, ajusting to 0");
size = 0;
diff --git a/lib/engine/videoinput/videoinput-core.h b/lib/engine/videoinput/videoinput-core.h
index cb052ad..0d49374 100644
--- a/lib/engine/videoinput/videoinput-core.h
+++ b/lib/engine/videoinput/videoinput-core.h
@@ -442,6 +442,7 @@ private:
boost::shared_ptr<Ekiga::NotificationCore> notification_core;
Settings* device_settings;
+ Settings* video_codecs_settings;
};
/**
* @}
diff --git a/org.gnome.ekiga.gschema.xml.in.in b/org.gnome.ekiga.gschema.xml.in.in
index 1b31b64..e86b03f 100644
--- a/org.gnome.ekiga.gschema.xml.in.in
+++ b/org.gnome.ekiga.gschema.xml.in.in
@@ -48,11 +48,6 @@
<_summary>Video preview</_summary>
<_description>Display images from your camera device</_description>
</key>
- <key name="max-frame-rate" type="i">
- <default>30</default>
- <_summary>Frame Rate</_summary>
- <_description>The maximum transmitted frame rate in frames/s. This rate may not be reached in case a
minimum quality was configure via a TSTO value smaller than 31 and the bitrate selected is not sufficient to
support this minimum quality</_description>
- </key>
</schema>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org gnome PACKAGE_NAME@.general"
path="/org/gnome/@PACKAGE_NAME@/general/">
<key name="version" type="i">
@@ -377,6 +372,11 @@
<_summary>Temporal Spatial Trade Off</_summary>
<_description>Whether to prefer to sustain the max. frame rate or lower it possibly in order to keep a
minimum level of (spatial) quality for all frames. 0: Highest minimal quality, 31: lowest minimal
quality</_description>
</key>
+ <key name="max-frame-rate" type="i">
+ <default>30</default>
+ <_summary>Frame Rate</_summary>
+ <_description>The maximum transmitted frame rate in frames/s. This rate may not be reached in case a
minimum quality was configure via a TSTO value smaller than 31 and the bitrate selected is not sufficient to
support this minimum quality</_description>
+ </key>
</schema>
<schema gettext-domain="@GETTEXT_PACKAGE@" id="org gnome PACKAGE_NAME@.protocols"
path="/org/gnome/@PACKAGE_NAME@/protocols/">
<key name="accounts-list" type="as">
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]