Added a test program for the capabilities
authorWim Taymans <wim.taymans@gmail.com>
Sun, 3 Dec 2000 17:52:14 +0000 (17:52 +0000)
committerWim Taymans <wim.taymans@gmail.com>
Sun, 3 Dec 2000 17:52:14 +0000 (17:52 +0000)
Original commit message from CVS:
Added a test program for the capabilities

tests/Makefile.am
tests/caps.c [new file with mode: 0644]
tests/states.c

index e64090981295a27496d881b771932aeb6ddfb5aa..dfe949c355d31cf8cd58661b976e6f51d1b59195 100644 (file)
@@ -1,4 +1,4 @@
-noinst_PROGRAMS = init loadall simplefake states
+noinst_PROGRAMS = init loadall simplefake states caps
 
 LDADD = $(GLIB_LIBS) $(GTK_LIBS) $(top_builddir)/gst/libgst.la
 
diff --git a/tests/caps.c b/tests/caps.c
new file mode 100644 (file)
index 0000000..56de355
--- /dev/null
@@ -0,0 +1,83 @@
+#include <gst/gst.h>
+
+static GstTypeFactory mpegfactory = {
+  "video/mpeg",                // major type
+  ".mpg .mpeg",                // extenstions
+  NULL,                        // typefind function
+};
+
+static GstCapsFactory mpeg2dec_sink_caps = {
+  "video/mpeg",
+  "mpegtype", GST_CAPS_LIST (
+                     GST_CAPS_INT(1),
+                     GST_CAPS_INT(2)
+               ),
+  NULL
+};
+
+static GstCapsFactory mp1parse_src_caps = {
+  "video/mpeg",
+  "mpegtype", GST_CAPS_LIST (
+                     GST_CAPS_INT(1)
+               ),
+  NULL
+};
+
+static GstCapsFactory mpeg2dec_src_caps = {
+  "video/raw",
+  "fourcc",    GST_CAPS_LIST (
+                        GST_CAPS_INT32 (0x32315659), 
+                       GST_CAPS_INT32 (0x32314544)
+                       ),
+  "width",     GST_CAPS_INT_RANGE (16, 4096),
+  "height",    GST_CAPS_INT_RANGE (16, 4096),
+  NULL
+};
+
+static GstCapsFactory raw_sink_caps = {
+  "video/raw",
+  "fourcc",    GST_CAPS_LIST (
+                        GST_CAPS_INT32 (0x32315659)
+                       ),
+  "height",    GST_CAPS_INT_RANGE (16, 256),
+  NULL
+};
+
+static GstCaps *sinkcaps = NULL, 
+               *rawcaps = NULL, 
+               *rawcaps2 = NULL, 
+              *mp1parsecaps = NULL;
+
+int main(int argc,char *argv[]) 
+{
+  gboolean testret;
+
+  _gst_type_initialize ();
+
+  sinkcaps = gst_caps_register (mpeg2dec_sink_caps);
+  gst_caps_dump (sinkcaps);
+  rawcaps  = gst_caps_register (mpeg2dec_src_caps);
+  gst_caps_dump (rawcaps);
+  rawcaps2  = gst_caps_register (raw_sink_caps);
+  gst_caps_dump (rawcaps2);
+  mp1parsecaps  = gst_caps_register (mp1parse_src_caps);
+  gst_caps_dump (mp1parsecaps);
+
+  testret = gst_caps_check_compatibility (mp1parsecaps, rawcaps);
+  g_print ("%d\n", testret);
+  
+  testret = gst_caps_check_compatibility (mp1parsecaps, sinkcaps);
+  g_print ("%d\n", testret);
+  
+  testret = gst_caps_check_compatibility (sinkcaps, mp1parsecaps);
+  g_print ("%d\n", testret);
+
+  testret = gst_caps_check_compatibility (rawcaps, rawcaps2);
+  g_print ("%d\n", testret);
+
+  testret = gst_caps_check_compatibility (rawcaps2, rawcaps);
+  g_print ("%d\n", testret);
+
+  testret = gst_caps_check_compatibility (rawcaps, rawcaps);
+  g_print ("%d\n", testret);
+}
index baafa214029835ba93a60b629447e1eb9b83267f..6401f37ce3cf21eff463a2a806d5481411b26e6d 100644 (file)
@@ -39,8 +39,8 @@ int main(int argc,char *argv[]) {
   gst_pad_connect(gst_element_get_pad(src,"src"),
                   gst_element_get_pad(sink,"sink"));
 
-  gst_bin_create_plan(bin);
-  gst_element_set_state(bin,GST_STATE_PLAYING);
+  gst_bin_create_plan (GST_BIN (bin));
+  gst_element_set_state (bin, GST_STATE_PLAYING);
 
-  gst_bin_iterate(bin);
+  gst_bin_iterate (GST_BIN (bin));
 }