ekiga r5905 - in trunk: . src/endpoints



Author: dsandras
Date: Sun Jan 13 09:14:28 2008
New Revision: 5905
URL: http://svn.gnome.org/viewvc/ekiga?rev=5905&view=rev

Log:
Improved code by adding a new class extending the CodecList class
and allowing to create a CodecList from an OpalMediaFormatList.


Modified:
   trunk/ChangeLog
   trunk/src/endpoints/manager.cpp
   trunk/src/endpoints/opal-codec-description.cpp
   trunk/src/endpoints/opal-codec-description.h

Modified: trunk/src/endpoints/manager.cpp
==============================================================================
--- trunk/src/endpoints/manager.cpp	(original)
+++ trunk/src/endpoints/manager.cpp	Sun Jan 13 09:14:28 2008
@@ -152,28 +152,6 @@
 }
 
 
-static void from_media_formats_to_codec_list (OpalMediaFormatList & full_list, Ekiga::CodecList & codecs)
-{
-  for (PINDEX i = 0 ; i < full_list.GetSize () ; i++) {
-
-    if (full_list [i].IsTransportable ()) {
-
-      Ekiga::CodecDescription desc = Opal::CodecDescription (full_list [i]);
-
-      Ekiga::CodecList::iterator it = 
-        search_n (codecs.begin (), codecs.end (), 1, desc, same_codec_desc);
-      if (it == codecs.end ()) 
-        codecs.push_back (desc);
-      else {
-        it->protocols.sort ();
-        it->protocols.merge (desc.protocols);
-        it->protocols.unique ();
-      }
-    }
-  }
-}
-
-
 static void 
 fullname_changed_nt (G_GNUC_UNUSED gpointer id,
 		     GmConfEntry *entry, 
@@ -944,7 +922,7 @@
 
   // Build the Ekiga::CodecList from the available OpalMediaFormats
   GetAllowedFormats (full_list);
-  from_media_formats_to_codec_list (full_list, all_codecs);
+  all_codecs = Opal::CodecList (full_list);
 
   // Build the Ekiga::CodecList from the configuration
   codecs_config = gm_conf_get_string_list (AUDIO_CODECS_KEY "list");

Modified: trunk/src/endpoints/opal-codec-description.cpp
==============================================================================
--- trunk/src/endpoints/opal-codec-description.cpp	(original)
+++ trunk/src/endpoints/opal-codec-description.cpp	Sun Jan 13 09:14:28 2008
@@ -42,6 +42,12 @@
 using namespace Opal;
 
 
+static  bool same_codec_desc (Ekiga::CodecDescription a, Ekiga::CodecDescription b)
+{ 
+  return (a.name == b.name && a.rate == b.rate); 
+}
+
+
 CodecDescription::CodecDescription (OpalMediaFormat & format)
 : Ekiga::CodecDescription ()
 {
@@ -54,3 +60,25 @@
     protocols.push_back ("H.323");
   protocols.sort ();
 }
+
+
+CodecList::CodecList (OpalMediaFormatList & list)
+{
+  for (PINDEX i = 0 ; i < list.GetSize () ; i++) {
+
+    if (list [i].IsTransportable ()) {
+
+      Ekiga::CodecDescription desc = Opal::CodecDescription (list [i]);
+
+      Ekiga::CodecList::iterator it = 
+        search_n ((*this).begin (), (*this).end (), 1, desc, same_codec_desc);
+      if (it == (*this).end ()) 
+        (*this).push_back (desc);
+      else {
+        it->protocols.sort ();
+        it->protocols.merge (desc.protocols);
+        it->protocols.unique ();
+      }
+    }
+  }
+}

Modified: trunk/src/endpoints/opal-codec-description.h
==============================================================================
--- trunk/src/endpoints/opal-codec-description.h	(original)
+++ trunk/src/endpoints/opal-codec-description.h	Sun Jan 13 09:14:28 2008
@@ -56,5 +56,22 @@
        */
       CodecDescription (OpalMediaFormat & format);
     };
+
+
+  class CodecList 
+    : public Ekiga::CodecList
+    {
+  public :
+
+      /** Constructor that creates an empty CodecList
+       */
+      CodecList () {};
+
+
+      /** Constructor that creates a CodecList from an OpalMediaFormatList
+       * @param list is an OpalMediaFormatList
+       */
+      CodecList (OpalMediaFormatList & list);
+    };
 }
 #endif



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