diff --git a/gst/math-compat.h b/gst/math-compat.h index d9b368cfee..8ad1c250a8 100644 --- a/gst/math-compat.h +++ b/gst/math-compat.h @@ -79,6 +79,24 @@ __gst_math_compat_rintf (float x) #define rintf(x) __gst_math_compat_rintf(x) #endif +#if G_BYTE_ORDER == G_BIG_ENDIAN +#define __gst_nan_bytes { 0x7f, 0xc0, 0, 0 } +#endif +#if G_BYTE_ORDER == G_LITTLE_ENDIAN +#define __gst_nan_bytes { 0, 0, 0xc0, 0x7f } +#endif + +static union { + unsigned char __c[4]; + float __d; +} __gst_nan_union __attribute_used__ = { + __gst_nan_bytes +}; + +#ifndef NAN +#define NAN (__gst_nan_union.__d) +#endif + G_END_DECLS #endif /* __GST_MATH_COMPAT_H__ */ diff --git a/libs/gst/controller/gstinterpolationcontrolsource.c b/libs/gst/controller/gstinterpolationcontrolsource.c index f0d67a30ce..ecc5f5ef6f 100644 --- a/libs/gst/controller/gstinterpolationcontrolsource.c +++ b/libs/gst/controller/gstinterpolationcontrolsource.c @@ -41,8 +41,7 @@ #include "gstinterpolationcontrolsource.h" #include "gst/glib-compat-private.h" - -#include +#include "gst/math-compat.h" #define GST_CAT_DEFAULT controller_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); @@ -90,7 +89,7 @@ interpolate_none_get_value_array (GstTimedValueControlSource * self, g_mutex_lock (self->lock); for (i = 0; i < n_values; i++) { - val = FP_NAN; + val = NAN; if (ts >= next_ts) { iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts); if (!iter1) { @@ -189,7 +188,7 @@ interpolate_linear_get_value_array (GstTimedValueControlSource * self, g_mutex_lock (self->lock); for (i = 0; i < n_values; i++) { - val = FP_NAN; + val = NAN; if (ts >= next_ts) { cp1 = cp2 = NULL; iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts); @@ -403,7 +402,7 @@ interpolate_cubic_get_value_array (GstTimedValueControlSource * self, g_mutex_lock (self->lock); for (i = 0; i < n_values; i++) { - val = FP_NAN; + val = NAN; if (ts >= next_ts) { cp1 = cp2 = NULL; iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts); diff --git a/libs/gst/controller/gsttriggercontrolsource.c b/libs/gst/controller/gsttriggercontrolsource.c index 5105a6d2e7..931ffc54a5 100644 --- a/libs/gst/controller/gsttriggercontrolsource.c +++ b/libs/gst/controller/gsttriggercontrolsource.c @@ -41,8 +41,7 @@ #include "gsttriggercontrolsource.h" #include "gst/glib-compat-private.h" - -#include +#include "gst/math-compat.h" #define GST_CAT_DEFAULT controller_debug GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); @@ -79,7 +78,7 @@ _interpolate_trigger (GstTimedValueControlSource * self, GSequenceIter * iter, if (found) { return cp->value; } - return FP_NAN; + return NAN; } static gboolean @@ -117,7 +116,7 @@ interpolate_trigger_get_value_array (GstTimedValueControlSource * self, g_mutex_lock (self->lock); for (i = 0; i < n_values; i++) { - val = FP_NAN; + val = NAN; if (ts >= next_ts) { iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts); if (!iter1) {