[farsight2/master] Make the rtp codec discovery test use the standard gst debug
Olivier Crête
olivier.crete at collabora.co.uk
Tue Dec 23 15:21:35 PST 2008
---
gst/fsrtpconference/fs-rtp-codec-cache.c | 12 +---
gst/fsrtpconference/fs-rtp-discover-codecs.c | 13 +----
tests/rtp/Makefile.am | 3 +-
tests/rtp/codec-discovery.c | 74 +++++++++++++++++++++++--
4 files changed, 74 insertions(+), 28 deletions(-)
diff --git a/gst/fsrtpconference/fs-rtp-codec-cache.c b/gst/fsrtpconference/fs-rtp-codec-cache.c
index d0048e7..a748662 100644
--- a/gst/fsrtpconference/fs-rtp-codec-cache.c
+++ b/gst/fsrtpconference/fs-rtp-codec-cache.c
@@ -30,20 +30,14 @@
#include "fs-rtp-codec-cache.h"
+#include "fs-rtp-conference.h"
+
#include <gst/farsight/fs-conference-iface.h>
#include <string.h>
#include <unistd.h>
-#ifdef STANDALONE
-# undef GST_WARNING
-# undef GST_DEBUG
-# define GST_DEBUG(...) g_debug (__VA_ARGS__)
-# define GST_WARNING(...) g_warning (__VA_ARGS__)
-#else
-# include "fs-rtp-conference.h"
-# define GST_CAT_DEFAULT fsrtpconference_disco
-#endif
+#define GST_CAT_DEFAULT fsrtpconference_disco
static gboolean codecs_cache_valid(gchar *cache_path) {
time_t cache_ts = 0;
diff --git a/gst/fsrtpconference/fs-rtp-discover-codecs.c b/gst/fsrtpconference/fs-rtp-discover-codecs.c
index f4ee609..435fb14 100644
--- a/gst/fsrtpconference/fs-rtp-discover-codecs.c
+++ b/gst/fsrtpconference/fs-rtp-discover-codecs.c
@@ -34,23 +34,14 @@
#include "fs-rtp-discover-codecs.h"
+#include "fs-rtp-conference.h"
#include "fs-rtp-codec-cache.h"
#include <gst/farsight/fs-conference-iface.h>
#include <string.h>
-#ifdef STANDALONE
-# undef GST_WARNING
-# undef GST_DEBUG
-# undef GST_LOG
-# define GST_WARNING(...) g_warning (__VA_ARGS__)
-# define GST_DEBUG(...) g_debug (__VA_ARGS__)
-# define GST_LOG(...) g_debug (__VA_ARGS__)
-#else
-# include "fs-rtp-conference.h"
-# define GST_CAT_DEFAULT fsrtpconference_disco
-#endif
+#define GST_CAT_DEFAULT fsrtpconference_disco
/*
* Local TYPES
diff --git a/tests/rtp/Makefile.am b/tests/rtp/Makefile.am
index 8e41d18..40612c8 100644
--- a/tests/rtp/Makefile.am
+++ b/tests/rtp/Makefile.am
@@ -5,7 +5,6 @@ codec_discovery_SOURCES = codec-discovery.c \
$(top_srcdir)/gst/fsrtpconference/fs-rtp-discover-codecs.c \
$(top_srcdir)/gst/fsrtpconference/fs-rtp-codec-cache.c
codec_discovery_CFLAGS = -I$(top_srcdir)/gst/fsrtpconference/ \
- $(FS2_INTERNAL_CFLAGS) $(FS2_CFLAGS) $(GST_CFLAGS) $(CFLAGS) \
- -DSTANDALONE
+ $(FS2_INTERNAL_CFLAGS) $(FS2_CFLAGS) $(GST_CFLAGS) $(CFLAGS)
LDADD = $(GST_LIBS) $(GST_CHECK_LIBS) \
$(top_builddir)/gst-libs/gst/farsight/libgstfarsight-0.10.la
diff --git a/tests/rtp/codec-discovery.c b/tests/rtp/codec-discovery.c
index 0b5265b..39788b5 100644
--- a/tests/rtp/codec-discovery.c
+++ b/tests/rtp/codec-discovery.c
@@ -24,6 +24,54 @@
#include "fs-rtp-discover-codecs.h"
+
+GST_DEBUG_CATEGORY (fsrtpconference_debug);
+GST_DEBUG_CATEGORY (fsrtpconference_disco);
+GST_DEBUG_CATEGORY (fsrtpconference_nego);
+
+
+static void
+debug_pipeline (GList *pipeline)
+{
+ GList *walk;
+
+ for (walk = pipeline; walk; walk = g_list_next (walk))
+ {
+ GList *walk2;
+ for (walk2 = g_list_first (walk->data); walk2; walk2 = g_list_next (walk2))
+ g_message ("%p:%d:%s ", walk2->data,
+ GST_OBJECT_REFCOUNT_VALUE(GST_OBJECT (walk2->data)),
+ gst_plugin_feature_get_name (GST_PLUGIN_FEATURE (walk2->data)));
+ g_message ("--");
+ }
+}
+
+static void
+debug_blueprint (CodecBlueprint *blueprint)
+{
+ gchar *str;
+
+ str = fs_codec_to_string (blueprint->codec);
+ g_message ("Codec: %s", str);
+ g_free (str);
+
+ str = gst_caps_to_string (blueprint->media_caps);
+ g_message ("media_caps: %s", str);
+ g_free (str);
+
+ str = gst_caps_to_string (blueprint->rtp_caps);
+ g_message ("rtp_caps: %s", str);
+ g_free (str);
+
+ g_message ("send pipeline:");
+ debug_pipeline (blueprint->send_pipeline_factory);
+
+ g_message ("recv pipeline:");
+ debug_pipeline (blueprint->send_pipeline_factory);
+
+ g_message ("================================");
+}
+
int main (int argc, char **argv)
{
GList *elements = NULL;
@@ -31,31 +79,45 @@ int main (int argc, char **argv)
gst_init (&argc, &argv);
- g_debug ("AUDIO STARTING!!");
+ GST_DEBUG_CATEGORY_INIT (fsrtpconference_debug, "fsrtpconference", 0,
+ "Farsight RTP Conference Element");
+ GST_DEBUG_CATEGORY_INIT (fsrtpconference_disco, "fsrtpconference_disco",
+ 0, "Farsight RTP Codec Discovery");
+ GST_DEBUG_CATEGORY_INIT (fsrtpconference_nego, "fsrtpconference_nego",
+ 0, "Farsight RTP Codec Negotiation");
+
+ gst_debug_set_default_threshold (GST_LEVEL_WARNING);
+
+ g_message ("AUDIO STARTING!!");
elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_AUDIO, &error);
if (error)
- g_debug ("Error: %s", error->message);
+ g_message ("Error: %s", error->message);
+ else
+ g_list_foreach (elements, (GFunc) debug_blueprint, NULL);
g_clear_error (&error);
+
fs_rtp_blueprints_unref (FS_MEDIA_TYPE_AUDIO);
- g_debug ("AUDIO FINISHED!!");
+ g_message ("AUDIO FINISHED!!");
- g_debug ("VIDEO STARTING!!");
+ g_message ("VIDEO STARTING!!");
elements = fs_rtp_blueprints_get (FS_MEDIA_TYPE_VIDEO, &error);
if (error)
- g_debug ("Error: %s", error->message);
+ g_message ("Error: %s", error->message);
+ else
+ g_list_foreach (elements, (GFunc) debug_blueprint, NULL);
g_clear_error (&error);
fs_rtp_blueprints_unref (FS_MEDIA_TYPE_VIDEO);
- g_debug ("VIDEO FINISHED!!");
+ g_message ("VIDEO FINISHED!!");
return 0;
}
--
1.5.6.5
More information about the farsight-commits
mailing list