controller: use NAN instead of FP_NAN (which is the class)
authorStefan Sauer <ensonic@users.sf.net>
Fri, 30 Dec 2011 12:32:18 +0000 (13:32 +0100)
committerStefan Sauer <ensonic@users.sf.net>
Fri, 30 Dec 2011 12:33:48 +0000 (13:33 +0100)
Also add a fallback define to math-compat.h.
Fixes #666887

gst/math-compat.h
libs/gst/controller/gstinterpolationcontrolsource.c
libs/gst/controller/gsttriggercontrolsource.c

index d9b368c..8ad1c25 100644 (file)
@@ -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__ */
index f0d67a3..ecc5f5e 100644 (file)
@@ -41,8 +41,7 @@
 
 #include "gstinterpolationcontrolsource.h"
 #include "gst/glib-compat-private.h"
-
-#include <math.h>
+#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);
index 5105a6d..931ffc5 100644 (file)
@@ -41,8 +41,7 @@
 
 #include "gsttriggercontrolsource.h"
 #include "gst/glib-compat-private.h"
-
-#include <math.h>
+#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) {