[farsight2/master] Add a function to know if a parameter for a codec is a config-param or not

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


---
 gst/fsrtpconference/fs-rtp-specific-nego.c |   43 ++++++++++++++++++++++++----
 gst/fsrtpconference/fs-rtp-specific-nego.h |    3 ++
 2 files changed, 40 insertions(+), 6 deletions(-)

diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.c b/gst/fsrtpconference/fs-rtp-specific-nego.c
index 2ff8828..bce0b14 100644
--- a/gst/fsrtpconference/fs-rtp-specific-nego.c
+++ b/gst/fsrtpconference/fs-rtp-specific-nego.c
@@ -37,11 +37,16 @@
 
 #define GST_CAT_DEFAULT fsrtpconference_nego
 
+/*
+ * This must be kept to the maximum number of config parameters + 1
+ */
+#define MAX_CONFIG_PARAMS 3
+
 struct SdpCompatCheck {
   FsMediaType media_type;
   const gchar *encoding_name;
   FsCodec * (* sdp_is_compat) (FsCodec *local_codec, FsCodec *remote_codec);
-  gboolean needs_config;
+  gchar *config_param[MAX_CONFIG_PARAMS];
 };
 
 
@@ -53,10 +58,14 @@ 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, FALSE},
-  {FS_MEDIA_TYPE_VIDEO, "H263-1998", sdp_is_compat_h263_1998, FALSE},
-  {FS_MEDIA_TYPE_AUDIO, "VORBIS", sdp_is_compat_theora_vorbis, TRUE},
-  {FS_MEDIA_TYPE_VIDEO, "THEORA", sdp_is_compat_theora_vorbis, TRUE},
+  {FS_MEDIA_TYPE_AUDIO, "iLBC", sdp_is_compat_ilbc,
+   {NULL}},
+  {FS_MEDIA_TYPE_VIDEO, "H263-1998", sdp_is_compat_h263_1998,
+   {NULL}},
+  {FS_MEDIA_TYPE_AUDIO, "VORBIS", sdp_is_compat_theora_vorbis,
+   {"configuration", NULL}},
+  {FS_MEDIA_TYPE_VIDEO, "THEORA", sdp_is_compat_theora_vorbis,
+   {"configuration", NULL}},
   {0, NULL, NULL}
 };
 
@@ -75,7 +84,29 @@ codec_needs_config (FsCodec *codec)
     if (sdp_compat_checks[i].media_type == codec->media_type &&
         !g_ascii_strcasecmp (sdp_compat_checks[i].encoding_name,
             codec->encoding_name))
-      return sdp_compat_checks[i].needs_config;
+      return (sdp_compat_checks[i].config_param[0] != NULL);
+
+  return FALSE;
+}
+
+
+gboolean
+codec_has_config_data_named (FsCodec *codec, const gchar *name)
+{
+  gint i, j;
+
+  g_return_val_if_fail (codec, FALSE);
+
+  for (i = 0; sdp_compat_checks[i].sdp_is_compat; i++)
+    if (sdp_compat_checks[i].media_type == codec->media_type &&
+        !g_ascii_strcasecmp (sdp_compat_checks[i].encoding_name,
+            codec->encoding_name))
+    {
+      for (j = 0; sdp_compat_checks[i].config_param[j]; j++)
+        if (!g_ascii_strcasecmp (sdp_compat_checks[i].config_param[j], name))
+          return TRUE;
+      return FALSE;
+    }
 
   return FALSE;
 }
diff --git a/gst/fsrtpconference/fs-rtp-specific-nego.h b/gst/fsrtpconference/fs-rtp-specific-nego.h
index aea5d9a..b9b03cb 100644
--- a/gst/fsrtpconference/fs-rtp-specific-nego.h
+++ b/gst/fsrtpconference/fs-rtp-specific-nego.h
@@ -37,6 +37,9 @@ sdp_is_compat (FsCodec *local_codec, FsCodec *remote_codec);
 gboolean
 codec_needs_config (FsCodec *codec);
 
+gboolean
+codec_has_config_data_named (FsCodec *codec, const gchar *name);
+
 G_END_DECLS
 
 #endif
-- 
1.5.6.5




More information about the farsight-commits mailing list