mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-22 17:51:16 +00:00
gst/: Deprecate _type_is_fixed, use _value_is_fixed instead, since the fixedness depends on the content.
Original commit message from CVS: * gst/gstcaps.c: (gst_caps_is_fixed_foreach): * gst/gstpad.c: (_gst_pad_default_fixate_value), (_gst_pad_default_fixate_foreach): * gst/gstvalue.c: (gst_type_is_fixed), (gst_value_is_fixed): * gst/gstvalue.h: Deprecate _type_is_fixed, use _value_is_fixed instead, since in some cases (arrays), the fixedness depends on the content. * gst/gstqueue.c: (gst_queue_handle_src_query): Check for availability before doing something.
This commit is contained in:
parent
4c20dfd33d
commit
8d61d9045d
7 changed files with 100 additions and 29 deletions
12
ChangeLog
12
ChangeLog
|
@ -1,3 +1,15 @@
|
|||
2004-11-29 Ronald S. Bultje <rbultje@ronald.bitfreak.net>
|
||||
|
||||
* gst/gstcaps.c: (gst_caps_is_fixed_foreach):
|
||||
* gst/gstpad.c: (_gst_pad_default_fixate_value),
|
||||
(_gst_pad_default_fixate_foreach):
|
||||
* gst/gstvalue.c: (gst_type_is_fixed), (gst_value_is_fixed):
|
||||
* gst/gstvalue.h:
|
||||
Deprecate _type_is_fixed, use _value_is_fixed instead, since
|
||||
in some cases (arrays), the fixedness depends on the content.
|
||||
* gst/gstqueue.c: (gst_queue_handle_src_query):
|
||||
Check for availability before doing something.
|
||||
|
||||
2004-11-29 Wim Taymans <wim@fluendo.com>
|
||||
|
||||
* testsuite/threads/Makefile.am:
|
||||
|
|
|
@ -553,9 +553,7 @@ gst_caps_is_chained (const GstCaps * caps)
|
|||
static gboolean
|
||||
gst_caps_is_fixed_foreach (GQuark field_id, GValue * value, gpointer unused)
|
||||
{
|
||||
GType type = G_VALUE_TYPE (value);
|
||||
|
||||
return gst_type_is_fixed (type);
|
||||
return gst_value_is_fixed (value);
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
61
gst/gstpad.c
61
gst/gstpad.c
|
@ -2073,32 +2073,57 @@ gst_pad_get_ghost_pad_list (GstPad * pad)
|
|||
}
|
||||
|
||||
static gboolean
|
||||
_gst_pad_default_fixate_foreach (GQuark field_id, GValue * value, gpointer s)
|
||||
_gst_pad_default_fixate_value (const GValue * value, GValue * dest)
|
||||
{
|
||||
GstStructure *structure = (GstStructure *) s;
|
||||
GType type = G_VALUE_TYPE (value);
|
||||
|
||||
if (gst_type_is_fixed (type))
|
||||
if (gst_value_is_fixed (value))
|
||||
return TRUE;
|
||||
|
||||
if (type == GST_TYPE_INT_RANGE) {
|
||||
gst_structure_set (structure, g_quark_to_string (field_id),
|
||||
G_TYPE_INT, gst_value_get_int_range_min (value), NULL);
|
||||
return FALSE;
|
||||
}
|
||||
if (type == GST_TYPE_DOUBLE_RANGE) {
|
||||
gst_structure_set (structure, g_quark_to_string (field_id),
|
||||
G_TYPE_DOUBLE, gst_value_get_double_range_min (value), NULL);
|
||||
return FALSE;
|
||||
}
|
||||
if (type == GST_TYPE_LIST) {
|
||||
gst_structure_set_value (structure, g_quark_to_string (field_id),
|
||||
gst_value_list_get_value (value, 0));
|
||||
return FALSE;
|
||||
g_value_init (dest, G_TYPE_INT);
|
||||
g_value_set_int (dest, gst_value_get_int_range_min (value));
|
||||
} else if (type == GST_TYPE_DOUBLE_RANGE) {
|
||||
g_value_init (dest, G_TYPE_DOUBLE);
|
||||
g_value_set_double (dest, gst_value_get_double_range_min (value));
|
||||
} else if (type == GST_TYPE_LIST) {
|
||||
gst_value_init_and_copy (dest, gst_value_list_get_value (value, 0));
|
||||
} else if (type == GST_TYPE_FIXED_LIST) {
|
||||
gint size, n;
|
||||
GValue dest_kid = { 0 };
|
||||
const GValue *kid;
|
||||
|
||||
/* check recursively */
|
||||
g_value_init (dest, GST_TYPE_FIXED_LIST);
|
||||
size = gst_value_list_get_size (value);
|
||||
for (n = 0; n < size; n++) {
|
||||
kid = gst_value_list_get_value (value, n);
|
||||
if (_gst_pad_default_fixate_value (kid, &dest_kid)) {
|
||||
gst_value_list_append_value (dest, kid);
|
||||
} else {
|
||||
gst_value_list_append_value (dest, &dest_kid);
|
||||
g_value_unset (&dest_kid);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
g_critical ("Don't know how to fixate value type %s", g_type_name (type));
|
||||
}
|
||||
|
||||
g_critical ("don't know how to fixate type %s", g_type_name (type));
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
_gst_pad_default_fixate_foreach (GQuark field_id, GValue * value, gpointer s)
|
||||
{
|
||||
GstStructure *structure = (GstStructure *) s;
|
||||
GValue dest = { 0 };
|
||||
|
||||
if (_gst_pad_default_fixate_value (value, &dest))
|
||||
return TRUE;
|
||||
gst_structure_id_set_value (structure, field_id, &dest);
|
||||
g_value_unset (&dest);
|
||||
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
static GstCaps *
|
||||
|
|
|
@ -953,10 +953,10 @@ gst_queue_handle_src_query (GstPad * pad,
|
|||
GstQueryType type, GstFormat * fmt, gint64 * value)
|
||||
{
|
||||
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
|
||||
gboolean res;
|
||||
|
||||
res = gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value);
|
||||
if (!res)
|
||||
if (!GST_PAD_PEER (queue->sinkpad))
|
||||
return FALSE;
|
||||
if (!gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value))
|
||||
return FALSE;
|
||||
|
||||
if (type == GST_QUERY_POSITION) {
|
||||
|
|
|
@ -2360,8 +2360,8 @@ gst_type_is_fixed (GType type)
|
|||
type == GST_TYPE_LIST) {
|
||||
return FALSE;
|
||||
}
|
||||
if (G_TYPE_IS_FUNDAMENTAL (type) &&
|
||||
type < G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_GLIB_LAST)) {
|
||||
if (G_TYPE_FUNDAMENTAL (type) <=
|
||||
G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_GLIB_LAST)) {
|
||||
return TRUE;
|
||||
}
|
||||
if (type == GST_TYPE_BUFFER || type == GST_TYPE_FOURCC
|
||||
|
@ -2372,6 +2372,41 @@ gst_type_is_fixed (GType type)
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
/**
|
||||
* gst_value_is_fixed:
|
||||
* @value: the #GValue to check
|
||||
*
|
||||
* Tests if the given GValue, if available in a GstStructure (or any other
|
||||
* container) contains a "fixed" (which means: one value) or an "unfixed"
|
||||
* (which means: multiple possible values, such as data lists or data
|
||||
* ranges) value.
|
||||
*
|
||||
* Returns: true if the value is "fixed".
|
||||
*/
|
||||
|
||||
gboolean
|
||||
gst_value_is_fixed (const GValue * value)
|
||||
{
|
||||
GType type = G_VALUE_TYPE (value);
|
||||
|
||||
if (type == GST_TYPE_FIXED_LIST) {
|
||||
gboolean fixed = TRUE;
|
||||
gint size, n;
|
||||
const GValue *kid;
|
||||
|
||||
/* check recursively */
|
||||
size = gst_value_list_get_size (value);
|
||||
for (n = 0; n < size; n++) {
|
||||
kid = gst_value_list_get_value (value, n);
|
||||
fixed &= gst_value_is_fixed (kid);
|
||||
}
|
||||
|
||||
return fixed;
|
||||
}
|
||||
|
||||
return gst_type_is_fixed (type);
|
||||
}
|
||||
|
||||
/************
|
||||
* fraction *
|
||||
************/
|
||||
|
|
|
@ -181,6 +181,7 @@ void gst_value_register_subtract_func (GType minuend_type,
|
|||
|
||||
/* fixation */
|
||||
gboolean gst_type_is_fixed (GType type);
|
||||
gboolean gst_value_is_fixed (const GValue *value);
|
||||
|
||||
/* private */
|
||||
void _gst_value_initialize (void);
|
||||
|
|
|
@ -953,10 +953,10 @@ gst_queue_handle_src_query (GstPad * pad,
|
|||
GstQueryType type, GstFormat * fmt, gint64 * value)
|
||||
{
|
||||
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
|
||||
gboolean res;
|
||||
|
||||
res = gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value);
|
||||
if (!res)
|
||||
if (!GST_PAD_PEER (queue->sinkpad))
|
||||
return FALSE;
|
||||
if (!gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value))
|
||||
return FALSE;
|
||||
|
||||
if (type == GST_QUERY_POSITION) {
|
||||
|
|
Loading…
Reference in a new issue