gst/gststructure.c: Set type field correctly.
authorDavid Schleef <ds@schleef.org>
Fri, 23 Jul 2004 00:12:57 +0000 (00:12 +0000)
committerDavid Schleef <ds@schleef.org>
Fri, 23 Jul 2004 00:12:57 +0000 (00:12 +0000)
Original commit message from CVS:
* gst/gststructure.c: (gst_structure_id_empty_new),
(gst_structure_empty_new):  Set type field correctly.
* gst/gststructure.h: Check type field correctly.
* testsuite/caps/Makefile.am:
* testsuite/caps/structure.c: (test1), (main): Add a very small
test for structures.

ChangeLog
gst/gststructure.c
gst/gststructure.h
tests/old/testsuite/caps/Makefile.am
tests/old/testsuite/caps/structure.c [new file with mode: 0644]
testsuite/caps/Makefile.am
testsuite/caps/structure.c [new file with mode: 0644]

index 2ff1877..9f98b8a 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,14 @@
 2004-07-22  David Schleef  <ds@schleef.org>
 
+       * gst/gststructure.c: (gst_structure_id_empty_new),
+       (gst_structure_empty_new):  Set type field correctly.
+       * gst/gststructure.h: Check type field correctly.
+       * testsuite/caps/Makefile.am:
+       * testsuite/caps/structure.c: (test1), (main): Add a very small
+       test for structures.
+
+2004-07-22  David Schleef  <ds@schleef.org>
+
        * docs/random/ds/0.9-suggested-changes: more comments
        * tools/gst-launch.c: (idle_func): Fix hard-to-translate string.
 
index 4456ccf..7eb5412 100644 (file)
@@ -87,6 +87,7 @@ gst_structure_id_empty_new (GQuark quark)
   g_return_val_if_fail (quark != 0, NULL);
 
   structure = g_new0 (GstStructure, 1);
+  structure->type = gst_structure_get_type ();
   structure->name = quark;
   structure->fields = g_array_new (FALSE, TRUE, sizeof (GstStructureField));
 
@@ -109,6 +110,7 @@ gst_structure_empty_new (const gchar * name)
   g_return_val_if_fail (name != NULL, NULL);
 
   structure = g_new0 (GstStructure, 1);
+  structure->type = gst_structure_get_type ();
   structure->name = g_quark_from_string (name);
   structure->fields = g_array_new (FALSE, TRUE, sizeof (GstStructureField));
 
index fcc4f95..2a98d6a 100644 (file)
@@ -27,8 +27,8 @@
 G_BEGIN_DECLS
 
 #define GST_TYPE_STRUCTURE             (gst_structure_get_type ())
-#define GST_STRUCTURE(object)          (G_TYPE_CHECK_INSTANCE_CAST ((object), GST_TYPE_STRUCTURE, GstStructure))
-#define GST_IS_STRUCTURE(object)       (G_TYPE_CHECK_INSTANCE_TYPE ((object), GST_TYPE_STRUCTURE))
+#define GST_STRUCTURE(object)          ((GstStructure *)(object))
+#define GST_IS_STRUCTURE(object)       ((object) && (GST_STRUCTURE(object)->type == GST_TYPE_STRUCTURE))
 
 typedef struct _GstStructure GstStructure;
 
index 637e8cb..42efbd4 100644 (file)
@@ -23,7 +23,8 @@ tests_pass = \
        subtract \
        sets \
        simplify \
-       random
+       random \
+       structure
 
 EXTRA_DIST = caps_strings
 
diff --git a/tests/old/testsuite/caps/structure.c b/tests/old/testsuite/caps/structure.c
new file mode 100644 (file)
index 0000000..84c607e
--- /dev/null
@@ -0,0 +1,25 @@
+
+#include <gst/gst.h>
+
+
+void
+test1 (void)
+{
+  GstStructure *structure;
+
+  g_print ("type is %d\n", (int) gst_structure_get_type ());
+
+  structure = gst_structure_empty_new ("moo");
+  g_assert (structure != NULL);
+  g_assert (GST_IS_STRUCTURE (structure));
+}
+
+int
+main (int argc, char *argv[])
+{
+  gst_init (&argc, &argv);
+
+  test1 ();
+
+  return 0;
+}
index 637e8cb..42efbd4 100644 (file)
@@ -23,7 +23,8 @@ tests_pass = \
        subtract \
        sets \
        simplify \
-       random
+       random \
+       structure
 
 EXTRA_DIST = caps_strings
 
diff --git a/testsuite/caps/structure.c b/testsuite/caps/structure.c
new file mode 100644 (file)
index 0000000..84c607e
--- /dev/null
@@ -0,0 +1,25 @@
+
+#include <gst/gst.h>
+
+
+void
+test1 (void)
+{
+  GstStructure *structure;
+
+  g_print ("type is %d\n", (int) gst_structure_get_type ());
+
+  structure = gst_structure_empty_new ("moo");
+  g_assert (structure != NULL);
+  g_assert (GST_IS_STRUCTURE (structure));
+}
+
+int
+main (int argc, char *argv[])
+{
+  gst_init (&argc, &argv);
+
+  test1 ();
+
+  return 0;
+}