[farsight2/master] Add function to transform a list of CodecAssociation to a list of valid codecs

Olivier Crête olivier.crete at collabora.co.uk
Tue Dec 23 15:22:38 PST 2008


---
 gst/fsrtpconference/fs-rtp-codec-negotiation.c |   30 ++++++++++++++++++++++++
 gst/fsrtpconference/fs-rtp-codec-negotiation.h |    3 ++
 2 files changed, 33 insertions(+), 0 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.c b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
index 5720ce6..ea230a5 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.c
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.c
@@ -664,3 +664,33 @@ codec_association_copy (CodecAssociation *ca)
   return newca;
 }
 
+/**
+ * codec_associations_to_codecs:
+ * @codec_associations: a #GList of CodecAssociation
+ *
+ * Returns a #GList of the #FsCodec that are inside the list of associations
+ * excluding those that are disabled or otherwise receive-only. It copies
+ * the #FsCodec structures.
+ *
+ * Returns: a #GList of #FsCodec
+ */
+GList *
+codec_associations_to_codecs (GList *codec_associations)
+{
+  GList *codecs = NULL;
+  GList *item = NULL;
+
+  for (item = g_list_first (codec_associations);
+       item;
+       item = g_list_next (item))
+  {
+    CodecAssociation *ca = item->data;
+    if (!ca->disable && !ca->recv_only && ca->codec)
+    {
+      codecs = g_list_append (codecs,
+          fs_codec_copy (ca->codec));
+    }
+  }
+
+  return codecs;
+}
diff --git a/gst/fsrtpconference/fs-rtp-codec-negotiation.h b/gst/fsrtpconference/fs-rtp-codec-negotiation.h
index 9a8b173..acb9ef6 100644
--- a/gst/fsrtpconference/fs-rtp-codec-negotiation.h
+++ b/gst/fsrtpconference/fs-rtp-codec-negotiation.h
@@ -69,6 +69,9 @@ lookup_codec_association_by_pt (GList *codec_associations, gint pt);
 CodecAssociation *
 lookup_codec_association_by_codec (GList *codec_associations, FsCodec *codec);
 
+GList *
+codec_associations_to_codecs (GList *codec_associations);
+
 void
 codec_association_list_destroy (GList *list);
 
-- 
1.5.6.5




More information about the farsight-commits mailing list