summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorWim Taymans <wim.taymans@gmail.com>2000-12-03 17:52:14 +0000
committerWim Taymans <wim.taymans@gmail.com>2000-12-03 17:52:14 +0000
commit9652a3aef997d52988afa97a7f47d1e9c73ffacd (patch)
treed77ba84bfb3c23b35054a5caa1cdaa7ddbf0dc26 /tests
parent4f55ae4ded29f7a7d951bdb201ac0476671a0040 (diff)
Added a test program for the capabilities
Original commit message from CVS: Added a test program for the capabilities
Diffstat (limited to 'tests')
-rw-r--r--tests/Makefile.am2
-rw-r--r--tests/caps.c83
-rw-r--r--tests/states.c6
3 files changed, 87 insertions, 4 deletions
diff --git a/tests/Makefile.am b/tests/Makefile.am
index e64090981..dfe949c35 100644
--- a/tests/Makefile.am
+++ b/tests/Makefile.am
@@ -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
index 000000000..56de3553f
--- /dev/null
+++ b/tests/caps.c
@@ -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);
+}
diff --git a/tests/states.c b/tests/states.c
index baafa2140..6401f37ce 100644
--- a/tests/states.c
+++ b/tests/states.c
@@ -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));
}