dtmf: Move duplicate #defines into a common include
authorOlivier Crête <olivier.crete@collabora.co.uk>
Thu, 14 Apr 2011 01:58:36 +0000 (21:58 -0400)
committerOlivier Crête <olivier.crete@collabora.co.uk>
Thu, 14 Apr 2011 01:59:42 +0000 (21:59 -0400)
Centralize duplicated constants so they have the same value.
Also standardise minimum tone duration to 250ms and minimum inter-tone
interval to 100ms.

gst/dtmf/Makefile.am
gst/dtmf/gstdtmfcommon.h [moved from gst/dtmf/gstrtpdtmfcommon.h with 65% similarity]
gst/dtmf/gstdtmfsrc.c
gst/dtmf/gstrtpdtmfdepay.c
gst/dtmf/gstrtpdtmfdepay.h
gst/dtmf/gstrtpdtmfsrc.c
gst/dtmf/gstrtpdtmfsrc.h

index 761575d..d574323 100644 (file)
@@ -11,7 +11,7 @@ noinst_HEADERS = gstdtmfsrc.h \
                  gstdtmfdetect.h \
                  gstrtpdtmfsrc.h \
                  gstrtpdtmfdepay.h \
-                 gstrtpdtmfcommon.h \
+                 gstdtmfcommon.h \
                  tone_detect.h
 
 libgstdtmf_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \
similarity index 65%
rename from gst/dtmf/gstrtpdtmfcommon.h
rename to gst/dtmf/gstdtmfcommon.h
index c1ab82e..aff881b 100644 (file)
@@ -2,6 +2,20 @@
 #ifndef __GST_RTP_DTMF_COMMON_H__
 #define __GST_RTP_DTMF_COMMON_H__
 
+#define MIN_INTER_DIGIT_INTERVAL 100     /* ms */
+#define MIN_PULSE_DURATION       250     /* ms */
+
+#define MIN_VOLUME               0
+#define MAX_VOLUME               36
+
+#define MIN_EVENT                0
+#define MAX_EVENT                16
+#define MIN_EVENT_STRING         "0"
+#define MAX_EVENT_STRING         "16"
+
+#ifndef M_PI
+#define M_PI           3.14159265358979323846  /* pi */
+#endif
 
 typedef struct
 {
index f929bae..79525b5 100644 (file)
 
 #include <glib.h>
 
-#ifndef M_PI
-#define M_PI           3.14159265358979323846   /* pi */
-#endif
-
+#include "gstdtmfcommon.h"
 
 #include "gstdtmfsrc.h"
 
 #define DEFAULT_SAMPLE_RATE      8000
 #define SAMPLE_SIZE              16
 #define CHANNELS                 1
-#define MIN_EVENT                0
-#define MAX_EVENT                16
-#define MIN_VOLUME               0
-#define MAX_VOLUME               36
-#define MIN_INTER_DIGIT_INTERVAL 100
-#define MIN_PULSE_DURATION       250
 #define MIN_DUTY_CYCLE           (MIN_INTER_DIGIT_INTERVAL + MIN_PULSE_DURATION)
 
 
index ccf2b02..603416d 100644 (file)
@@ -81,7 +81,7 @@
  */
 
 #ifdef HAVE_CONFIG_H
-#  include "config.h"
+#include "config.h"
 #endif
 
 #include <string.h>
 #include <gst/rtp/gstrtpbuffer.h>
 #include "gstrtpdtmfdepay.h"
 
-#ifndef M_PI
-# define M_PI           3.14159265358979323846  /* pi */
-#endif
-
-
 #define DEFAULT_PACKET_INTERVAL  50     /* ms */
 #define MIN_PACKET_INTERVAL      10     /* ms */
 #define MAX_PACKET_INTERVAL      50     /* ms */
 #define SAMPLE_RATE              8000
 #define SAMPLE_SIZE              16
 #define CHANNELS                 1
-#define MIN_EVENT                0
-#define MAX_EVENT                16
-#define MIN_VOLUME               0
-#define MAX_VOLUME               36
-#define MIN_INTER_DIGIT_INTERVAL 100
-#define MIN_PULSE_DURATION       250
 #define MIN_DUTY_CYCLE           (MIN_INTER_DIGIT_INTERVAL + MIN_PULSE_DURATION)
 
 #define MIN_UNIT_TIME            0
index 172cb84..65d9454 100644 (file)
@@ -27,7 +27,7 @@
 #include <gst/base/gstadapter.h>
 #include <gst/rtp/gstbasertpdepayload.h>
 
-#include "gstrtpdtmfcommon.h"
+#include "gstdtmfcommon.h"
 
 G_BEGIN_DECLS
 #define GST_TYPE_RTP_DTMF_DEPAY \
index ec2c6c6..c7e1c1f 100644 (file)
 #define DEFAULT_TIMESTAMP_OFFSET -1
 #define DEFAULT_SEQNUM_OFFSET    -1
 #define DEFAULT_CLOCK_RATE       8000
-#define MIN_EVENT                0
-#define MAX_EVENT                16
-#define MIN_EVENT_STRING         "0"
-#define MAX_EVENT_STRING         "16"
-#define MIN_VOLUME               0
-#define MAX_VOLUME               36
-
-#define MIN_INTER_DIGIT_INTERVAL 50     /* ms */
-#define MIN_PULSE_DURATION       70     /* ms */
 
 #define DEFAULT_PACKET_REDUNDANCY 1
 #define MIN_PACKET_REDUNDANCY 1
index b1a483a..d04c6ec 100644 (file)
@@ -29,7 +29,7 @@
 #include <gst/base/gstbasesrc.h>
 #include <gst/rtp/gstrtpbuffer.h>
 
-#include "gstrtpdtmfcommon.h"
+#include "gstdtmfcommon.h"
 
 G_BEGIN_DECLS
 #define GST_TYPE_RTP_DTMF_SRC          (gst_rtp_dtmf_src_get_type())