[farsight2/master] Add beginning of simple command-line call app

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


---
 .gitignore                      |    1 +
 configure.ac                    |    1 +
 tests/Makefile.am               |    4 +-
 tests/commandline/Makefile.am   |   14 +++++++
 tests/commandline/simple-call.c |   76 +++++++++++++++++++++++++++++++++++++++
 5 files changed, 94 insertions(+), 2 deletions(-)
 create mode 100644 tests/commandline/Makefile.am
 create mode 100644 tests/commandline/simple-call.c

diff --git a/.gitignore b/.gitignore
index 7c0416a..68b1db0 100644
--- a/.gitignore
+++ b/.gitignore
@@ -50,6 +50,7 @@ tests/check/rtp/codecs
 tests/check/rtp/sendcodecs
 tests/check/utils/binadded
 tests/rtp/codec-discovery
+tests/commandline/simple-call
 tests/gui/*.pyo
 tests/gui/*.pyc
 
diff --git a/configure.ac b/configure.ac
index e5aa1ca..fee1a63 100644
--- a/configure.ac
+++ b/configure.ac
@@ -388,6 +388,7 @@ tests/Makefile
 tests/check/Makefile
 tests/rtp/Makefile
 tests/gui/Makefile
+tests/commandline/Makefile
 docs/Makefile
 docs/libs/Makefile
 docs/version.entities
diff --git a/tests/Makefile.am b/tests/Makefile.am
index ae5ff97..dd4f823 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -4,6 +4,6 @@ else
 SUBDIRS_CHECK =
 endif
 
-SUBDIRS = $(SUBDIRS_CHECK) rtp gui
+SUBDIRS = $(SUBDIRS_CHECK) rtp gui commandline
 
-DIST_SUBDIRS =  check rtp gui
+DIST_SUBDIRS = check rtp gui commandline
diff --git a/tests/commandline/Makefile.am b/tests/commandline/Makefile.am
new file mode 100644
index 0000000..d374e67
--- /dev/null
+++ b/tests/commandline/Makefile.am
@@ -0,0 +1,14 @@
+
+noinst_PROGRAMS = simple-call
+
+
+AM_CFLAGS = \
+	-I$(top_srcdir)/gst/fsrtpconference/ \
+	$(FS2_INTERNAL_CFLAGS) \
+	$(FS2_CFLAGS) \
+	$(GST_CFLAGS) \
+	$(CFLAGS)
+
+LDADD = \
+	$(top_builddir)/gst-libs/gst/farsight/libgstfarsight-0.10.la \
+	$(GST_LIBS) 
diff --git a/tests/commandline/simple-call.c b/tests/commandline/simple-call.c
new file mode 100644
index 0000000..2a04298
--- /dev/null
+++ b/tests/commandline/simple-call.c
@@ -0,0 +1,76 @@
+
+#include <glib.h>
+#include <gst/gst.h>
+#include <gst/farsight/fs-conference-iface.h>
+
+#define DEFAULT_AUDIO_SRC       "alsasrc"
+#define DEFAULT_AUDIO_SINK      "alsasink"
+
+typedef enum {
+  NONE,
+  CLIENT,
+  SERVER }
+  ClientServer;
+
+static gboolean
+async_bus_cb (GstBus *bus, GstMessage *message, gpointer user_data)
+{
+  return TRUE;
+}
+
+int main (int argc, char **argv)
+{
+  GMainLoop *loop = NULL;
+  GstElement *pipeline = NULL;
+  GstBus *bus = NULL;
+  ClientServer mode = NONE;
+  gchar *ip;
+  guint port = 0;
+  GstElement *conf = NULL;
+
+  gst_init (&argc, &argv);
+
+  if (argc == 0)
+    mode = SERVER;
+  else if (argc == 2)
+  {
+    mode = CLIENT;
+    port = atoi (argv[2]);
+    if (!port)
+    {
+      g_print ("Usage: %s [ip] [port]\n", argv[0]);
+      return 1;
+    }
+    ip = argv[1];
+  }
+  else
+  {
+    g_print ("Usage: %s [ip] [port]\n", argv[0]);
+    return 1;
+  }
+
+  loop = g_main_loop_new (NULL, FALSE);
+
+  pipeline = gst_pipeline_new (NULL);
+
+  bus = gst_pipeline_get_bus (GST_PIPELINE (pipeline));
+  gst_bus_add_watch (bus, async_bus_cb, pipeline);
+  gst_object_unref (bus);
+
+  conf = gst_element_factory_make ("fsrtpconference", NULL);
+
+  g_assert (gst_bin_add (GST_BIN (pipeline), conf));
+
+  g_assert (gst_element_set_state (pipeline, GST_STATE_PLAYING)
+      != GST_STATE_CHANGE_FAILURE);
+
+  g_main_loop_run (loop);
+
+  g_assert (gst_element_set_state (pipeline, GST_STATE_NULL)
+      != GST_STATE_CHANGE_FAILURE);
+
+  g_main_loop_unref (loop);
+  gst_object_unref (pipeline);
+
+  return 0;
+}
-- 
1.5.6.5




More information about the farsight-commits mailing list