From 5f370a6455f2c115155c153ef3d4d7677b353b6e Mon Sep 17 00:00:00 2001 From: David Schleef Date: Wed, 28 Apr 2004 20:19:46 +0000 Subject: [PATCH] =?UTF-8?q?gst/gstcaps.c:=20Patch=20from=20Tim-Philipp=20M?= =?UTF-8?q?=C3=BCller=20to=20fix=20GST=5FCAPS()=20and=20GST=5FIS=5FCAPS().?= =?UTF-8?q?=20(bug=20#141304)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Original commit message from CVS: * gst/gstcaps.c: (gst_caps_copy), (gst_caps_free), (gst_caps_append), (gst_caps_append_structure), (gst_caps_get_size), (gst_caps_get_structure), (gst_caps_copy_1), (gst_caps_set_simple), (gst_caps_set_simple_valist), (gst_caps_is_any), (gst_caps_is_empty), (gst_caps_is_chained), (gst_caps_is_fixed), (gst_caps_is_always_compatible), (gst_caps_intersect), (gst_caps_normalize), (gst_caps_transform_to_string): Patch from Tim-Philipp Müller to fix GST_CAPS() and GST_IS_CAPS(). (bug #141304) * gst/gstcaps.h: use GST_IS_CAPS(). --- ChangeLog | 13 +++++++++++++ gst/gstcaps.c | 45 ++++++++++++++++++++++++--------------------- gst/gstcaps.h | 6 +++--- 3 files changed, 40 insertions(+), 24 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6327337687..18fd75273e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-04-28 David Schleef + + * gst/gstcaps.c: (gst_caps_copy), (gst_caps_free), + (gst_caps_append), (gst_caps_append_structure), + (gst_caps_get_size), (gst_caps_get_structure), (gst_caps_copy_1), + (gst_caps_set_simple), (gst_caps_set_simple_valist), + (gst_caps_is_any), (gst_caps_is_empty), (gst_caps_is_chained), + (gst_caps_is_fixed), (gst_caps_is_always_compatible), + (gst_caps_intersect), (gst_caps_normalize), + (gst_caps_transform_to_string): Patch from Tim-Philipp Müller + to fix GST_CAPS() and GST_IS_CAPS(). (bug #141304) + * gst/gstcaps.h: use GST_IS_CAPS(). + 2004-04-26 David Schleef * gst/gstcpu.c: (gst_cpuid_i386): Don't clobber ebx in inline diff --git a/gst/gstcaps.c b/gst/gstcaps.c index b951b3ac22..f63d18a08a 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -199,7 +199,7 @@ gst_caps_copy (const GstCaps * caps) GstStructure *structure; int i; - g_return_val_if_fail (caps != NULL, NULL); + g_return_val_if_fail (GST_IS_CAPS (caps), NULL); newcaps = gst_caps_new_empty (); newcaps->flags = caps->flags; @@ -225,7 +225,7 @@ gst_caps_free (GstCaps * caps) GstStructure *structure; int i; - g_return_if_fail (caps != NULL); + g_return_if_fail (GST_IS_CAPS (caps)); for (i = 0; i < caps->structs->len; i++) { structure = gst_caps_get_structure (caps, i); @@ -282,8 +282,8 @@ gst_caps_append (GstCaps * caps1, GstCaps * caps2) GstStructure *structure; int i; - g_return_if_fail (caps1 != NULL); - g_return_if_fail (caps2 != NULL); + g_return_if_fail (GST_IS_CAPS (caps1)); + g_return_if_fail (GST_IS_CAPS (caps2)); #ifdef USE_POISONING CAPS_POISON (caps2); @@ -318,7 +318,7 @@ gst_caps_append (GstCaps * caps1, GstCaps * caps2) void gst_caps_append_structure (GstCaps * caps, GstStructure * structure) { - g_return_if_fail (caps != NULL); + g_return_if_fail (GST_IS_CAPS (caps)); if (structure) { #if 0 @@ -385,7 +385,7 @@ gst_caps_split_one (GstCaps * caps) int gst_caps_get_size (const GstCaps * caps) { - g_return_val_if_fail (caps != NULL, 0); + g_return_val_if_fail (GST_IS_CAPS (caps), 0); return caps->structs->len; } @@ -408,7 +408,7 @@ gst_caps_get_size (const GstCaps * caps) GstStructure * gst_caps_get_structure (const GstCaps * caps, int index) { - g_return_val_if_fail (caps != NULL, NULL); + g_return_val_if_fail (GST_IS_CAPS (caps), NULL); g_return_val_if_fail (index >= 0, NULL); g_return_val_if_fail (index < caps->structs->len, NULL); @@ -430,7 +430,7 @@ gst_caps_copy_1 (const GstCaps * caps) GstCaps *newcaps; GstStructure *structure; - g_return_val_if_fail (caps != NULL, NULL); + g_return_val_if_fail (GST_IS_CAPS (caps), NULL); newcaps = gst_caps_new_empty (); newcaps->flags = caps->flags; @@ -459,7 +459,7 @@ gst_caps_set_simple (GstCaps * caps, char *field, ...) GstStructure *structure; va_list var_args; - g_return_if_fail (caps != NULL); + g_return_if_fail (GST_IS_CAPS (caps)); g_return_if_fail (caps->structs->len == 1); structure = gst_caps_get_structure (caps, 0); @@ -484,7 +484,7 @@ gst_caps_set_simple_valist (GstCaps * caps, char *field, va_list varargs) { GstStructure *structure; - g_return_if_fail (caps != NULL); + g_return_if_fail (GST_IS_CAPS (caps)); g_return_if_fail (caps->structs->len != 1); structure = gst_caps_get_structure (caps, 0); @@ -505,7 +505,7 @@ gst_caps_set_simple_valist (GstCaps * caps, char *field, va_list varargs) gboolean gst_caps_is_any (const GstCaps * caps) { - g_return_val_if_fail (caps != NULL, FALSE); + g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); return (caps->flags & GST_CAPS_FLAGS_ANY); } @@ -521,7 +521,7 @@ gst_caps_is_any (const GstCaps * caps) gboolean gst_caps_is_empty (const GstCaps * caps) { - g_return_val_if_fail (caps != NULL, FALSE); + g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); if (caps->flags & GST_CAPS_FLAGS_ANY) return FALSE; @@ -543,7 +543,7 @@ gst_caps_is_empty (const GstCaps * caps) gboolean gst_caps_is_chained (const GstCaps * caps) { - g_return_val_if_fail (caps != NULL, FALSE); + g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); return (caps->structs->len > 1); } @@ -571,7 +571,7 @@ gst_caps_is_fixed (const GstCaps * caps) { GstStructure *structure; - g_return_val_if_fail (caps != NULL, FALSE); + g_return_val_if_fail (GST_IS_CAPS (caps), FALSE); if (caps->structs->len != 1) return FALSE; @@ -642,8 +642,8 @@ gst_caps_is_equal_fixed (const GstCaps * caps1, const GstCaps * caps2) gboolean gst_caps_is_always_compatible (const GstCaps * caps1, const GstCaps * caps2) { - g_return_val_if_fail (caps1 != NULL, FALSE); - g_return_val_if_fail (caps2 != NULL, FALSE); + g_return_val_if_fail (GST_IS_CAPS (caps1), FALSE); + g_return_val_if_fail (GST_IS_CAPS (caps2), FALSE); return gst_caps_is_subset (caps1, caps2); } @@ -823,8 +823,8 @@ gst_caps_intersect (const GstCaps * caps1, const GstCaps * caps2) GstStructure *struct2; GstCaps *dest; - g_return_val_if_fail (caps1 != NULL, NULL); - g_return_val_if_fail (caps2 != NULL, NULL); + g_return_val_if_fail (GST_IS_CAPS (caps1), NULL); + g_return_val_if_fail (GST_IS_CAPS (caps2), NULL); if (gst_caps_is_empty (caps1) || gst_caps_is_empty (caps2)) { return gst_caps_new_empty (); @@ -1059,7 +1059,7 @@ gst_caps_normalize (const GstCaps * caps) GstCaps *newcaps; int i; - g_return_val_if_fail (caps != NULL, NULL); + g_return_val_if_fail (GST_IS_CAPS (caps), NULL); newcaps = gst_caps_copy (caps); nf.caps = newcaps; @@ -1447,8 +1447,11 @@ gst_caps_from_string (const gchar * string) static void gst_caps_transform_to_string (const GValue * src_value, GValue * dest_value) { - g_return_if_fail (src_value != NULL); - g_return_if_fail (dest_value != NULL); + g_return_if_fail (G_IS_VALUE (src_value)); + g_return_if_fail (G_IS_VALUE (dest_value)); + g_return_if_fail (G_VALUE_HOLDS (src_value, GST_TYPE_CAPS)); + g_return_if_fail (G_VALUE_HOLDS (dest_value, G_TYPE_STRING) + || G_VALUE_HOLDS (dest_value, G_TYPE_POINTER)); dest_value->data[0].v_pointer = gst_caps_to_string (src_value->data[0].v_pointer); diff --git a/gst/gstcaps.h b/gst/gstcaps.h index 91162543e7..359175cce9 100644 --- a/gst/gstcaps.h +++ b/gst/gstcaps.h @@ -25,9 +25,9 @@ G_BEGIN_DECLS -#define GST_TYPE_CAPS gst_caps_get_type() -#define GST_CAPS(object) (G_TYPE_CHECK_INSTANCE_CAST ((object), GST_TYPE_CAPS, GstCaps)) -#define GST_IS_CAPS(object) (G_TYPE_CHECK_INSTANCE_TYPE ((object), GST_TYPE_CAPS)) +#define GST_TYPE_CAPS (gst_caps_get_type()) +#define GST_CAPS(object) ((GstCaps*)object) +#define GST_IS_CAPS(object) ((object) && (GST_CAPS(object)->type == GST_TYPE_CAPS)) #define GST_CAPS_FLAGS_ANY (1 << 0)