ekiga r5865 - in trunk: . lib/engine/protocol/skel
- From: dsandras svn gnome org
- To: svn-commits-list gnome org
- Subject: ekiga r5865 - in trunk: . lib/engine/protocol/skel
- Date: Sun, 6 Jan 2008 18:13:53 +0000 (GMT)
Author: dsandras
Date: Sun Jan 6 18:13:52 2008
New Revision: 5865
URL: http://svn.gnome.org/viewvc/ekiga?rev=5865&view=rev
Log:
Added nice class to describe a codec, and able to do the bridge
between gmconf and a real codec description.
Added:
trunk/lib/engine/protocol/skel/codec-description.cpp
trunk/lib/engine/protocol/skel/codec-description.h
Modified:
trunk/ChangeLog
trunk/lib/engine/protocol/skel/Makefile.am
trunk/lib/engine/protocol/skel/call-core.cpp
trunk/lib/engine/protocol/skel/call-core.h
trunk/lib/engine/protocol/skel/call-manager.h
trunk/lib/engine/protocol/skel/call.h
Modified: trunk/ChangeLog
==============================================================================
--- trunk/ChangeLog (original)
+++ trunk/ChangeLog Sun Jan 6 18:13:52 2008
@@ -1,5 +1,17 @@
2008-01-06 Damien Sandras <dsandras gnome org>
+ * protocol/skel/codec-description.cpp,
+ protocol/skel/codec-description.h,
+ protocol/skel/call.h,
+ protocol/skel/call-core.cpp,
+ protocol/skel/call-core.h,
+ protocol/skel/Makefile.am,
+ protocol/skel/call-manager.h:
+ Added nice class to describe a codec, and able to do the bridge
+ between gmconf and a real codec description.
+
+2008-01-06 Damien Sandras <dsandras gnome org>
+
* lib/gui/codecsbox.cpp, lib/gui/codecsbox.h, lib/gui/Makefile.am:
Renamed the previous.
Modified: trunk/lib/engine/protocol/skel/Makefile.am
==============================================================================
--- trunk/lib/engine/protocol/skel/Makefile.am (original)
+++ trunk/lib/engine/protocol/skel/Makefile.am Sun Jan 6 18:13:52 2008
@@ -12,6 +12,8 @@
$(protocol_dir)/call-core.h \
$(protocol_dir)/call-manager.h \
$(protocol_dir)/call.h \
- $(protocol_dir)/call-core.cpp
+ $(protocol_dir)/call-core.cpp \
+ $(protocol_dir)/codec-description.h \
+ $(protocol_dir)/codec-description.cpp
libgmprotocol_la_LDFLAGS = -export-dynamic -no-undefined $(SIGC_LIBS)
Modified: trunk/lib/engine/protocol/skel/call-core.cpp
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.cpp (original)
+++ trunk/lib/engine/protocol/skel/call-core.cpp Sun Jan 6 18:13:52 2008
@@ -35,6 +35,7 @@
*/
#include <iostream>
+#include <sstream>
#include "config.h"
@@ -44,6 +45,7 @@
using namespace Ekiga;
+
void CallCore::add_manager (CallManager &manager)
{
managers.insert (&manager);
Modified: trunk/lib/engine/protocol/skel/call-core.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-core.h (original)
+++ trunk/lib/engine/protocol/skel/call-core.h Sun Jan 6 18:13:52 2008
@@ -47,18 +47,6 @@
namespace Ekiga {
- /*** Codec description ***/
- typedef struct {
- std::string name;
- unsigned rate;
- bool active;
- bool audio;
- std::list<std::string> protocols;
-
- } CodecDescription;
-
- typedef std::list<CodecDescription> CodecList;
-
class CallManager;
Modified: trunk/lib/engine/protocol/skel/call-manager.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call-manager.h (original)
+++ trunk/lib/engine/protocol/skel/call-manager.h Sun Jan 6 18:13:52 2008
@@ -40,6 +40,7 @@
#define __CALL_MANAGER_H__
#include "call-core.h"
+#include "codec-description.h"
namespace Ekiga {
Modified: trunk/lib/engine/protocol/skel/call.h
==============================================================================
--- trunk/lib/engine/protocol/skel/call.h (original)
+++ trunk/lib/engine/protocol/skel/call.h Sun Jan 6 18:13:52 2008
@@ -77,9 +77,9 @@
virtual void answer () = 0;
/** Transfer the call to the specified uri
- * @param: uri: where to transfer the call
+ * @param uri is the uri where to transfer the call
*/
- virtual void transfer (std::string /*uri*/) = 0;
+ virtual void transfer (std::string uri) = 0;
/** Put the call on hold or retrieve it
*/
@@ -91,7 +91,7 @@
virtual void toggle_stream_pause (StreamType type) = 0;
/** Send the given DTMF
- * @param the dtmf (one char)
+ * @param dtmf is the dtmf to send (one char)
*/
virtual void send_dtmf (const char dtmf) = 0;
@@ -160,14 +160,14 @@
unsigned get_received_video_framerate () { return re_v_fps; }
/** Return the transmitted video resolution
- * @param: width: width in pixels
- * @param: height: height in pixels
+ * @param width contains the width in pixels
+ * @param height contains the height in pixels
*/
void get_transmitted_video_resolution (unsigned & width, unsigned & height) { width = tr_width; height = tr_height; }
/** Return the received video resolution
- * @param: width: width in pixels
- * @param: height: height in pixels
+ * @param width contains the width in pixels
+ * @param height contains the height in pixels
*/
void get_received_video_resolution (unsigned & width, unsigned & height) { width = re_width; height = re_height; }
Added: trunk/lib/engine/protocol/skel/codec-description.cpp
==============================================================================
--- (empty file)
+++ trunk/lib/engine/protocol/skel/codec-description.cpp Sun Jan 6 18:13:52 2008
@@ -0,0 +1,125 @@
+
+/*
+ * 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.
+ */
+
+
+/*
+ * codec-description.cpp - description
+ * ------------------------------------------
+ * begin : written in January 2008 by Damien Sandras
+ * copyright : (c) 2008 by Damien Sandras
+ * description : declaration of the interface of a codec description.
+ *
+ */
+
+#include <iostream>
+#include <sstream>
+
+#include "codec-description.h"
+
+
+using namespace Ekiga;
+
+CodecDescription::CodecDescription ()
+: rate (0), active (false), audio (false)
+{
+}
+
+
+CodecDescription::CodecDescription (std::string _name,
+ unsigned _rate,
+ bool _audio,
+ std::string _protocols,
+ bool _active)
+: name (_name), rate (_rate), active (_active), audio (_audio)
+{
+ char *pch = NULL;
+
+ pch = strtok ((char *) _protocols.c_str (), ",");
+ while (pch != NULL) {
+
+ std::string protocol = pch;
+ protocol = protocol.substr (protocol.find_first_not_of (" "));
+ protocols.push_back (protocol);
+ pch = strtok (NULL, ",");
+ }
+
+ protocols.unique ();
+ protocols.sort ();
+}
+
+
+CodecDescription::CodecDescription (std::string codec)
+{
+ int i = 0;
+ char *pch = NULL;
+
+ std::string tmp [5];
+
+ pch = strtok ((char *) codec.c_str (), "*");
+ while (pch != NULL) {
+
+ tmp [i] = pch;
+ pch = strtok (NULL, "*");
+
+ i++;
+ }
+
+ if (i < 4)
+ return;
+
+ pch = strtok ((char *) tmp [3].c_str (), " ");
+ while (pch != NULL) {
+
+ protocols.push_back (pch);
+ pch = strtok (NULL, " ");
+ }
+
+ name = tmp [0];
+ rate = atoi (tmp [1].c_str ());
+ audio = atoi (tmp [2].c_str ());
+ active = atoi (tmp [4].c_str ());
+}
+
+
+std::string CodecDescription::str ()
+{
+ std::stringstream val;
+ std::stringstream proto;
+
+ val << name << "*" << rate << "*" << audio << "*";
+ protocols.sort ();
+ for (std::list<std::string>::iterator iter = protocols.begin ();
+ iter != protocols.end ();
+ iter++) {
+
+ if (iter != protocols.begin ())
+ proto << " ";
+
+ proto << *iter;
+ }
+ val << proto.str () << "*" << (active ? "1" : "0");
+
+ return val.str ();
+}
Added: trunk/lib/engine/protocol/skel/codec-description.h
==============================================================================
--- (empty file)
+++ trunk/lib/engine/protocol/skel/codec-description.h Sun Jan 6 18:13:52 2008
@@ -0,0 +1,105 @@
+
+/*
+ * 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.
+ */
+
+
+/*
+ * codec-description.h - description
+ * ------------------------------------------
+ * begin : written in January 2008 by Damien Sandras
+ * copyright : (c) 2008 by Damien Sandras
+ * description : declaration of the interface of a codec description.
+ *
+ */
+
+#ifndef __CODEC_DESCRIPTION_H__
+#define __CODEC_DESCRIPTION_H__
+
+#include <iostream>
+#include <list>
+
+namespace Ekiga {
+
+ /** This class holds the representation of a codec.
+ * That representation is different from the codec itself, but can be used
+ * at several places in the engine.
+ */
+ class CodecDescription
+ {
+ public:
+
+ /** Create an empty codec description
+ */
+ CodecDescription ();
+
+ /** Create a codec description based on the parameters
+ * @param name is the codec name as defined in the RFC
+ * @param rate is the clock rate
+ * @param audio is true if it reprensents an audio codec
+ * @param protocols is a comma separated list of protocols supported
+ * by the codec
+ * @param active is true if the codec is active
+ */
+ CodecDescription (std::string name,
+ unsigned rate,
+ bool audio,
+ std::string protocols,
+ bool active);
+
+ /** Create a codec description from a string
+ * @param codec is a string representing the codec description.
+ * All fields are separated by a *
+ */
+ CodecDescription (std::string codec);
+
+ /** Return the codec description under the form of a string.
+ * @return the std::string representing the string description.
+ */
+ std::string str ();
+
+
+ /** name is the codec name as defined in the RFC
+ */
+ std::string name;
+
+ /** rate is the clock rate
+ */
+ unsigned rate;
+
+ /** active is true if the codec is active
+ */
+ bool active;
+
+ /** audio is true if it reprensents an audio codec
+ */
+ bool audio;
+
+ /** protocols is a list of protocols supported by the codec
+ */
+ std::list<std::string> protocols;
+ };
+
+ typedef std::list<CodecDescription> CodecList;
+}
+#endif
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]