controller: use NAN instead of FP_NAN (which is the class)

Also add a fallback define to math-compat.h.
Fixes #666887
This commit is contained in:
Stefan Sauer 2011-12-30 13:32:18 +01:00
parent e136cc334f
commit eba636cc83
3 changed files with 25 additions and 9 deletions

View file

@ -79,6 +79,24 @@ __gst_math_compat_rintf (float x)
#define rintf(x) __gst_math_compat_rintf(x) #define rintf(x) __gst_math_compat_rintf(x)
#endif #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 G_END_DECLS
#endif /* __GST_MATH_COMPAT_H__ */ #endif /* __GST_MATH_COMPAT_H__ */

View file

@ -41,8 +41,7 @@
#include "gstinterpolationcontrolsource.h" #include "gstinterpolationcontrolsource.h"
#include "gst/glib-compat-private.h" #include "gst/glib-compat-private.h"
#include "gst/math-compat.h"
#include <math.h>
#define GST_CAT_DEFAULT controller_debug #define GST_CAT_DEFAULT controller_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
@ -90,7 +89,7 @@ interpolate_none_get_value_array (GstTimedValueControlSource * self,
g_mutex_lock (self->lock); g_mutex_lock (self->lock);
for (i = 0; i < n_values; i++) { for (i = 0; i < n_values; i++) {
val = FP_NAN; val = NAN;
if (ts >= next_ts) { if (ts >= next_ts) {
iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts); iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts);
if (!iter1) { if (!iter1) {
@ -189,7 +188,7 @@ interpolate_linear_get_value_array (GstTimedValueControlSource * self,
g_mutex_lock (self->lock); g_mutex_lock (self->lock);
for (i = 0; i < n_values; i++) { for (i = 0; i < n_values; i++) {
val = FP_NAN; val = NAN;
if (ts >= next_ts) { if (ts >= next_ts) {
cp1 = cp2 = NULL; cp1 = cp2 = NULL;
iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts); 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); g_mutex_lock (self->lock);
for (i = 0; i < n_values; i++) { for (i = 0; i < n_values; i++) {
val = FP_NAN; val = NAN;
if (ts >= next_ts) { if (ts >= next_ts) {
cp1 = cp2 = NULL; cp1 = cp2 = NULL;
iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts); iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts);

View file

@ -41,8 +41,7 @@
#include "gsttriggercontrolsource.h" #include "gsttriggercontrolsource.h"
#include "gst/glib-compat-private.h" #include "gst/glib-compat-private.h"
#include "gst/math-compat.h"
#include <math.h>
#define GST_CAT_DEFAULT controller_debug #define GST_CAT_DEFAULT controller_debug
GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT); GST_DEBUG_CATEGORY_STATIC (GST_CAT_DEFAULT);
@ -79,7 +78,7 @@ _interpolate_trigger (GstTimedValueControlSource * self, GSequenceIter * iter,
if (found) { if (found) {
return cp->value; return cp->value;
} }
return FP_NAN; return NAN;
} }
static gboolean static gboolean
@ -117,7 +116,7 @@ interpolate_trigger_get_value_array (GstTimedValueControlSource * self,
g_mutex_lock (self->lock); g_mutex_lock (self->lock);
for (i = 0; i < n_values; i++) { for (i = 0; i < n_values; i++) {
val = FP_NAN; val = NAN;
if (ts >= next_ts) { if (ts >= next_ts) {
iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts); iter1 = gst_timed_value_control_source_find_control_point_iter (self, ts);
if (!iter1) { if (!iter1) {