[farsight2/master] Add vorbis/theora negotiation functions

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


---
 gst/fsrtpconference/fs-rtp-specific-nego.c |   49 ++++++++++++++++++++++++++--
 1 files changed, 46 insertions(+), 3 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.c b/gst/fsrtpconference/fs-rtp-specific-nego.c
index 785d61c..de607b9 100644
--- a/gst/fsrtpconference/fs-rtp-specific-nego.c
+++ b/gst/fsrtpconference/fs-rtp-specific-nego.c
@@ -2,8 +2,8 @@
  * fs-rtp-specific-nego.c - Per-codec SDP negotiation
  *
  * Farsight RTP/AVP/SAVP/AVPF Module
- * Copyright (C) 2007 Collabora Ltd.
- * Copyright (C) 2007 Nokia Corporation
+ * Copyright (C) 2007-2008 Collabora Ltd.
+ * Copyright (C) 2007-2008 Nokia Corporation
  *   @author Olivier Crete <olivier.crete at collabora.co.uk>
  *
  * This library is free software; you can redistribute it and/or
@@ -48,10 +48,14 @@ static FsCodec *
 sdp_is_compat_ilbc (FsCodec *local_codec, FsCodec *remote_codec);
 static FsCodec *
 sdp_is_compat_h263_1998 (FsCodec *local_codec, FsCodec *remote_codec);
+static FsCodec *
+sdp_is_compat_theora_vorbis (FsCodec *local_codec, FsCodec *remote_codec);
 
 static struct SdpCompatCheck sdp_compat_checks[] = {
   {FS_MEDIA_TYPE_AUDIO, "iLBC", sdp_is_compat_ilbc},
   {FS_MEDIA_TYPE_VIDEO, "H263-1998", sdp_is_compat_h263_1998},
+  {FS_MEDIA_TYPE_AUDIO, "VORBIS", sdp_is_compat_theora_vorbis},
+  {FS_MEDIA_TYPE_VIDEO, "THEORA", sdp_is_compat_theora_vorbis},
   {0, NULL, NULL}
 };
 
@@ -264,7 +268,6 @@ sdp_is_compat_ilbc (FsCodec *local_codec, FsCodec *remote_codec)
 }
 
 
-
 static FsCodec *
 sdp_is_compat_h263_1998 (FsCodec *local_codec, FsCodec *remote_codec)
 {
@@ -335,3 +338,43 @@ sdp_is_compat_h263_1998 (FsCodec *local_codec, FsCodec *remote_codec)
   negotiated_codec = fs_codec_copy (local_codec);
   return negotiated_codec;
 }
+
+
+static FsCodec *
+sdp_is_compat_theora_vorbis (FsCodec *local_codec, FsCodec *remote_codec)
+{
+  FsCodec *negotiated_codec = NULL;
+  FsCodec *tmp_remote_codec;
+  GList *item = NULL;
+
+  GST_DEBUG ("Using Theora/Vorbis negotiation function");
+
+  tmp_remote_codec = fs_codec_copy (remote_codec);
+
+  for (item = tmp_remote_codec->optional_params;
+       item;
+       item = g_list_next (item))
+  {
+    FsCodecParameter *param = item->data;
+
+    if (!g_ascii_strcasecmp ("configuration", param->name))
+    {
+      GList *nextitem = item->next;
+
+      tmp_remote_codec->optional_params = g_list_delete_link (
+          tmp_remote_codec->optional_params, item);
+
+      tmp_remote_codec->config_params = g_list_append (
+          tmp_remote_codec->config_params, param);
+
+      item = nextitem;
+    }
+  }
+
+  negotiated_codec = sdp_is_compat_default (local_codec, tmp_remote_codec);
+
+  fs_codec_destroy (tmp_remote_codec);
+
+  return negotiated_codec;
+}
+
-- 
1.5.6.5




More information about the farsight-commits mailing list