dtmf: Move duplicate #defines into a common include

Centralize duplicated constants so they have the same value.
Also standardise minimum tone duration to 250ms and minimum inter-tone
interval to 100ms.
This commit is contained in:
Olivier Crête 2011-04-13 21:58:36 -04:00
parent 26553bfb1d
commit 747f32a857
7 changed files with 19 additions and 34 deletions

View file

@ -11,7 +11,7 @@ noinst_HEADERS = gstdtmfsrc.h \
gstdtmfdetect.h \ gstdtmfdetect.h \
gstrtpdtmfsrc.h \ gstrtpdtmfsrc.h \
gstrtpdtmfdepay.h \ gstrtpdtmfdepay.h \
gstrtpdtmfcommon.h \ gstdtmfcommon.h \
tone_detect.h tone_detect.h
libgstdtmf_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \ libgstdtmf_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_CFLAGS) \

View file

@ -2,6 +2,20 @@
#ifndef __GST_RTP_DTMF_COMMON_H__ #ifndef __GST_RTP_DTMF_COMMON_H__
#define __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 typedef struct
{ {

View file

@ -122,10 +122,7 @@
#include <glib.h> #include <glib.h>
#ifndef M_PI #include "gstdtmfcommon.h"
#define M_PI 3.14159265358979323846 /* pi */
#endif
#include "gstdtmfsrc.h" #include "gstdtmfsrc.h"
@ -136,12 +133,6 @@
#define DEFAULT_SAMPLE_RATE 8000 #define DEFAULT_SAMPLE_RATE 8000
#define SAMPLE_SIZE 16 #define SAMPLE_SIZE 16
#define CHANNELS 1 #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_DUTY_CYCLE (MIN_INTER_DIGIT_INTERVAL + MIN_PULSE_DURATION)

View file

@ -81,7 +81,7 @@
*/ */
#ifdef HAVE_CONFIG_H #ifdef HAVE_CONFIG_H
# include "config.h" #include "config.h"
#endif #endif
#include <string.h> #include <string.h>
@ -90,23 +90,12 @@
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpdtmfdepay.h" #include "gstrtpdtmfdepay.h"
#ifndef M_PI
# define M_PI 3.14159265358979323846 /* pi */
#endif
#define DEFAULT_PACKET_INTERVAL 50 /* ms */ #define DEFAULT_PACKET_INTERVAL 50 /* ms */
#define MIN_PACKET_INTERVAL 10 /* ms */ #define MIN_PACKET_INTERVAL 10 /* ms */
#define MAX_PACKET_INTERVAL 50 /* ms */ #define MAX_PACKET_INTERVAL 50 /* ms */
#define SAMPLE_RATE 8000 #define SAMPLE_RATE 8000
#define SAMPLE_SIZE 16 #define SAMPLE_SIZE 16
#define CHANNELS 1 #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_DUTY_CYCLE (MIN_INTER_DIGIT_INTERVAL + MIN_PULSE_DURATION)
#define MIN_UNIT_TIME 0 #define MIN_UNIT_TIME 0

View file

@ -27,7 +27,7 @@
#include <gst/base/gstadapter.h> #include <gst/base/gstadapter.h>
#include <gst/rtp/gstbasertpdepayload.h> #include <gst/rtp/gstbasertpdepayload.h>
#include "gstrtpdtmfcommon.h" #include "gstdtmfcommon.h"
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_RTP_DTMF_DEPAY \ #define GST_TYPE_RTP_DTMF_DEPAY \

View file

@ -130,15 +130,6 @@
#define DEFAULT_TIMESTAMP_OFFSET -1 #define DEFAULT_TIMESTAMP_OFFSET -1
#define DEFAULT_SEQNUM_OFFSET -1 #define DEFAULT_SEQNUM_OFFSET -1
#define DEFAULT_CLOCK_RATE 8000 #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 DEFAULT_PACKET_REDUNDANCY 1
#define MIN_PACKET_REDUNDANCY 1 #define MIN_PACKET_REDUNDANCY 1

View file

@ -29,7 +29,7 @@
#include <gst/base/gstbasesrc.h> #include <gst/base/gstbasesrc.h>
#include <gst/rtp/gstrtpbuffer.h> #include <gst/rtp/gstrtpbuffer.h>
#include "gstrtpdtmfcommon.h" #include "gstdtmfcommon.h"
G_BEGIN_DECLS G_BEGIN_DECLS
#define GST_TYPE_RTP_DTMF_SRC (gst_rtp_dtmf_src_get_type()) #define GST_TYPE_RTP_DTMF_SRC (gst_rtp_dtmf_src_get_type())