[ekiga/ds-gsettings3] GSettings: Ported the H.323 EndPoint.
- From: Damien Sandras <dsandras src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [ekiga/ds-gsettings3] GSettings: Ported the H.323 EndPoint.
- Date: Sat, 12 Oct 2013 11:15:27 +0000 (UTC)
commit 4cfa4b86dfd2ba1c37fba734706e2a6f3f07d4fe
Author: Damien Sandras <dsandras beip be>
Date: Sat Oct 12 13:04:13 2013 +0200
GSettings: Ported the H.323 EndPoint.
lib/ekiga-settings.h | 5 ++
lib/engine/components/opal/h323-endpoint.cpp | 57 ++++++++++++++++----------
lib/engine/components/opal/h323-endpoint.h | 7 +++-
3 files changed, 46 insertions(+), 23 deletions(-)
---
diff --git a/lib/ekiga-settings.h b/lib/ekiga-settings.h
index ad7a6f4..1f11a95 100644
--- a/lib/ekiga-settings.h
+++ b/lib/ekiga-settings.h
@@ -53,8 +53,13 @@
#define AUDIO_DEVICES_SCHEMA "org.gnome." PACKAGE_NAME ".devices.audio"
#define VIDEO_DEVICES_SCHEMA "org.gnome." PACKAGE_NAME ".devices.video"
#define VIDEO_DISPLAY_SCHEMA USER_INTERFACE ".video-display"
+
#define PROTOCOLS_SCHEMA "org.gnome." PACKAGE_NAME ".protocols"
#define SIP_SCHEMA PROTOCOLS_SCHEMA ".sip"
+#define H323_SCHEMA PROTOCOLS_SCHEMA ".h323"
+
+#define CODECS_SCHEMA "org.gnome." PACKAGE_NAME ".codecs"
+#define VIDEO_CODECS_SCHEMA CODECS_SCHEMA ".video"
namespace Ekiga {
diff --git a/lib/engine/components/opal/h323-endpoint.cpp b/lib/engine/components/opal/h323-endpoint.cpp
index 42aa255..ba52c73 100644
--- a/lib/engine/components/opal/h323-endpoint.cpp
+++ b/lib/engine/components/opal/h323-endpoint.cpp
@@ -98,18 +98,17 @@ Opal::H323::EndPoint::EndPoint (Opal::CallManager & _manager):
{
protocol_name = "h323";
uri_prefix = "h323:";
- listen_port = gm_conf_get_int (H323_KEY "listen_port");
- listen_port = (listen_port > 0 ? listen_port : 1720);
-
- /* Initial requested bandwidth */
- set_initial_bandwidth (gm_conf_get_int (VIDEO_CODECS_KEY "maximum_video_tx_bitrate"));
-
- /* Start listener */
- set_listen_port (listen_port);
-
/* Ready to take calls */
manager.AddRouteEntry("h323:.* = pc:*");
manager.AddRouteEntry("pc:.* = h323:<da>");
+
+ settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (H323_SCHEMA));
+ settings->changed.connect (boost::bind (&EndPoint::setup, this, _1));
+
+ video_codecs_settings = boost::shared_ptr<Ekiga::Settings> (new Ekiga::Settings (VIDEO_CODECS_SCHEMA));
+ video_codecs_settings->changed.connect (boost::bind (&EndPoint::setup, this, _1));
+
+ setup ();
}
Opal::H323::EndPoint::~EndPoint ()
@@ -202,29 +201,27 @@ Opal::H323::EndPoint::set_listen_port (unsigned port)
listen_iface.voip_protocol = "h323";
listen_iface.id = "*";
- if (port > 0) {
+ port = (port > 0 ? port : 1720);
- std::stringstream str;
- RemoveListener (NULL);
+ std::stringstream str;
+ RemoveListener (NULL);
- str << "tcp$*:" << port;
- if (StartListeners (PStringArray (str.str ()))) {
+ str << "tcp$*:" << port;
+ if (StartListeners (PStringArray (str.str ()))) {
- listen_iface.port = port;
- return true;
- }
+ listen_iface.port = port;
+ PTRACE (4, "Opal::H323::EndPoint\tSet listen port to " << port);
+ return true;
}
return false;
}
void
-Opal::H323::EndPoint::set_initial_bandwidth (unsigned maximum_video_tx_bitrate)
+Opal::H323::EndPoint::set_initial_bandwidth (unsigned bitrate)
{
- // maximum_video_tx_bitrate is the max video bitrate specified by the user
- // add to it 10% (approx.) accounting for audio,
- // and multiply it by 10 as needed by SetInitialBandwidth
- SetInitialBandwidth (maximum_video_tx_bitrate * 11);
+ SetInitialBandwidth (bitrate > 0 ? bitrate : 100000);
+ PTRACE (4, "Opal::H323::EndPoint\tSet maximum bandwidth to " << bitrate);
}
@@ -453,3 +450,19 @@ Opal::H323::EndPoint::registration_event_in_main (const Opal::Account& account,
{
account.handle_registration_event (state, msg);
}
+
+void
+Opal::H323::EndPoint::setup (const std::string setting)
+{
+ if (setting.empty () || setting == "listen-port") {
+ int listen_port = settings->get_int ("listen-port");
+ set_listen_port (listen_port);
+ }
+ if (setting.empty () || setting == "maximum-video-tx-bitrate") {
+ int maximum_video_tx_bitrate = video_codecs_settings->get_int ("maximum-video-tx-bitrate");
+ // maximum_video_tx_bitrate is the max video bitrate specified by the user
+ // add to it 10% (approx.) accounting for audio,
+ // and multiply it by 10 as needed by SetInitialBandwidth
+ set_initial_bandwidth (maximum_video_tx_bitrate * 11);
+ }
+}
diff --git a/lib/engine/components/opal/h323-endpoint.h b/lib/engine/components/opal/h323-endpoint.h
index b3099f4..5f5777d 100644
--- a/lib/engine/components/opal/h323-endpoint.h
+++ b/lib/engine/components/opal/h323-endpoint.h
@@ -41,6 +41,8 @@
#include <opal/opal.h>
+#include "ekiga-settings.h"
+
#include "call-core.h"
#include "account-core.h"
#include "presence-core.h"
@@ -118,6 +120,8 @@ namespace Opal {
Account::RegistrationState state,
const std::string msg);
+ void setup (const std::string key = "");
+
// this object is really managed by opal,
// so the way it is handled here is correct
CallManager & manager;
@@ -131,7 +135,8 @@ namespace Opal {
std::string uri_prefix;
std::string forward_uri;
- unsigned listen_port;
+ boost::shared_ptr<Ekiga::Settings> settings;
+ boost::shared_ptr<Ekiga::Settings> video_codecs_settings;
};
};
};
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]