eventually there will be an autopluggins test suite here that will verify plugin...
authorAndy Wingo <wingo@pobox.com>
Fri, 4 Jan 2002 22:54:20 +0000 (22:54 +0000)
committerAndy Wingo <wingo@pobox.com>
Fri, 4 Jan 2002 22:54:20 +0000 (22:54 +0000)
Original commit message from CVS:
eventually there will be an autopluggins test suite here that will verify plugin caps.
for now what we have was taken from gstreamer/tests/.

testsuite/autoplug/autoplug.c [new file with mode: 0644]
testsuite/autoplug/autoplug2.c [new file with mode: 0644]
testsuite/autoplug/autoplug3.c [new file with mode: 0644]
testsuite/autoplug/autoplug4.c [new file with mode: 0644]

diff --git a/testsuite/autoplug/autoplug.c b/testsuite/autoplug/autoplug.c
new file mode 100644 (file)
index 0000000..2129225
--- /dev/null
@@ -0,0 +1,45 @@
+#include <gst/gst.h>
+
+static void
+new_object_added (GstAutoplug *autoplug, GstObject *object)
+{
+  g_print ("added new object \"%s\"\n", gst_object_get_name (object));
+}
+
+int
+main (int argc, char *argv[])
+{
+  GstElement *element;
+  GstElement *videosink, *osssink;
+  GstAutoplug *autoplugger;
+  GstCaps *testcaps;
+
+  gst_init(&argc,&argv);
+
+  osssink = gst_elementfactory_make ("osssink", "osssink");
+  g_assert (osssink != NULL);
+  videosink = gst_elementfactory_make ("xvideosink", "videosink");
+  g_assert (videosink != NULL);
+
+  testcaps = gst_caps_new ("test_caps",
+                        "video/mpeg",
+                        gst_props_new (
+                          "mpegversion",  GST_PROPS_INT (1),
+                          "systemstream", GST_PROPS_BOOLEAN (TRUE),
+                          NULL));
+
+  autoplugger = gst_autoplugfactory_make ("static");
+
+  g_signal_connect (G_OBJECT (autoplugger), "new_object",
+                   G_CALLBACK (new_object_added), NULL);
+
+  element = gst_autoplug_to_caps (autoplugger, testcaps,
+                 gst_pad_get_caps (gst_element_get_pad (osssink, "sink")),
+                 gst_pad_get_caps (gst_element_get_pad (videosink, "sink")),
+                 NULL);
+  g_assert (element != NULL);
+
+  xmlDocDump (stdout, gst_xml_write (element));
+
+  exit (0);
+}
diff --git a/testsuite/autoplug/autoplug2.c b/testsuite/autoplug/autoplug2.c
new file mode 100644 (file)
index 0000000..8d2aee9
--- /dev/null
@@ -0,0 +1,77 @@
+#include <gst/gst.h>
+
+static GstElement*
+autoplug_caps (GstAutoplug *autoplug, gchar *mime1, gchar *mime2)
+{
+  GstCaps *caps1, *caps2;
+
+  caps1 = gst_caps_new ("tescaps1", mime1, NULL);
+  caps2 = gst_caps_new ("tescaps2", mime2, NULL);
+
+  return gst_autoplug_to_caps (autoplug, caps1, caps2, NULL);
+}
+
+int
+main (int argc, char *argv[])
+{
+  GstElement *element;
+  GstAutoplug *autoplug;
+
+  gst_init(&argc,&argv);
+
+  autoplug = gst_autoplugfactory_make ("static");
+  
+  element = autoplug_caps (autoplug, "audio/mp3", "audio/raw");
+  xmlSaveFile ("autoplug2_1.gst", gst_xml_write (element));
+
+  element = autoplug_caps (autoplug, "video/mpeg", "audio/raw");
+  xmlSaveFile ("autoplug2_2.gst", gst_xml_write (element));
+
+  element = gst_autoplug_to_caps (autoplug,
+                 gst_caps_new(
+                         "testcaps3",
+                         "video/mpeg",
+                         gst_props_new (
+                             "mpegversion",  GST_PROPS_INT (1),
+                             "systemstream", GST_PROPS_BOOLEAN (TRUE),
+                             NULL)),
+                 gst_caps_new("testcaps4","audio/raw", NULL),
+                 NULL);
+  xmlSaveFile ("autoplug2_3.gst", gst_xml_write (element));
+
+  element = gst_autoplug_to_caps (autoplug,
+                 gst_caps_new(
+                         "testcaps5",
+                         "video/mpeg",
+                         gst_props_new (
+                             "mpegversion",  GST_PROPS_INT (1),
+                             "systemstream", GST_PROPS_BOOLEAN (FALSE),
+                             NULL)),
+                 gst_caps_new("testcaps6", "video/raw", NULL),
+                 NULL);
+  xmlSaveFile ("autoplug2_4.gst", gst_xml_write (element));
+
+  element = gst_autoplug_to_caps (autoplug,
+                 gst_caps_new(
+                         "testcaps7",
+                         "video/avi", NULL),
+                 gst_caps_new("testcaps8", "video/raw", NULL),
+                 gst_caps_new("testcaps9", "audio/raw", NULL),
+                 NULL);
+  xmlSaveFile ("autoplug2_5.gst", gst_xml_write (element));
+
+  element = gst_autoplug_to_caps (autoplug,
+                 gst_caps_new(
+                         "testcaps10",
+                         "video/mpeg",
+                         gst_props_new (
+                             "mpegversion",  GST_PROPS_INT (1),
+                             "systemstream", GST_PROPS_BOOLEAN (TRUE),
+                             NULL)),
+                 gst_caps_new("testcaps10", "video/raw", NULL),
+                 gst_caps_new("testcaps11", "audio/raw", NULL),
+                 NULL);
+  xmlSaveFile ("autoplug2_6.gst", gst_xml_write (element));
+
+  exit (0);
+}
diff --git a/testsuite/autoplug/autoplug3.c b/testsuite/autoplug/autoplug3.c
new file mode 100644 (file)
index 0000000..40c1cdc
--- /dev/null
@@ -0,0 +1,50 @@
+#include <gst/gst.h>
+
+int
+main (int argc, char *argv[])
+{
+  GstAutoplug *autoplug;
+  GstElement *element;
+  GstElement *sink;
+  GstElement *pipeline;
+  GstElement *disksrc;
+
+  gst_init(&argc,&argv);
+
+  sink = gst_elementfactory_make ("osssink", "osssink");
+  g_assert (sink != NULL);
+
+  autoplug = gst_autoplugfactory_make ("staticrender");
+  g_assert (autoplug != NULL);
+  
+  element = gst_autoplug_to_renderers (autoplug, 
+                                      gst_caps_new (
+                                        "mp3caps", 
+                                        "audio/mp3",
+                                        NULL
+                                      ), 
+                                      sink,
+                                      NULL);
+  g_assert (element != NULL);
+
+  pipeline = gst_pipeline_new ("main_pipeline");
+  g_assert (pipeline != NULL);
+
+  disksrc = gst_elementfactory_make ("disksrc", "disk_reader");
+  g_assert (disksrc != NULL);
+
+  gst_bin_add (GST_BIN (pipeline), disksrc);
+  gst_bin_add (GST_BIN (pipeline), element);
+
+  gst_element_connect (disksrc, "src", element, "sink");
+
+  g_object_set (G_OBJECT (disksrc), "location", argv[1], NULL);
+
+  gst_element_set_state (pipeline, GST_STATE_PLAYING);
+
+  while (gst_bin_iterate (GST_BIN (pipeline)));
+
+  gst_element_set_state (pipeline, GST_STATE_NULL);
+
+  exit (0);
+}
diff --git a/testsuite/autoplug/autoplug4.c b/testsuite/autoplug/autoplug4.c
new file mode 100644 (file)
index 0000000..34927ed
--- /dev/null
@@ -0,0 +1,102 @@
+#include <gst/gst.h>
+
+int
+main (int argc, char *argv[])
+{
+  GstElement *element;
+  GstElement *sink1, *sink2;
+  GstAutoplug *autoplug;
+  GstAutoplug *autoplug2;
+
+  gst_init(&argc,&argv);
+
+  sink1 = gst_elementfactory_make ("videosink", "videosink");
+  sink2 = gst_elementfactory_make ("osssink", "osssink");
+
+  autoplug = gst_autoplugfactory_make ("staticrender");
+  autoplug2 = gst_autoplugfactory_make ("static");
+  
+  element = gst_autoplug_to_renderers (autoplug, 
+                 gst_caps_new ("mp3caps", "audio/mp3", NULL), sink2, NULL);
+  xmlSaveFile ("autoplug3_1.gst", gst_xml_write (element));
+
+  element = gst_autoplug_to_renderers (autoplug, 
+                 gst_caps_new ("mpeg1caps", "video/mpeg", NULL), sink1, NULL);
+  if (element) {
+    xmlSaveFile ("autoplug3_2.gst", gst_xml_write (element));
+  }
+
+  element = gst_autoplug_to_caps (autoplug2,
+                 gst_caps_new(
+                         "testcaps3",
+                         "video/mpeg",
+                         gst_props_new (
+                             "mpegversion",  GST_PROPS_INT (1),
+                             "systemstream", GST_PROPS_BOOLEAN (TRUE),
+                             NULL)),
+                 gst_caps_new("testcaps4","audio/raw", NULL),
+                 NULL);
+  if (element) {
+    xmlSaveFile ("autoplug3_3.gst", gst_xml_write (element));
+  }
+
+  element = gst_autoplug_to_caps (autoplug2,
+                 gst_caps_new(
+                         "testcaps5",
+                         "video/mpeg",
+                         gst_props_new (
+                             "mpegversion",  GST_PROPS_INT (1),
+                             "systemstream", GST_PROPS_BOOLEAN (FALSE),
+                             NULL)),
+                 gst_caps_new("testcaps6", "video/raw", NULL),
+                 NULL);
+  if (element) {
+    xmlSaveFile ("autoplug3_4.gst", gst_xml_write (element));
+  }
+
+  element = gst_autoplug_to_caps (autoplug2,
+                 gst_caps_new(
+                         "testcaps7",
+                         "video/avi", NULL),
+                 gst_caps_new("testcaps8", "video/raw", NULL),
+                 gst_caps_new("testcaps9", "audio/raw", NULL),
+                 NULL);
+  if (element) {
+    xmlSaveFile ("autoplug3_5.gst", gst_xml_write (element));
+  }
+
+  element = gst_autoplug_to_caps (autoplug2,
+                 gst_caps_new(
+                         "testcaps10",
+                         "video/mpeg",
+                         gst_props_new (
+                             "mpegversion",  GST_PROPS_INT (1),
+                             "systemstream", GST_PROPS_BOOLEAN (TRUE),
+                             NULL)),
+                 gst_caps_new("testcaps10", "video/raw", NULL),
+                 gst_caps_new("testcaps11", "audio/raw", NULL),
+                 NULL);
+  if (element) {
+    xmlSaveFile ("autoplug3_6.gst", gst_xml_write (element));
+  }
+
+  sink1 = gst_elementfactory_make ("videosink", "videosink");
+  sink2 = gst_elementfactory_make ("osssink", "osssink");
+  
+  element = gst_autoplug_to_renderers (autoplug,
+                 gst_caps_new(
+                         "testcaps10",
+                         "video/mpeg",
+                         gst_props_new (
+                             "mpegversion",  GST_PROPS_INT (1),
+                             "systemstream", GST_PROPS_BOOLEAN (TRUE),
+                             NULL)),
+                 sink1,
+                 sink2,
+                 NULL);
+  if (element) {
+    xmlSaveFile ("autoplug3_7.gst", gst_xml_write (element));
+  }
+
+  exit (0);
+}