dtmf: build fixes for MSVC
authorDavid Schleef <ds@schleef.org>
Fri, 31 Dec 2010 02:20:47 +0000 (18:20 -0800)
committerDavid Schleef <ds@schleef.org>
Fri, 31 Dec 2010 02:39:21 +0000 (18:39 -0800)
Use gint16 and G_PI.

gst/dtmf/gstdtmfdetect.c
gst/dtmf/tone_detect.c
gst/dtmf/tone_detect.h

index 6fa17b5..0bb9242 100644 (file)
@@ -175,7 +175,7 @@ gst_dtmf_detect_transform_ip (GstBaseTransform * trans, GstBuffer * buf)
   if (GST_BUFFER_FLAG_IS_SET (buf, GST_BUFFER_FLAG_GAP))
     return GST_FLOW_OK;
 
-  zap_dtmf_detect (&self->dtmf_state, (int16_t *) GST_BUFFER_DATA (buf),
+  zap_dtmf_detect (&self->dtmf_state, (gint16 *) GST_BUFFER_DATA (buf),
       GST_BUFFER_SIZE (buf) / 2, FALSE);
 
   dtmf_count = zap_dtmf_get (&self->dtmf_state, dtmfbuf, MAX_DTMF_DIGITS);
index d8f1df1..8c1b5ad 100644 (file)
@@ -199,16 +199,16 @@ zap_dtmf_detect_init (dtmf_detect_state_t * s)
   s->hit1 = s->hit2 = 0;
 
   for (i = 0; i < 4; i++) {
-    theta = 2.0 * M_PI * (dtmf_row[i] / SAMPLE_RATE);
+    theta = 2.0 * G_PI * (dtmf_row[i] / SAMPLE_RATE);
     dtmf_detect_row[i].fac = 2.0 * cos (theta);
 
-    theta = 2.0 * M_PI * (dtmf_col[i] / SAMPLE_RATE);
+    theta = 2.0 * G_PI * (dtmf_col[i] / SAMPLE_RATE);
     dtmf_detect_col[i].fac = 2.0 * cos (theta);
 
-    theta = 2.0 * M_PI * (dtmf_row[i] * 2.0 / SAMPLE_RATE);
+    theta = 2.0 * G_PI * (dtmf_row[i] * 2.0 / SAMPLE_RATE);
     dtmf_detect_row_2nd[i].fac = 2.0 * cos (theta);
 
-    theta = 2.0 * M_PI * (dtmf_col[i] * 2.0 / SAMPLE_RATE);
+    theta = 2.0 * G_PI * (dtmf_col[i] * 2.0 / SAMPLE_RATE);
     dtmf_detect_col_2nd[i].fac = 2.0 * cos (theta);
 
     goertzel_init (&s->row_out[i], &dtmf_detect_row[i]);
@@ -220,12 +220,12 @@ zap_dtmf_detect_init (dtmf_detect_state_t * s)
   }
 
   /* Same for the fax dector */
-  theta = 2.0 * M_PI * (fax_freq / SAMPLE_RATE);
+  theta = 2.0 * G_PI * (fax_freq / SAMPLE_RATE);
   fax_detect.fac = 2.0 * cos (theta);
   goertzel_init (&s->fax_tone, &fax_detect);
 
   /* Same for the fax dector 2nd harmonic */
-  theta = 2.0 * M_PI * (fax_freq * 2.0 / SAMPLE_RATE);
+  theta = 2.0 * G_PI * (fax_freq * 2.0 / SAMPLE_RATE);
   fax_detect_2nd.fac = 2.0 * cos (theta);
   goertzel_init (&s->fax_tone2nd, &fax_detect_2nd);
 
index 909c5ef..ce6dddd 100644 (file)
@@ -35,6 +35,8 @@
 
 #include "_stdint.h"
 
+#include <glib.h>
+
 typedef struct
 {
     float v2;
@@ -75,13 +77,13 @@ typedef struct
 } tone_detection_descriptor_t;
 
 void zap_goertzel_update(goertzel_state_t *s,
-                     int16_t x[],
+                     gint16 x[],
                      int samples);
 float zap_goertzel_result (goertzel_state_t *s);
 
 void zap_dtmf_detect_init (dtmf_detect_state_t *s);
 int zap_dtmf_detect (dtmf_detect_state_t *s,
-                 int16_t amp[],
+                 gint16 amp[],
                  int samples,
                 int isradio);
 int zap_dtmf_get (dtmf_detect_state_t *s,