mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-13 23:22:54 +00:00
gst/gststructure.c: Set type field correctly.
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.
This commit is contained in:
parent
23d19ce876
commit
4fa4267105
7 changed files with 67 additions and 4 deletions
|
@ -1,3 +1,12 @@
|
|||
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
|
||||
|
|
|
@ -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));
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
||||
|
|
|
@ -23,7 +23,8 @@ tests_pass = \
|
|||
subtract \
|
||||
sets \
|
||||
simplify \
|
||||
random
|
||||
random \
|
||||
structure
|
||||
|
||||
EXTRA_DIST = caps_strings
|
||||
|
||||
|
|
25
tests/old/testsuite/caps/structure.c
Normal file
25
tests/old/testsuite/caps/structure.c
Normal file
|
@ -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;
|
||||
}
|
|
@ -23,7 +23,8 @@ tests_pass = \
|
|||
subtract \
|
||||
sets \
|
||||
simplify \
|
||||
random
|
||||
random \
|
||||
structure
|
||||
|
||||
EXTRA_DIST = caps_strings
|
||||
|
||||
|
|
25
testsuite/caps/structure.c
Normal file
25
testsuite/caps/structure.c
Normal file
|
@ -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;
|
||||
}
|
Loading…
Reference in a new issue