mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-02-22 14:06:23 +00:00
structure: add function to fixate
Add a function to fixate a structure and use it for the default fixate function in gstpad.c.
This commit is contained in:
parent
d12738b4fa
commit
bd20d2d199
3 changed files with 29 additions and 15 deletions
17
gst/gstpad.c
17
gst/gstpad.c
|
@ -2488,19 +2488,6 @@ no_peer:
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
|
||||||
default_fixate (GQuark field_id, const GValue * value, gpointer data)
|
|
||||||
{
|
|
||||||
GstStructure *s = data;
|
|
||||||
GValue v = { 0 };
|
|
||||||
|
|
||||||
if (gst_value_fixate (&v, value)) {
|
|
||||||
gst_structure_id_set_value (s, field_id, &v);
|
|
||||||
g_value_unset (&v);
|
|
||||||
}
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
gst_pad_default_fixate (GstPad * pad, GstCaps * caps)
|
gst_pad_default_fixate (GstPad * pad, GstCaps * caps)
|
||||||
{
|
{
|
||||||
|
@ -2509,7 +2496,7 @@ gst_pad_default_fixate (GstPad * pad, GstCaps * caps)
|
||||||
/* default fixation */
|
/* default fixation */
|
||||||
gst_caps_truncate (caps);
|
gst_caps_truncate (caps);
|
||||||
s = gst_caps_get_structure (caps, 0);
|
s = gst_caps_get_structure (caps, 0);
|
||||||
gst_structure_foreach (s, default_fixate, s);
|
gst_structure_fixate (s);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -2630,7 +2617,7 @@ is_same_caps:
|
||||||
#endif
|
#endif
|
||||||
no_func:
|
no_func:
|
||||||
{
|
{
|
||||||
GST_DEBUG_OBJECT (pad, "no acceptcase function");
|
GST_DEBUG_OBJECT (pad, "no acceptcaps function");
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -3191,3 +3191,29 @@ gst_structure_is_subset (const GstStructure * subset,
|
||||||
return gst_structure_foreach ((GstStructure *) subset,
|
return gst_structure_foreach ((GstStructure *) subset,
|
||||||
gst_caps_structure_is_subset_field, (gpointer) superset);
|
gst_caps_structure_is_subset_field, (gpointer) superset);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static gboolean
|
||||||
|
default_fixate (GQuark field_id, const GValue * value, gpointer data)
|
||||||
|
{
|
||||||
|
GstStructure *s = data;
|
||||||
|
GValue v = { 0 };
|
||||||
|
|
||||||
|
if (gst_value_fixate (&v, value)) {
|
||||||
|
gst_structure_id_set_value (s, field_id, &v);
|
||||||
|
g_value_unset (&v);
|
||||||
|
}
|
||||||
|
return TRUE;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* gst_structure_fixate:
|
||||||
|
* @structure: a #GstStructure
|
||||||
|
*
|
||||||
|
* Fixate all values in @structure using gst_value_fixate().
|
||||||
|
* @structure will be modified in-place and should be writable.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
gst_structure_fixate (GstStructure * structure)
|
||||||
|
{
|
||||||
|
gst_structure_foreach (structure, default_fixate, structure);
|
||||||
|
}
|
||||||
|
|
|
@ -251,6 +251,7 @@ gboolean gst_structure_can_intersect(const GstStructure *struct1
|
||||||
const GstStructure *struct2);
|
const GstStructure *struct2);
|
||||||
GstStructure* gst_structure_intersect (const GstStructure *struct1,
|
GstStructure* gst_structure_intersect (const GstStructure *struct1,
|
||||||
const GstStructure *struct2);
|
const GstStructure *struct2);
|
||||||
|
void gst_structure_fixate (GstStructure *structure);
|
||||||
|
|
||||||
G_END_DECLS
|
G_END_DECLS
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue