mirror of
https://gitlab.freedesktop.org/gstreamer/gstreamer.git
synced 2025-03-02 09:51:11 +00:00
controller: add G_LIKELY and join two if for same condition
A G_LIKELY for the sequence!=NULL checks. Join two ifs to an if-else. Add indent guides to keep indent form breaking the function declaration
This commit is contained in:
parent
d72c17e328
commit
04ece69838
2 changed files with 11 additions and 9 deletions
|
@ -535,7 +535,7 @@ _interpolate_linear_get_##vtype (GstInterpolationControlSource *self, GstClockTi
|
||||||
g_value_init (&cp.value, self->priv->type); \
|
g_value_init (&cp.value, self->priv->type); \
|
||||||
g_value_copy (&self->priv->default_value, &cp.value); \
|
g_value_copy (&self->priv->default_value, &cp.value); \
|
||||||
cp1 = &cp; \
|
cp1 = &cp; \
|
||||||
if (self->priv->values) \
|
if (G_LIKELY (self->priv->values)) \
|
||||||
iter = g_sequence_get_begin_iter (self->priv->values); \
|
iter = g_sequence_get_begin_iter (self->priv->values); \
|
||||||
} \
|
} \
|
||||||
if (iter) { \
|
if (iter) { \
|
||||||
|
|
|
@ -122,9 +122,12 @@ gst_interpolation_control_source_new (void)
|
||||||
*
|
*
|
||||||
* Returns: %TRUE if the interpolation mode could be set, %FALSE otherwise
|
* Returns: %TRUE if the interpolation mode could be set, %FALSE otherwise
|
||||||
*/
|
*/
|
||||||
|
/* *INDENT-OFF* */
|
||||||
gboolean
|
gboolean
|
||||||
gst_interpolation_control_source_set_interpolation_mode
|
gst_interpolation_control_source_set_interpolation_mode (
|
||||||
(GstInterpolationControlSource * self, GstInterpolateMode mode) {
|
GstInterpolationControlSource * self, GstInterpolateMode mode)
|
||||||
|
/* *INDENT-ON* */
|
||||||
|
{
|
||||||
gboolean ret = TRUE;
|
gboolean ret = TRUE;
|
||||||
GstControlSource *csource = GST_CONTROL_SOURCE (self);
|
GstControlSource *csource = GST_CONTROL_SOURCE (self);
|
||||||
|
|
||||||
|
@ -437,7 +440,7 @@ gst_interpolation_control_source_set_internal (GstInterpolationControlSource *
|
||||||
/* check if a control point for the timestamp already exists */
|
/* check if a control point for the timestamp already exists */
|
||||||
|
|
||||||
/* iter contains the iter right *after* timestamp */
|
/* iter contains the iter right *after* timestamp */
|
||||||
if (self->priv->values) {
|
if (G_LIKELY (self->priv->values)) {
|
||||||
iter =
|
iter =
|
||||||
g_sequence_search (self->priv->values, ×tamp,
|
g_sequence_search (self->priv->values, ×tamp,
|
||||||
(GCompareDataFunc) gst_control_point_find, NULL);
|
(GCompareDataFunc) gst_control_point_find, NULL);
|
||||||
|
@ -453,13 +456,12 @@ gst_interpolation_control_source_set_internal (GstInterpolationControlSource *
|
||||||
goto done;
|
goto done;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else {
|
||||||
|
self->priv->values =
|
||||||
|
g_sequence_new ((GDestroyNotify) gst_control_point_free);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* sort new cp into the prop->values list */
|
/* sort new cp into the prop->values list */
|
||||||
if (!self->priv->values)
|
|
||||||
self->priv->values =
|
|
||||||
g_sequence_new ((GDestroyNotify) gst_control_point_free);
|
|
||||||
|
|
||||||
g_sequence_insert_sorted (self->priv->values, _make_new_cp (self, timestamp,
|
g_sequence_insert_sorted (self->priv->values, _make_new_cp (self, timestamp,
|
||||||
value), (GCompareDataFunc) gst_control_point_compare, NULL);
|
value), (GCompareDataFunc) gst_control_point_compare, NULL);
|
||||||
self->priv->nvalues++;
|
self->priv->nvalues++;
|
||||||
|
@ -627,7 +629,7 @@ gst_interpolation_control_source_get_all (GstInterpolationControlSource * self)
|
||||||
g_return_val_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self), NULL);
|
g_return_val_if_fail (GST_IS_INTERPOLATION_CONTROL_SOURCE (self), NULL);
|
||||||
|
|
||||||
g_mutex_lock (self->lock);
|
g_mutex_lock (self->lock);
|
||||||
if (self->priv->values)
|
if (G_LIKELY (self->priv->values))
|
||||||
g_sequence_foreach (self->priv->values, (GFunc) _append_control_point,
|
g_sequence_foreach (self->priv->values, (GFunc) _append_control_point,
|
||||||
&res);
|
&res);
|
||||||
g_mutex_unlock (self->lock);
|
g_mutex_unlock (self->lock);
|
||||||
|
|
Loading…
Reference in a new issue