[farsight2/master] Remove fs_codec_to_gst_caps from the public api

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


---
 docs/libs/farsight2-libs-sections.txt   |    1 -
 gst-libs/gst/farsight/fs-codec.c        |   68 ------------------------------
 gst-libs/gst/farsight/fs-codec.h        |    2 -
 gst/fsrtpconference/fs-rtp-conference.c |   70 +++++++++++++++++++++++++++++++
 gst/fsrtpconference/fs-rtp-conference.h |    4 ++
 tests/check/base/fscodec.c              |   36 ----------------
 tests/rtp/Makefile.am                   |   10 ++++-
 tests/rtp/codec-discovery.c             |    6 +--
 8 files changed, 84 insertions(+), 113 deletions(-)

diff --git a/docs/libs/farsight2-libs-sections.txt b/docs/libs/farsight2-libs-sections.txt
index 63f6aaf..5007407 100644
--- a/docs/libs/farsight2-libs-sections.txt
+++ b/docs/libs/farsight2-libs-sections.txt
@@ -121,7 +121,6 @@ fs_codec_list_destroy
 fs_codec_list_copy
 fs_codec_list_are_equal
 fs_codec_to_string
-fs_codec_to_gst_caps
 fs_codec_add_optional_parameter
 fs_codec_remove_optional_parameter
 fs_codec_get_optional_parameter
