From ac0fd9c5bf66d3c208c9fc000d09d17f39d931dd Mon Sep 17 00:00:00 2001 From: David Schleef Date: Sat, 17 Apr 2004 02:21:54 +0000 Subject: [PATCH] gst/: (_gst_value_initialize): Create a new function gst_type_is_fixed() to indicate types that are fixed wrt caps or... Original commit message from CVS: * gst/gstcaps.c: (gst_caps_is_fixed_foreach): * gst/gstpad.c: (_gst_pad_default_fixate_foreach): * gst/gstvalue.c: (gst_value_serialize_buffer), (gst_value_deserialize_buffer), (gst_type_is_fixed), (_gst_value_initialize): Create a new function gst_type_is_fixed() to indicate types that are fixed wrt caps or not. Switching to this function fixes (bug #140298). * gst/gstvalue.h: --- ChangeLog | 11 +++++++++++ common | 2 +- gst/gstcaps.c | 8 +------- gst/gstpad.c | 3 +-- gst/gstvalue.c | 27 +++++++++++++++++++++------ gst/gstvalue.h | 2 ++ 6 files changed, 37 insertions(+), 16 deletions(-) diff --git a/ChangeLog b/ChangeLog index 169dd00e4a..9caa071e17 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2004-04-16 David Schleef + + * gst/gstcaps.c: (gst_caps_is_fixed_foreach): + * gst/gstpad.c: (_gst_pad_default_fixate_foreach): + * gst/gstvalue.c: (gst_value_serialize_buffer), + (gst_value_deserialize_buffer), (gst_type_is_fixed), + (_gst_value_initialize): Create a new function gst_type_is_fixed() + to indicate types that are fixed wrt caps or not. Switching to + this function fixes (bug #140298). + * gst/gstvalue.h: + 2004-04-16 David Schleef * common/m4/gst-arch.m4: Implmenent a whitelist and blacklist diff --git a/common b/common index 5252791a08..e55182f6ee 160000 --- a/common +++ b/common @@ -1 +1 @@ -Subproject commit 5252791a08494c87ec84fadc385ec5b7c44f96b6 +Subproject commit e55182f6eece70ff99e33b9800b27a926670dbdd diff --git a/gst/gstcaps.c b/gst/gstcaps.c index c94b0340d1..b5cef4a183 100644 --- a/gst/gstcaps.c +++ b/gst/gstcaps.c @@ -527,13 +527,7 @@ gst_caps_is_fixed_foreach (GQuark field_id, GValue * value, gpointer unused) { GType type = G_VALUE_TYPE (value); - if (G_TYPE_IS_FUNDAMENTAL (type)) - return TRUE; - if (type == GST_TYPE_FOURCC) - return TRUE; - if (type == GST_TYPE_BUFFER) - return TRUE; - return FALSE; + return gst_type_is_fixed (type); } /** diff --git a/gst/gstpad.c b/gst/gstpad.c index 0ffec22b65..017490f473 100644 --- a/gst/gstpad.c +++ b/gst/gstpad.c @@ -2015,8 +2015,7 @@ _gst_pad_default_fixate_foreach (GQuark field_id, GValue * value, gpointer s) GstStructure *structure = (GstStructure *) s; GType type = G_VALUE_TYPE (value); - if (G_TYPE_IS_FUNDAMENTAL (type) || type == GST_TYPE_FOURCC || - type == GST_TYPE_BUFFER) + if (gst_type_is_fixed (type)) return TRUE; if (type == GST_TYPE_INT_RANGE) { diff --git a/gst/gstvalue.c b/gst/gstvalue.c index ca146df2e3..efa108febc 100644 --- a/gst/gstvalue.c +++ b/gst/gstvalue.c @@ -1569,13 +1569,28 @@ gst_value_deserialize (GValue * dest, const gchar * src) return FALSE; } -enum +/* + * gst_type_is_fixed: + * @type: + * + * Returns: + */ +gboolean +gst_type_is_fixed (GType type) { - _GST_TYPE_FOURCC = G_TYPE_RESERVED_USER_FIRST, - _GST_TYPE_INT_RANGE, - _GST_TYPE_DOUBLE_RANGE, - _GST_TYPE_VALUE_LIST -}; + if (type == GST_TYPE_INT_RANGE || type == GST_TYPE_DOUBLE_RANGE || + type == GST_TYPE_LIST) { + return FALSE; + } + if (G_TYPE_IS_FUNDAMENTAL (type) && + type < G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_GLIB_LAST)) { + return TRUE; + } + if (type == GST_TYPE_BUFFER || type == GST_TYPE_FOURCC) { + return TRUE; + } + return FALSE; +} void _gst_value_initialize (void) diff --git a/gst/gstvalue.h b/gst/gstvalue.h index af8332eed7..a3b95befb6 100644 --- a/gst/gstvalue.h +++ b/gst/gstvalue.h @@ -148,6 +148,8 @@ void gst_value_register_intersect_func (GType GType type2, GstValueIntersectFunc func); +gboolean gst_type_is_fixed (GType type); + /* private */ void _gst_value_initialize (void);