mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-26 19:51:11 +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>
|
2004-11-29 Wim Taymans <wim@fluendo.com>
|
||||||
|
|
||||||
* testsuite/threads/Makefile.am:
|
* testsuite/threads/Makefile.am:
|
||||||
|
|
|
@ -553,9 +553,7 @@ gst_caps_is_chained (const GstCaps * caps)
|
||||||
static gboolean
|
static gboolean
|
||||||
gst_caps_is_fixed_foreach (GQuark field_id, GValue * value, gpointer unused)
|
gst_caps_is_fixed_foreach (GQuark field_id, GValue * value, gpointer unused)
|
||||||
{
|
{
|
||||||
GType type = G_VALUE_TYPE (value);
|
return gst_value_is_fixed (value);
|
||||||
|
|
||||||
return gst_type_is_fixed (type);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
61
gst/gstpad.c
61
gst/gstpad.c
|
@ -2073,32 +2073,57 @@ gst_pad_get_ghost_pad_list (GstPad * pad)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
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);
|
GType type = G_VALUE_TYPE (value);
|
||||||
|
|
||||||
if (gst_type_is_fixed (type))
|
if (gst_value_is_fixed (value))
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
if (type == GST_TYPE_INT_RANGE) {
|
if (type == GST_TYPE_INT_RANGE) {
|
||||||
gst_structure_set (structure, g_quark_to_string (field_id),
|
g_value_init (dest, G_TYPE_INT);
|
||||||
G_TYPE_INT, gst_value_get_int_range_min (value), NULL);
|
g_value_set_int (dest, gst_value_get_int_range_min (value));
|
||||||
return FALSE;
|
} else if (type == GST_TYPE_DOUBLE_RANGE) {
|
||||||
}
|
g_value_init (dest, G_TYPE_DOUBLE);
|
||||||
if (type == GST_TYPE_DOUBLE_RANGE) {
|
g_value_set_double (dest, gst_value_get_double_range_min (value));
|
||||||
gst_structure_set (structure, g_quark_to_string (field_id),
|
} else if (type == GST_TYPE_LIST) {
|
||||||
G_TYPE_DOUBLE, gst_value_get_double_range_min (value), NULL);
|
gst_value_init_and_copy (dest, gst_value_list_get_value (value, 0));
|
||||||
return FALSE;
|
} else if (type == GST_TYPE_FIXED_LIST) {
|
||||||
}
|
gint size, n;
|
||||||
if (type == GST_TYPE_LIST) {
|
GValue dest_kid = { 0 };
|
||||||
gst_structure_set_value (structure, g_quark_to_string (field_id),
|
const GValue *kid;
|
||||||
gst_value_list_get_value (value, 0));
|
|
||||||
return FALSE;
|
/* 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 FALSE;
|
||||||
return TRUE;
|
}
|
||||||
|
|
||||||
|
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 *
|
static GstCaps *
|
||||||
|
|
|
@ -953,10 +953,10 @@ gst_queue_handle_src_query (GstPad * pad,
|
||||||
GstQueryType type, GstFormat * fmt, gint64 * value)
|
GstQueryType type, GstFormat * fmt, gint64 * value)
|
||||||
{
|
{
|
||||||
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
|
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
res = gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value);
|
if (!GST_PAD_PEER (queue->sinkpad))
|
||||||
if (!res)
|
return FALSE;
|
||||||
|
if (!gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (type == GST_QUERY_POSITION) {
|
if (type == GST_QUERY_POSITION) {
|
||||||
|
|
|
@ -2360,8 +2360,8 @@ gst_type_is_fixed (GType type)
|
||||||
type == GST_TYPE_LIST) {
|
type == GST_TYPE_LIST) {
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
if (G_TYPE_IS_FUNDAMENTAL (type) &&
|
if (G_TYPE_FUNDAMENTAL (type) <=
|
||||||
type < G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_GLIB_LAST)) {
|
G_TYPE_MAKE_FUNDAMENTAL (G_TYPE_RESERVED_GLIB_LAST)) {
|
||||||
return TRUE;
|
return TRUE;
|
||||||
}
|
}
|
||||||
if (type == GST_TYPE_BUFFER || type == GST_TYPE_FOURCC
|
if (type == GST_TYPE_BUFFER || type == GST_TYPE_FOURCC
|
||||||
|
@ -2372,6 +2372,41 @@ gst_type_is_fixed (GType type)
|
||||||
return FALSE;
|
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 *
|
* fraction *
|
||||||
************/
|
************/
|
||||||
|
|
|
@ -181,6 +181,7 @@ void gst_value_register_subtract_func (GType minuend_type,
|
||||||
|
|
||||||
/* fixation */
|
/* fixation */
|
||||||
gboolean gst_type_is_fixed (GType type);
|
gboolean gst_type_is_fixed (GType type);
|
||||||
|
gboolean gst_value_is_fixed (const GValue *value);
|
||||||
|
|
||||||
/* private */
|
/* private */
|
||||||
void _gst_value_initialize (void);
|
void _gst_value_initialize (void);
|
||||||
|
|
|
@ -953,10 +953,10 @@ gst_queue_handle_src_query (GstPad * pad,
|
||||||
GstQueryType type, GstFormat * fmt, gint64 * value)
|
GstQueryType type, GstFormat * fmt, gint64 * value)
|
||||||
{
|
{
|
||||||
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
|
GstQueue *queue = GST_QUEUE (gst_pad_get_parent (pad));
|
||||||
gboolean res;
|
|
||||||
|
|
||||||
res = gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value);
|
if (!GST_PAD_PEER (queue->sinkpad))
|
||||||
if (!res)
|
return FALSE;
|
||||||
|
if (!gst_pad_query (GST_PAD_PEER (queue->sinkpad), type, fmt, value))
|
||||||
return FALSE;
|
return FALSE;
|
||||||
|
|
||||||
if (type == GST_QUERY_POSITION) {
|
if (type == GST_QUERY_POSITION) {
|
||||||
|
|
Loading…
Reference in a new issue