mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2024-11-19 00:01:23 +00:00
structure: Use GLib's CLAMP macro for fixating ranges
Just a bit of refactoring.
This commit is contained in:
parent
cacc834d8f
commit
b77f7b6820
1 changed files with 6 additions and 7 deletions
|
@ -2208,14 +2208,13 @@ gst_structure_fixate_field_nearest_int (GstStructure * structure,
|
||||||
/* already fixed */
|
/* already fixed */
|
||||||
return FALSE;
|
return FALSE;
|
||||||
} else if (G_VALUE_TYPE (value) == GST_TYPE_INT_RANGE) {
|
} else if (G_VALUE_TYPE (value) == GST_TYPE_INT_RANGE) {
|
||||||
int x;
|
int min, max;
|
||||||
|
|
||||||
|
min = gst_value_get_int_range_min (value);
|
||||||
|
max = gst_value_get_int_range_max (value);
|
||||||
|
|
||||||
|
target = CLAMP (target, min, max);
|
||||||
|
|
||||||
x = gst_value_get_int_range_min (value);
|
|
||||||
if (target < x)
|
|
||||||
target = x;
|
|
||||||
x = gst_value_get_int_range_max (value);
|
|
||||||
if (target > x)
|
|
||||||
target = x;
|
|
||||||
gst_structure_set (structure, field_name, G_TYPE_INT, target, NULL);
|
gst_structure_set (structure, field_name, G_TYPE_INT, target, NULL);
|
||||||
return TRUE;
|
return TRUE;
|
||||||
} else if (G_VALUE_TYPE (value) == GST_TYPE_LIST) {
|
} else if (G_VALUE_TYPE (value) == GST_TYPE_LIST) {
|
||||||
|
|
Loading…
Reference in a new issue