diff --git a/gst-libs/gst/farsight/fs-codec.c b/gst-libs/gst/farsight/fs-codec.c
index 4b3d7c7..608972a 100644
--- a/gst-libs/gst/farsight/fs-codec.c
+++ b/gst-libs/gst/farsight/fs-codec.c
@@ -539,74 +539,6 @@ fs_codec_are_equal (const FsCodec *codec1, const FsCodec *codec2)
 }
 
 /**
- * fs_codec_to_gst_caps
- * @codec: A #FsCodec to be converted
- *
- * This function converts a #FsCodec to a fixed #GstCaps with media type
- * application/x-rtp.
- *
- * Return value: A newly-allocated #GstCaps or %NULL if the codec was %NULL
- */
-
-GstCaps *
-fs_codec_to_gst_caps (const FsCodec *codec)
-{
-  GstCaps *caps;
-  GstStructure *structure;
-  GList *item;
-
-  if (codec == NULL)
-    return NULL;
-
-  structure = gst_structure_new ("application/x-rtp", NULL);
-
-  if (codec->encoding_name)
-  {
-    gchar *encoding_name = g_ascii_strup (codec->encoding_name, -1);
-
-    if (!g_ascii_strcasecmp (encoding_name, "H263-N800")) {
-      g_free (encoding_name);
-      encoding_name = g_strdup ("H263-1998");
-    }
-
-    gst_structure_set (structure,
-        "encoding-name", G_TYPE_STRING, encoding_name,
-        NULL);
-    g_free (encoding_name);
-  }
-
-  if (codec->clock_rate)
-    gst_structure_set (structure,
-      "clock-rate", G_TYPE_INT, codec->clock_rate, NULL);
-
-  if (fs_media_type_to_string (codec->media_type))
-    gst_structure_set (structure, "media", G_TYPE_STRING,
-      fs_media_type_to_string (codec->media_type), NULL);
-
-  if (codec->id >= 0 && codec->id < 128)
-    gst_structure_set (structure, "payload", G_TYPE_INT, codec->id, NULL);
-
-  if (codec->channels)
-    gst_structure_set (structure, "channels", G_TYPE_INT, codec->channels,
-      NULL);
-
-  for (item = codec->optional_params;
-       item;
-       item = g_list_next (item)) {
-    FsCodecParameter *param = item->data;
-    gchar *lower_name = g_ascii_strdown (param->name, -1);
-    gst_structure_set (structure, lower_name, G_TYPE_STRING, param->value,
-      NULL);
-    g_free (lower_name);
-  }
-
-  caps = gst_caps_new_full (structure, NULL);
-
-  return caps;
-}
-
-
-/**
  * fs_codec_list_are_equal:
  * @list1: a #GList of #FsCodec
  * @list2: a #GList of #FsCodec
diff --git a/gst-libs/gst/farsight/fs-codec.h b/gst-libs/gst/farsight/fs-codec.h
index cad75fe..edcd21a 100644
--- a/gst-libs/gst/farsight/fs-codec.h
+++ b/gst-libs/gst/farsight/fs-codec.h
@@ -150,8 +150,6 @@ gchar *fs_codec_to_string (const FsCodec *codec);
 
 gboolean fs_codec_are_equal (const FsCodec *codec1, const FsCodec *codec2);
 
-GstCaps *fs_codec_to_gst_caps (const FsCodec *codec);
-
 gboolean fs_codec_list_are_equal (GList *list1, GList *list2);
 
 const gchar *fs_media_type_to_string (FsMediaType media_type);
diff --git a/gst/fsrtpconference/fs-rtp-conference.c b/gst/fsrtpconference/fs-rtp-conference.c
index 56b2c5b..25eae9c 100644
--- a/gst/fsrtpconference/fs-rtp-conference.c
+++ b/gst/fsrtpconference/fs-rtp-conference.c
@@ -757,3 +757,73 @@ fs_rtp_conference_change_state (GstElement *element, GstStateChange transition)
     return result;
   }
 }
+
+
+
+/**
+ * fs_codec_to_gst_caps
+ * @codec: A #FsCodec to be converted
+ *
+ * This function converts a #FsCodec to a fixed #GstCaps with media type
+ * application/x-rtp.
+ *
+ * Return value: A newly-allocated #GstCaps or %NULL if the codec was %NULL
+ */
+
+GstCaps *
+fs_codec_to_gst_caps (const FsCodec *codec)
+{
+  GstCaps *caps;
+  GstStructure *structure;
+  GList *item;
+
+  if (codec == NULL)
+    return NULL;
+
+  structure = gst_structure_new ("application/x-rtp", NULL);
+
+  if (codec->encoding_name)
+  {
+    gchar *encoding_name = g_ascii_strup (codec->encoding_name, -1);
+
+    if (!g_ascii_strcasecmp (encoding_name, "H263-N800")) {
+      g_free (encoding_name);
+      encoding_name = g_strdup ("H263-1998");
+    }
+
+    gst_structure_set (structure,
+        "encoding-name", G_TYPE_STRING, encoding_name,
+        NULL);
+    g_free (encoding_name);
+  }
+
+  if (codec->clock_rate)
+    gst_structure_set (structure,
+      "clock-rate", G_TYPE_INT, codec->clock_rate, NULL);
+
+  if (fs_media_type_to_string (codec->media_type))
+    gst_structure_set (structure, "media", G_TYPE_STRING,
+      fs_media_type_to_string (codec->media_type), NULL);
+
+  if (codec->id >= 0 && codec->id < 128)
+    gst_structure_set (structure, "payload", G_TYPE_INT, codec->id, NULL);
+
+  if (codec->channels)
+    gst_structure_set (structure, "channels", G_TYPE_INT, codec->channels,
+      NULL);
+
+  for (item = codec->optional_params;
+       item;
+       item = g_list_next (item)) {
+    FsCodecParameter *param = item->data;
+    gchar *lower_name = g_ascii_strdown (param->name, -1);
+    gst_structure_set (structure, lower_name, G_TYPE_STRING, param->value,
+      NULL);
+    g_free (lower_name);
+  }
+
+  caps = gst_caps_new_full (structure, NULL);
+
+  return caps;
+}
+
diff --git a/gst/fsrtpconference/fs-rtp-conference.h b/gst/fsrtpconference/fs-rtp-conference.h
index 1b13fd8..79288de 100644
--- a/gst/fsrtpconference/fs-rtp-conference.h
+++ b/gst/fsrtpconference/fs-rtp-conference.h
@@ -71,6 +71,10 @@ GST_DEBUG_CATEGORY_EXTERN (fsrtpconference_debug);
 GST_DEBUG_CATEGORY_EXTERN (fsrtpconference_disco);
 GST_DEBUG_CATEGORY_EXTERN (fsrtpconference_nego);
 
+
+GstCaps *fs_codec_to_gst_caps (const FsCodec *codec);
+
+
 G_END_DECLS
 
 #endif /* __FS_RTP_CONFERENCE_H__ */
diff --git a/tests/check/base/fscodec.c b/tests/check/base/fscodec.c
index a8f5c08..16288c2 100644
--- a/tests/check/base/fscodec.c
+++ b/tests/check/base/fscodec.c
@@ -181,39 +181,6 @@ GST_START_TEST (test_fscodec_copy)
 }
 GST_END_TEST;
 
-
-GST_START_TEST (test_fscodec_to_gst_caps)
-{
-  FsCodec *codec = init_codec_with_three_params ();
-  GstCaps *compare_caps = gst_caps_new_simple ("application/x-rtp",
-      "encoding-name", G_TYPE_STRING, "AA", // encoding names are in caps in gst
-      "clock-rate", G_TYPE_INT, 650,
-      "payload", G_TYPE_INT, 1,
-      "media", G_TYPE_STRING, "application",
-      "aa1", G_TYPE_STRING, "bb1",
-      "aa2", G_TYPE_STRING, "bb2",
-      "aa3", G_TYPE_STRING, "bb3",
-      NULL);
-  GstCaps *caps = fs_codec_to_gst_caps (codec);
-  gchar *caps_string = gst_caps_to_string (caps);
-  gchar *compare_caps_string = gst_caps_to_string (compare_caps);
-
-  fail_if (caps == NULL, "Could not create caps");
-
-  fail_unless (gst_caps_is_fixed (caps), "Generated caps are not fixed");
-
-  fail_unless (gst_caps_is_equal_fixed (caps, compare_caps),
-      "The generated caps are incorrect (caps (%s) != compare_caps (%s))",
-      caps_string, compare_caps_string);
-
-  g_free (caps_string);
-  g_free (compare_caps_string);
-  gst_caps_unref (caps);
-  gst_caps_unref (compare_caps);
-  fs_codec_destroy (codec);
-}
-GST_END_TEST;
-
 GST_START_TEST (test_fscodec_null)
 {
   gchar *str;
@@ -228,8 +195,6 @@ GST_START_TEST (test_fscodec_null)
       "Failed to print NULL codec");
   g_free (str);
   fail_unless (fs_codec_are_equal (NULL,NULL), "NULL codecs are not equal");
-  fail_unless (fs_codec_to_gst_caps (NULL) == NULL,
-      "NULL codec does not produce NULL caps");
 }
 GST_END_TEST;
 
@@ -245,7 +210,6 @@ fscodec_suite (void)
   tcase_add_test (tc_chain, test_fscodec_are_equal);
   tcase_add_test (tc_chain, test_fscodec_are_equal_opt_params);
   tcase_add_test (tc_chain, test_fscodec_copy);
-  tcase_add_test (tc_chain, test_fscodec_to_gst_caps);
   tcase_add_test (tc_chain, test_fscodec_null);
 
   return s;
diff --git a/tests/rtp/Makefile.am b/tests/rtp/Makefile.am
index 92e5d3d..54f383c 100644
--- a/tests/rtp/Makefile.am
+++ b/tests/rtp/Makefile.am
@@ -8,7 +8,14 @@ codec_discovery_SOURCES = codec-discovery.c \
 		$(top_srcdir)/gst/fsrtpconference/fs-rtp-dtmf-event-source.c \
 		$(top_srcdir)/gst/fsrtpconference/fs-rtp-dtmf-sound-source.c \
 		$(top_srcdir)/gst/fsrtpconference/fs-rtp-codec-negotiation.c \
-		$(top_srcdir)/gst/fsrtpconference/fs-rtp-specific-nego.c
+		$(top_srcdir)/gst/fsrtpconference/fs-rtp-specific-nego.c \
+		$(top_srcdir)/gst/fsrtpconference/fs-rtp-conference.c \
+		$(top_srcdir)/gst/fsrtpconference/fs-rtp-session.c \
+		$(top_srcdir)/gst/fsrtpconference/fs-rtp-stream.c \
+		$(top_srcdir)/gst/fsrtpconference/fs-rtp-substream.c \
+		$(top_srcdir)/gst/fsrtpconference/fs-rtp-participant.c \
+		$(top_srcdir)/gst/fsrtpconference/fs-rtp-marshal.c
+
 codec_discovery_CFLAGS = \
 	-I$(top_srcdir)/gst/fsrtpconference/ \
 	$(FS2_INTERNAL_CFLAGS) \
@@ -19,4 +26,5 @@ codec_discovery_CFLAGS = \
 LDADD = \
 	$(top_builddir)/gst-libs/gst/farsight/libgstfarsight-0.10.la \
 	$(GST_CHECK_LIBS) \
+	-lgstrtp- at GST_MAJORMINOR@ \
 	$(GST_LIBS) 
diff --git a/tests/rtp/codec-discovery.c b/tests/rtp/codec-discovery.c
index 39788b5..3512604 100644
--- a/tests/rtp/codec-discovery.c
+++ b/tests/rtp/codec-discovery.c
@@ -23,11 +23,7 @@
 #include <gst/farsight/fs-codec.h>
 
 #include "fs-rtp-discover-codecs.h"
-
-
-GST_DEBUG_CATEGORY (fsrtpconference_debug);
-GST_DEBUG_CATEGORY (fsrtpconference_disco);
-GST_DEBUG_CATEGORY (fsrtpconference_nego);
+#include "fs-rtp-conference.h"
 
 
 static void
-- 
1.5.6.5




More information about the farsight-commits mailing list