Re-indent to Gst style
authorOlivier CrĂȘte <olivier.crete@collabora.co.uk>
Fri, 20 Feb 2009 22:37:43 +0000 (17:37 -0500)
committerEdward Hervey <bilboed@bilboed.com>
Sat, 21 Feb 2009 16:48:07 +0000 (17:48 +0100)
gst/dtmf/gstdtmf.c
gst/dtmf/gstdtmfsrc.c
gst/dtmf/gstdtmfsrc.h
gst/dtmf/gstrtpdtmfcommon.h
gst/dtmf/gstrtpdtmfdepay.c
gst/dtmf/gstrtpdtmfdepay.h
gst/dtmf/gstrtpdtmfsrc.c
gst/dtmf/gstrtpdtmfsrc.h

index 86bbafa..4d9d1a5 100644 (file)
@@ -26,6 +26,4 @@ plugin_init (GstPlugin * plugin)
 
 GST_PLUGIN_DEFINE (GST_VERSION_MAJOR,
     GST_VERSION_MINOR,
-    "dtmf",
-    "DTMF plugins",
-    plugin_init, "0.1" , "LGPL", "DTMF", "");
+    "dtmf", "DTMF plugins", plugin_init, "0.1", "LGPL", "DTMF", "");
index 4b2f9a2..06e27d4 100644 (file)
 #include "gstdtmfsrc.h"
 
 #define GST_TONE_DTMF_TYPE_EVENT 1
-#define DEFAULT_PACKET_INTERVAL  50 /* ms */
-#define MIN_PACKET_INTERVAL      10 /* ms */
-#define MAX_PACKET_INTERVAL      50 /* ms */
+#define DEFAULT_PACKET_INTERVAL  50     /* ms */
+#define MIN_PACKET_INTERVAL      10     /* ms */
+#define MAX_PACKET_INTERVAL      50     /* ms */
 #define DEFAULT_SAMPLE_RATE      8000
 #define SAMPLE_SIZE              16
 #define CHANNELS                 1
 #define MIN_DUTY_CYCLE           (MIN_INTER_DIGIT_INTERVAL + MIN_PULSE_DURATION)
 
 
-typedef struct st_dtmf_key {
-        char *event_name;
-        int event_encoding;
-        float low_frequency;
-        float high_frequency;
+typedef struct st_dtmf_key
+{
+  char *event_name;
+  int event_encoding;
+  float low_frequency;
+  float high_frequency;
 } DTMF_KEY;
 
 static const DTMF_KEY DTMF_KEYS[] = {
-        {"DTMF_KEY_EVENT_0",  0, 941, 1336},
-        {"DTMF_KEY_EVENT_1",  1, 697, 1209},
-        {"DTMF_KEY_EVENT_2",  2, 697, 1336},
-        {"DTMF_KEY_EVENT_3",  3, 697, 1477},
-        {"DTMF_KEY_EVENT_4",  4, 770, 1209},
-        {"DTMF_KEY_EVENT_5",  5, 770, 1336},
-        {"DTMF_KEY_EVENT_6",  6, 770, 1477},
-        {"DTMF_KEY_EVENT_7",  7, 852, 1209},
-        {"DTMF_KEY_EVENT_8",  8, 852, 1336},
-        {"DTMF_KEY_EVENT_9",  9, 852, 1477},
-        {"DTMF_KEY_EVENT_S", 10, 941, 1209},
-        {"DTMF_KEY_EVENT_P", 11, 941, 1477},
-        {"DTMF_KEY_EVENT_A", 12, 697, 1633},
-        {"DTMF_KEY_EVENT_B", 13, 770, 1633},
-        {"DTMF_KEY_EVENT_C", 14, 852, 1633},
-        {"DTMF_KEY_EVENT_D", 15, 941, 1633},
+  {"DTMF_KEY_EVENT_0", 0, 941, 1336},
+  {"DTMF_KEY_EVENT_1", 1, 697, 1209},
+  {"DTMF_KEY_EVENT_2", 2, 697, 1336},
+  {"DTMF_KEY_EVENT_3", 3, 697, 1477},
+  {"DTMF_KEY_EVENT_4", 4, 770, 1209},
+  {"DTMF_KEY_EVENT_5", 5, 770, 1336},
+  {"DTMF_KEY_EVENT_6", 6, 770, 1477},
+  {"DTMF_KEY_EVENT_7", 7, 852, 1209},
+  {"DTMF_KEY_EVENT_8", 8, 852, 1336},
+  {"DTMF_KEY_EVENT_9", 9, 852, 1477},
+  {"DTMF_KEY_EVENT_S", 10, 941, 1209},
+  {"DTMF_KEY_EVENT_P", 11, 941, 1477},
+  {"DTMF_KEY_EVENT_A", 12, 697, 1633},
+  {"DTMF_KEY_EVENT_B", 13, 770, 1633},
+  {"DTMF_KEY_EVENT_C", 14, 852, 1633},
+  {"DTMF_KEY_EVENT_D", 15, 941, 1633},
 };
 
 #define MAX_DTMF_EVENTS 16
 
-enum {
-DTMF_KEY_EVENT_1 = 1,
-DTMF_KEY_EVENT_2 = 2,
-DTMF_KEY_EVENT_3 = 3,
-DTMF_KEY_EVENT_4 = 4,
-DTMF_KEY_EVENT_5 = 5,
-DTMF_KEY_EVENT_6 = 6,
-DTMF_KEY_EVENT_7 = 7,
-DTMF_KEY_EVENT_8 = 8,
-DTMF_KEY_EVENT_9 = 9,
-DTMF_KEY_EVENT_0 = 0,
-DTMF_KEY_EVENT_STAR = 10,
-DTMF_KEY_EVENT_POUND = 11,
-DTMF_KEY_EVENT_A = 12,
-DTMF_KEY_EVENT_B = 13,
-DTMF_KEY_EVENT_C = 14,
-DTMF_KEY_EVENT_D = 15,
+enum
+{
+  DTMF_KEY_EVENT_1 = 1,
+  DTMF_KEY_EVENT_2 = 2,
+  DTMF_KEY_EVENT_3 = 3,
+  DTMF_KEY_EVENT_4 = 4,
+  DTMF_KEY_EVENT_5 = 5,
+  DTMF_KEY_EVENT_6 = 6,
+  DTMF_KEY_EVENT_7 = 7,
+  DTMF_KEY_EVENT_8 = 8,
+  DTMF_KEY_EVENT_9 = 9,
+  DTMF_KEY_EVENT_0 = 0,
+  DTMF_KEY_EVENT_STAR = 10,
+  DTMF_KEY_EVENT_POUND = 11,
+  DTMF_KEY_EVENT_A = 12,
+  DTMF_KEY_EVENT_B = 13,
+  DTMF_KEY_EVENT_C = 14,
+  DTMF_KEY_EVENT_D = 15,
 };
 
 /* elementfactory information */
@@ -228,9 +230,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
         "width = (int) 16, "
         "depth = (int) 16, "
         "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
-        "signed = (bool) true, "
-        "rate = (int) 8000, "
-        "channels = (int) 1")
+        "signed = (bool) true, " "rate = (int) 8000, " "channels = (int) 1")
     );
 
 GST_BOILERPLATE (GstDTMFSrc, gst_dtmf_src, GstBaseSrc, GST_TYPE_BASE_SRC);
@@ -241,18 +241,18 @@ static void gst_dtmf_src_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void gst_dtmf_src_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
-static gboolean gst_dtmf_src_handle_event (GstBaseSrc *src, GstEvent * event);
+static gboolean gst_dtmf_src_handle_event (GstBaseSrc * src, GstEvent * event);
 static GstStateChangeReturn gst_dtmf_src_change_state (GstElement * element,
     GstStateChange transition);
 static GstFlowReturn gst_dtmf_src_create (GstBaseSrc * basesrc,
     guint64 offset, guint length, GstBuffer ** buffer);
-static void gst_dtmf_src_add_start_event (GstDTMFSrc *dtmfsrc,
+static void gst_dtmf_src_add_start_event (GstDTMFSrc * dtmfsrc,
     gint event_number, gint event_volume);
-static void gst_dtmf_src_add_stop_event (GstDTMFSrc *dtmfsrc);
+static void gst_dtmf_src_add_stop_event (GstDTMFSrc * dtmfsrc);
 
-static gboolean gst_dtmf_src_unlock (GstBaseSrc *src);
+static gboolean gst_dtmf_src_unlock (GstBaseSrc * src);
 
-static gboolean gst_dtmf_src_unlock_stop (GstBaseSrc *src);
+static gboolean gst_dtmf_src_unlock_stop (GstBaseSrc * src);
 static gboolean gst_dtmf_src_negotiate (GstBaseSrc * basesrc);
 
 static void
@@ -260,8 +260,7 @@ gst_dtmf_src_base_init (gpointer g_class)
 {
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
-  GST_DEBUG_CATEGORY_INIT (gst_dtmf_src_debug,
-          "dtmfsrc", 0, "dtmfsrc element");
+  GST_DEBUG_CATEGORY_INIT (gst_dtmf_src_debug, "dtmfsrc", 0, "dtmfsrc element");
 
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&gst_dtmf_src_template));
@@ -282,10 +281,8 @@ gst_dtmf_src_class_init (GstDTMFSrcClass * klass)
 
 
   gobject_class->finalize = GST_DEBUG_FUNCPTR (gst_dtmf_src_finalize);
-  gobject_class->set_property =
-      GST_DEBUG_FUNCPTR (gst_dtmf_src_set_property);
-  gobject_class->get_property =
-      GST_DEBUG_FUNCPTR (gst_dtmf_src_get_property);
+  gobject_class->set_property = GST_DEBUG_FUNCPTR (gst_dtmf_src_set_property);
+  gobject_class->get_property = GST_DEBUG_FUNCPTR (gst_dtmf_src_get_property);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_INTERVAL,
       g_param_spec_uint ("interval", "Interval between tone packets",
@@ -294,22 +291,17 @@ gst_dtmf_src_class_init (GstDTMFSrcClass * klass)
 
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_dtmf_src_change_state);
-  gstbasesrc_class->unlock =
-      GST_DEBUG_FUNCPTR (gst_dtmf_src_unlock);
-  gstbasesrc_class->unlock_stop =
-      GST_DEBUG_FUNCPTR (gst_dtmf_src_unlock_stop);
-
-  gstbasesrc_class->event =
-      GST_DEBUG_FUNCPTR (gst_dtmf_src_handle_event);
-  gstbasesrc_class->create =
-      GST_DEBUG_FUNCPTR (gst_dtmf_src_create);
-  gstbasesrc_class->negotiate =
-      GST_DEBUG_FUNCPTR (gst_dtmf_src_negotiate);
+  gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_dtmf_src_unlock);
+  gstbasesrc_class->unlock_stop = GST_DEBUG_FUNCPTR (gst_dtmf_src_unlock_stop);
+
+  gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_dtmf_src_handle_event);
+  gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_dtmf_src_create);
+  gstbasesrc_class->negotiate = GST_DEBUG_FUNCPTR (gst_dtmf_src_negotiate);
 }
 
 
 static void
-gst_dtmf_src_init (GstDTMFSrc * dtmfsrc, GstDTMFSrcClass *g_class)
+gst_dtmf_src_init (GstDTMFSrc * dtmfsrc, GstDTMFSrcClass * g_class)
 {
   /* we operate in time */
   gst_base_src_set_format (GST_BASE_SRC (dtmfsrc), GST_FORMAT_TIME);
@@ -341,8 +333,8 @@ gst_dtmf_src_finalize (GObject * object)
 }
 
 static gboolean
-gst_dtmf_src_handle_dtmf_event (GstDTMFSrc *dtmfsrc,
-        const GstStructure * event_structure)
+gst_dtmf_src_handle_dtmf_event (GstDTMFSrc * dtmfsrc,
+    const GstStructure * event_structure)
 {
   gint event_type;
   gboolean start;
@@ -364,11 +356,11 @@ gst_dtmf_src_handle_dtmf_event (GstDTMFSrc *dtmfsrc,
     gint event_volume;
 
     if (!gst_structure_get_int (event_structure, "number", &event_number) ||
-            !gst_structure_get_int (event_structure, "volume", &event_volume))
+        !gst_structure_get_int (event_structure, "volume", &event_volume))
       goto failure;
 
     GST_DEBUG_OBJECT (dtmfsrc, "Received start event %d with volume %d",
-            event_number, event_volume);
+        event_number, event_volume);
     gst_dtmf_src_add_start_event (dtmfsrc, event_number, event_volume);
   }
 
@@ -383,8 +375,7 @@ failure:
 }
 
 static gboolean
-gst_dtmf_src_handle_custom_upstream (GstDTMFSrc *dtmfsrc,
-    GstEvent * event)
+gst_dtmf_src_handle_custom_upstream (GstDTMFSrc * dtmfsrc, GstEvent * event)
 {
   gboolean result = FALSE;
   const GstStructure *structure;
@@ -459,23 +450,23 @@ gst_dtmf_src_get_property (GObject * object, guint prop_id, GValue * value,
 }
 
 static void
-gst_dtmf_src_set_stream_lock (GstDTMFSrc *dtmfsrc, gboolean lock)
+gst_dtmf_src_set_stream_lock (GstDTMFSrc * dtmfsrc, gboolean lock)
 {
-   GstPad *srcpad = GST_BASE_SRC_PAD (dtmfsrc);
-   GstEvent *event;
-   GstStructure *structure;
+  GstPad *srcpad = GST_BASE_SRC_PAD (dtmfsrc);
+  GstEvent *event;
+  GstStructure *structure;
 
-   structure = gst_structure_new ("stream-lock",
-                      "lock", G_TYPE_BOOLEAN, lock, NULL);
+  structure = gst_structure_new ("stream-lock",
+      "lock", G_TYPE_BOOLEAN, lock, NULL);
 
-   event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, structure);
-   if (!gst_pad_push_event (srcpad, event)) {
-     GST_WARNING_OBJECT (dtmfsrc, "stream-lock event not handled");
-   }
+  event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, structure);
+  if (!gst_pad_push_event (srcpad, event)) {
+    GST_WARNING_OBJECT (dtmfsrc, "stream-lock event not handled");
+  }
 }
 
 static void
-gst_dtmf_prepare_timestamps (GstDTMFSrc *dtmfsrc)
+gst_dtmf_prepare_timestamps (GstDTMFSrc * dtmfsrc)
 {
   GstClock *clock;
   GstClockTime base_time;
@@ -499,11 +490,11 @@ gst_dtmf_prepare_timestamps (GstDTMFSrc *dtmfsrc)
 }
 
 static void
-gst_dtmf_src_add_start_event (GstDTMFSrc *dtmfsrc, gint event_number,
+gst_dtmf_src_add_start_event (GstDTMFSrc * dtmfsrc, gint event_number,
     gint event_volume)
 {
 
-  GstDTMFSrcEvent * event = g_malloc (sizeof(GstDTMFSrcEvent));
+  GstDTMFSrcEvent *event = g_malloc (sizeof (GstDTMFSrcEvent));
   event->event_type = DTMF_EVENT_TYPE_START;
   event->sample = 0;
   event->event_number = CLAMP (event_number, MIN_EVENT, MAX_EVENT);
@@ -513,10 +504,10 @@ gst_dtmf_src_add_start_event (GstDTMFSrc *dtmfsrc, gint event_number,
 }
 
 static void
-gst_dtmf_src_add_stop_event (GstDTMFSrc *dtmfsrc)
+gst_dtmf_src_add_stop_event (GstDTMFSrc * dtmfsrc)
 {
 
-  GstDTMFSrcEvent * event = g_malloc (sizeof(GstDTMFSrcEvent));
+  GstDTMFSrcEvent *event = g_malloc (sizeof (GstDTMFSrcEvent));
   event->event_type = DTMF_EVENT_TYPE_STOP;
   event->sample = 0;
   event->event_number = 0;
@@ -526,22 +517,22 @@ gst_dtmf_src_add_stop_event (GstDTMFSrc *dtmfsrc)
 }
 
 static void
-gst_dtmf_src_generate_silence(GstBuffer * buffer, float duration,
+gst_dtmf_src_generate_silence (GstBuffer * buffer, float duration,
     gint sample_rate)
 {
   gint buf_size;
 
   /* Create a buffer with data set to 0 */
-  buf_size = ((duration/1000)*sample_rate*SAMPLE_SIZE*CHANNELS)/8;
+  buf_size = ((duration / 1000) * sample_rate * SAMPLE_SIZE * CHANNELS) / 8;
   GST_BUFFER_SIZE (buffer) = buf_size;
-  GST_BUFFER_MALLOCDATA (buffer) = g_malloc0(buf_size);
+  GST_BUFFER_MALLOCDATA (buffer) = g_malloc0 (buf_size);
   GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
 
 }
 
 static void
-gst_dtmf_src_generate_tone(GstDTMFSrcEvent *event, DTMF_KEY key, float duration,
-    GstBuffer * buffer, gint sample_rate)
+gst_dtmf_src_generate_tone (GstDTMFSrcEvent * event, DTMF_KEY key,
+    float duration, GstBuffer * buffer, gint sample_rate)
 {
   gint16 *p;
   gint tone_size;
@@ -550,9 +541,9 @@ gst_dtmf_src_generate_tone(GstDTMFSrcEvent *event, DTMF_KEY key, float duration,
   double volume_factor;
 
   /* Create a buffer for the tone */
-  tone_size = ((duration/1000)*sample_rate*SAMPLE_SIZE*CHANNELS)/8;
+  tone_size = ((duration / 1000) * sample_rate * SAMPLE_SIZE * CHANNELS) / 8;
   GST_BUFFER_SIZE (buffer) = tone_size;
-  GST_BUFFER_MALLOCDATA (buffer) = g_malloc(tone_size);
+  GST_BUFFER_MALLOCDATA (buffer) = g_malloc (tone_size);
   GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
 
   p = (gint16 *) GST_BUFFER_MALLOCDATA (buffer);
@@ -563,12 +554,12 @@ gst_dtmf_src_generate_tone(GstDTMFSrcEvent *event, DTMF_KEY key, float duration,
    * For each sample point we calculate 'x' as the
    * the amplitude value.
    */
-  for (i = 0; i < (tone_size / (SAMPLE_SIZE/8)); i++) {
+  for (i = 0; i < (tone_size / (SAMPLE_SIZE / 8)); i++) {
     /*
      * We add the fundamental frequencies together.
      */
-    f1 = sin(2 * M_PI * key.low_frequency * (event->sample / sample_rate));
-    f2 = sin(2 * M_PI * key.high_frequency * (event->sample / sample_rate));
+    f1 = sin (2 * M_PI * key.low_frequency * (event->sample / sample_rate));
+    f2 = sin (2 * M_PI * key.high_frequency * (event->sample / sample_rate));
 
     amplitude = (f1 + f2) / 2;
 
@@ -588,8 +579,8 @@ gst_dtmf_src_generate_tone(GstDTMFSrcEvent *event, DTMF_KEY key, float duration,
 
 
 static GstBuffer *
-gst_dtmf_src_create_next_tone_packet (GstDTMFSrc *dtmfsrc,
-    GstDTMFSrcEvent *event)
+gst_dtmf_src_create_next_tone_packet (GstDTMFSrc * dtmfsrc,
+    GstDTMFSrcEvent * event)
 {
   GstBuffer *buf = NULL;
   gboolean send_silence = FALSE;
@@ -606,12 +597,12 @@ gst_dtmf_src_create_next_tone_packet (GstDTMFSrc *dtmfsrc,
   }
 
   if (send_silence) {
-    GST_DEBUG_OBJECT (dtmfsrc,  "Generating silence");
+    GST_DEBUG_OBJECT (dtmfsrc, "Generating silence");
     gst_dtmf_src_generate_silence (buf, dtmfsrc->interval,
         dtmfsrc->sample_rate);
   } else {
-    GST_DEBUG_OBJECT (dtmfsrc,  "Generating tone");
-    gst_dtmf_src_generate_tone(event, DTMF_KEYS[event->event_number],
+    GST_DEBUG_OBJECT (dtmfsrc, "Generating tone");
+    gst_dtmf_src_generate_tone (event, DTMF_KEYS[event->event_number],
         dtmfsrc->interval, buf, dtmfsrc->sample_rate);
   }
   event->packet_count++;
@@ -634,7 +625,7 @@ gst_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
 {
   GstBuffer *buf = NULL;
   GstDTMFSrcEvent *event;
-  GstDTMFSrc * dtmfsrc;
+  GstDTMFSrc *dtmfsrc;
   GstClock *clock;
   GstClockID *clockid;
   GstClockReturn clockret;
@@ -680,7 +671,7 @@ gst_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
       }
       if (event)
         g_free (event);
-    } else if (dtmfsrc->last_event->packet_count  * dtmfsrc->interval >=
+    } else if (dtmfsrc->last_event->packet_count * dtmfsrc->interval >=
         MIN_DUTY_CYCLE) {
       event = g_async_queue_try_pop (dtmfsrc->event_queue);
 
@@ -740,7 +731,7 @@ gst_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
     GST_OBJECT_LOCK (dtmfsrc);
     if (dtmfsrc->paused)
       clockret = GST_CLOCK_UNSCHEDULED;
-  } else  {
+  } else {
     clockret = GST_CLOCK_UNSCHEDULED;
   }
   gst_clock_id_unref (clockid);
@@ -753,16 +744,17 @@ gst_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
 
   buf = gst_dtmf_src_create_next_tone_packet (dtmfsrc, dtmfsrc->last_event);
 
-  GST_DEBUG_OBJECT (dtmfsrc, "Created buffer of size %d", GST_BUFFER_SIZE (buf));
+  GST_DEBUG_OBJECT (dtmfsrc, "Created buffer of size %d",
+      GST_BUFFER_SIZE (buf));
   *buffer = buf;
 
   GST_DEBUG_OBJECT (dtmfsrc, "returning a buffer");
   return GST_FLOW_OK;
 
- paused_locked:
+paused_locked:
   GST_OBJECT_UNLOCK (dtmfsrc);
 
- paused:
+paused:
 
   if (dtmfsrc->last_event) {
     GST_DEBUG_OBJECT (dtmfsrc, "Stopping current event");
@@ -777,7 +769,8 @@ gst_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
 }
 
 static gboolean
-gst_dtmf_src_unlock (GstBaseSrc *src) {
+gst_dtmf_src_unlock (GstBaseSrc * src)
+{
   GstDTMFSrc *dtmfsrc = GST_DTMF_SRC (src);
   GstDTMFSrcEvent *event = NULL;
 
@@ -791,7 +784,7 @@ gst_dtmf_src_unlock (GstBaseSrc *src) {
   GST_OBJECT_UNLOCK (dtmfsrc);
 
   GST_DEBUG_OBJECT (dtmfsrc, "Pushing the PAUSE_TASK event on unlock request");
-  event = g_malloc (sizeof(GstDTMFSrcEvent));
+  event = g_malloc (sizeof (GstDTMFSrcEvent));
   event->event_type = DTMF_EVENT_TYPE_PAUSE_TASK;
   g_async_queue_push (dtmfsrc->event_queue, event);
 
@@ -800,7 +793,8 @@ gst_dtmf_src_unlock (GstBaseSrc *src) {
 
 
 static gboolean
-gst_dtmf_src_unlock_stop (GstBaseSrc *src) {
+gst_dtmf_src_unlock_stop (GstBaseSrc * src)
+{
   GstDTMFSrc *dtmfsrc = GST_DTMF_SRC (src);
 
   GST_DEBUG_OBJECT (dtmfsrc, "Unlock stopped");
@@ -824,17 +818,14 @@ gst_dtmf_src_negotiate (GstBaseSrc * basesrc)
       "width", G_TYPE_INT, 16,
       "depth", G_TYPE_INT, 16,
       "endianness", G_TYPE_INT, G_BYTE_ORDER,
-      "signed", G_TYPE_BOOLEAN, TRUE,
-      "channels", G_TYPE_INT, 1,
-      NULL);
+      "signed", G_TYPE_BOOLEAN, TRUE, "channels", G_TYPE_INT, 1, NULL);
 
   peercaps = gst_pad_peer_get_caps (GST_BASE_SRC_PAD (basesrc));
 
   if (peercaps == NULL) {
     /* no peer caps, just add the other properties */
     gst_caps_set_simple (srccaps,
-        "rate", G_TYPE_INT, dtmfsrc->sample_rate,
-        NULL);
+        "rate", G_TYPE_INT, dtmfsrc->sample_rate, NULL);
   } else {
     GstStructure *s;
     gint sample_rate;
@@ -864,17 +855,13 @@ gst_dtmf_src_negotiate (GstBaseSrc * basesrc)
     /* get first structure */
     s = gst_caps_get_structure (srccaps, 0);
 
-    if (gst_structure_get_int (s, "rate", &sample_rate))
-    {
+    if (gst_structure_get_int (s, "rate", &sample_rate)) {
       dtmfsrc->sample_rate = sample_rate;
-      GST_LOG_OBJECT (dtmfsrc, "using rate from caps %d",
-          dtmfsrc->sample_rate);
+      GST_LOG_OBJECT (dtmfsrc, "using rate from caps %d", dtmfsrc->sample_rate);
     } else {
-      GST_LOG_OBJECT (dtmfsrc, "using existing rate %d",
-          dtmfsrc->sample_rate);
+      GST_LOG_OBJECT (dtmfsrc, "using existing rate %d", dtmfsrc->sample_rate);
     }
-    gst_structure_set (s, "rate", G_TYPE_INT, dtmfsrc->sample_rate,
-        NULL);
+    gst_structure_set (s, "rate", G_TYPE_INT, dtmfsrc->sample_rate, NULL);
   }
 
   ret = gst_pad_set_caps (GST_BASE_SRC_PAD (basesrc), srccaps);
@@ -952,4 +939,3 @@ gst_dtmf_src_plugin_init (GstPlugin * plugin)
   return gst_element_register (plugin, "dtmfsrc",
       GST_RANK_NONE, GST_TYPE_DTMF_SRC);
 }
-
index fdf6f50..73970db 100644 (file)
@@ -32,7 +32,6 @@
 #include <gst/base/gstbasesrc.h>
 
 G_BEGIN_DECLS
-
 #define GST_TYPE_DTMF_SRC               (gst_dtmf_src_get_type())
 #define GST_DTMF_SRC(obj)               (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_DTMF_SRC,GstDTMFSrc))
 #define GST_DTMF_SRC_CLASS(klass)       (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_DTMF_SRC,GstDTMFSrcClass))
@@ -40,7 +39,6 @@ G_BEGIN_DECLS
 #define GST_IS_DTMF_SRC(obj)            (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_DTMF_SRC))
 #define GST_IS_DTMF_SRC_CLASS(klass)    (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_DTMF_SRC))
 #define GST_DTMF_SRC_CAST(obj)          ((GstDTMFSrc *)(obj))
-
 typedef struct _GstDTMFSrc GstDTMFSrc;
 typedef struct _GstDTMFSrcClass GstDTMFSrcClass;
 
@@ -51,7 +49,8 @@ typedef struct _GstDTMFSrcClass GstDTMFSrcClass;
  * The opaque #GstDTMFSrc data structure.
  */
 
-enum _GstDTMFEventType {
+enum _GstDTMFEventType
+{
   DTMF_EVENT_TYPE_START,
   DTMF_EVENT_TYPE_STOP,
   DTMF_EVENT_TYPE_PAUSE_TASK
@@ -59,32 +58,35 @@ enum _GstDTMFEventType {
 
 typedef enum _GstDTMFEventType GstDTMFEventType;
 
-struct _GstDTMFSrcEvent {
-  GstDTMFEventType  event_type;
-  double            sample;
-  guint16           event_number;
-  guint16           volume;
-  guint32           packet_count;
+struct _GstDTMFSrcEvent
+{
+  GstDTMFEventType event_type;
+  double sample;
+  guint16 event_number;
+  guint16 volume;
+  guint32 packet_count;
 };
 
 typedef struct _GstDTMFSrcEvent GstDTMFSrcEvent;
 
-struct _GstDTMFSrc {
-  GstBaseSrc        parent;
-  GAsyncQueue*      event_queue;
-  GstDTMFSrcEvent*  last_event;
+struct _GstDTMFSrc
+{
+  GstBaseSrc parent;
+  GAsyncQueue *event_queue;
+  GstDTMFSrcEvent *last_event;
 
-  guint16           interval;
-  GstClockTime      timestamp;
+  guint16 interval;
+  GstClockTime timestamp;
 
-  gboolean          paused;
-  GstClockID        clockid;
+  gboolean paused;
+  GstClockID clockid;
 
-  gint              sample_rate;
+  gint sample_rate;
 };
 
 
-struct _GstDTMFSrcClass {
+struct _GstDTMFSrcClass
+{
   GstBaseSrcClass parent_class;
 };
 
@@ -93,5 +95,4 @@ GType gst_dtmf_src_get_type (void);
 gboolean gst_dtmf_src_plugin_init (GstPlugin * plugin);
 
 G_END_DECLS
-
 #endif /* __GST_DTMF_SRC_H__ */
index 097afa9..c1ab82e 100644 (file)
@@ -3,20 +3,21 @@
 #define __GST_RTP_DTMF_COMMON_H__
 
 
-typedef struct {
-  unsigned  event:8;         /* Current DTMF event */
+typedef struct
+{
+  unsigned event:8;             /* Current DTMF event */
 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
-  unsigned  volume:6;        /* power level of the tone, in dBm0 */
-  unsigned  r:1;             /* Reserved-bit */
-  unsigned  e:1;             /* End-bit */
+  unsigned volume:6;            /* power level of the tone, in dBm0 */
+  unsigned r:1;                 /* Reserved-bit */
+  unsigned e:1;                 /* End-bit */
 #elif G_BYTE_ORDER == G_BIG_ENDIAN
-  unsigned  e:1;             /* End-bit */
-  unsigned  r:1;             /* Reserved-bit */
-  unsigned  volume:6;        /* power level of the tone, in dBm0 */
+  unsigned e:1;                 /* End-bit */
+  unsigned r:1;                 /* Reserved-bit */
+  unsigned volume:6;            /* power level of the tone, in dBm0 */
 #else
 #error "G_BYTE_ORDER should be big or little endian."
 #endif
-  unsigned  duration:16;     /* Duration of digit, in timestamp units */
+  unsigned duration:16;         /* Duration of digit, in timestamp units */
 } GstRTPDTMFPayload;
 
 #endif /* __GST_RTP_DTMF_COMMON_H__ */
index 2032189..3b2097a 100644 (file)
@@ -35,9 +35,9 @@
 #endif
 
 
-#define DEFAULT_PACKET_INTERVAL  50 /* ms */
-#define MIN_PACKET_INTERVAL      10 /* ms */
-#define MAX_PACKET_INTERVAL      50 /* ms */
+#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 DEFAULT_MAX_DURATION     0
 
-typedef struct st_dtmf_key {
-        char *event_name;
-        int event_encoding;
-        float low_frequency;
-        float high_frequency;
+typedef struct st_dtmf_key
+{
+  char *event_name;
+  int event_encoding;
+  float low_frequency;
+  float high_frequency;
 } DTMF_KEY;
 
 static const DTMF_KEY DTMF_KEYS[] = {
-        {"DTMF_KEY_EVENT_0",  0, 941, 1336},
-        {"DTMF_KEY_EVENT_1",  1, 697, 1209},
-        {"DTMF_KEY_EVENT_2",  2, 697, 1336},
-        {"DTMF_KEY_EVENT_3",  3, 697, 1477},
-        {"DTMF_KEY_EVENT_4",  4, 770, 1209},
-        {"DTMF_KEY_EVENT_5",  5, 770, 1336},
-        {"DTMF_KEY_EVENT_6",  6, 770, 1477},
-        {"DTMF_KEY_EVENT_7",  7, 852, 1209},
-        {"DTMF_KEY_EVENT_8",  8, 852, 1336},
-        {"DTMF_KEY_EVENT_9",  9, 852, 1477},
-        {"DTMF_KEY_EVENT_S", 10, 941, 1209},
-        {"DTMF_KEY_EVENT_P", 11, 941, 1477},
-        {"DTMF_KEY_EVENT_A", 12, 697, 1633},
-        {"DTMF_KEY_EVENT_B", 13, 770, 1633},
-        {"DTMF_KEY_EVENT_C", 14, 852, 1633},
-        {"DTMF_KEY_EVENT_D", 15, 941, 1633},
+  {"DTMF_KEY_EVENT_0", 0, 941, 1336},
+  {"DTMF_KEY_EVENT_1", 1, 697, 1209},
+  {"DTMF_KEY_EVENT_2", 2, 697, 1336},
+  {"DTMF_KEY_EVENT_3", 3, 697, 1477},
+  {"DTMF_KEY_EVENT_4", 4, 770, 1209},
+  {"DTMF_KEY_EVENT_5", 5, 770, 1336},
+  {"DTMF_KEY_EVENT_6", 6, 770, 1477},
+  {"DTMF_KEY_EVENT_7", 7, 852, 1209},
+  {"DTMF_KEY_EVENT_8", 8, 852, 1336},
+  {"DTMF_KEY_EVENT_9", 9, 852, 1477},
+  {"DTMF_KEY_EVENT_S", 10, 941, 1209},
+  {"DTMF_KEY_EVENT_P", 11, 941, 1477},
+  {"DTMF_KEY_EVENT_A", 12, 697, 1633},
+  {"DTMF_KEY_EVENT_B", 13, 770, 1633},
+  {"DTMF_KEY_EVENT_C", 14, 852, 1633},
+  {"DTMF_KEY_EVENT_D", 15, 941, 1633},
 };
 
 #define MAX_DTMF_EVENTS 16
 
-enum {
-DTMF_KEY_EVENT_1 = 1,
-DTMF_KEY_EVENT_2 = 2,
-DTMF_KEY_EVENT_3 = 3,
-DTMF_KEY_EVENT_4 = 4,
-DTMF_KEY_EVENT_5 = 5,
-DTMF_KEY_EVENT_6 = 6,
-DTMF_KEY_EVENT_7 = 7,
-DTMF_KEY_EVENT_8 = 8,
-DTMF_KEY_EVENT_9 = 9,
-DTMF_KEY_EVENT_0 = 0,
-DTMF_KEY_EVENT_STAR = 10,
-DTMF_KEY_EVENT_POUND = 11,
-DTMF_KEY_EVENT_A = 12,
-DTMF_KEY_EVENT_B = 13,
-DTMF_KEY_EVENT_C = 14,
-DTMF_KEY_EVENT_D = 15,
+enum
+{
+  DTMF_KEY_EVENT_1 = 1,
+  DTMF_KEY_EVENT_2 = 2,
+  DTMF_KEY_EVENT_3 = 3,
+  DTMF_KEY_EVENT_4 = 4,
+  DTMF_KEY_EVENT_5 = 5,
+  DTMF_KEY_EVENT_6 = 6,
+  DTMF_KEY_EVENT_7 = 7,
+  DTMF_KEY_EVENT_8 = 8,
+  DTMF_KEY_EVENT_9 = 9,
+  DTMF_KEY_EVENT_0 = 0,
+  DTMF_KEY_EVENT_STAR = 10,
+  DTMF_KEY_EVENT_POUND = 11,
+  DTMF_KEY_EVENT_A = 12,
+  DTMF_KEY_EVENT_B = 13,
+  DTMF_KEY_EVENT_C = 14,
+  DTMF_KEY_EVENT_D = 15,
 };
 
 /* elementfactory information */
@@ -141,8 +143,7 @@ GST_STATIC_PAD_TEMPLATE ("src",
         "depth = (int) 16, "
         "endianness = (int) " G_STRINGIFY (G_BYTE_ORDER) ", "
         "signed = (boolean) true, "
-        "rate = (int) [0, MAX], "
-        "channels = (int) 1")
+        "rate = (int) [0, MAX], " "channels = (int) 1")
     );
 
 static GstStaticPadTemplate gst_rtp_dtmf_depay_sink_template =
@@ -180,7 +181,7 @@ gst_rtp_dtmf_depay_base_init (gpointer klass)
 
 
   GST_DEBUG_CATEGORY_INIT (gst_rtp_dtmf_depay_debug,
-          "rtpdtmfdepay", 0, "rtpdtmfdepay element");
+      "rtpdtmfdepay", 0, "rtpdtmfdepay element");
   gst_element_class_set_details (element_class, &gst_rtp_dtmfdepay_details);
 }
 
@@ -203,20 +204,20 @@ gst_rtp_dtmf_depay_class_init (GstRtpDTMFDepayClass * klass)
       GST_DEBUG_FUNCPTR (gst_rtp_dtmf_depay_get_property);
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_UNIT_TIME,
-    g_param_spec_uint ("unit-time", "Duration unittime",
-        "The smallest unit (ms) the duration must be a multiple of (0 disables it)", MIN_UNIT_TIME,
-        MAX_UNIT_TIME, DEFAULT_UNIT_TIME, G_PARAM_READWRITE));
+      g_param_spec_uint ("unit-time", "Duration unittime",
+          "The smallest unit (ms) the duration must be a multiple of (0 disables it)",
+          MIN_UNIT_TIME, MAX_UNIT_TIME, DEFAULT_UNIT_TIME, G_PARAM_READWRITE));
 
   g_object_class_install_property (G_OBJECT_CLASS (klass), PROP_MAX_DURATION,
-    g_param_spec_uint ("max-duration", "Maximum duration",
-        "The maxumimum duration (ms) of the outgoing soundpacket. "
-        "(0 = no limit)", 0, G_MAXUINT, DEFAULT_MAX_DURATION,
-        G_PARAM_READWRITE));
+      g_param_spec_uint ("max-duration", "Maximum duration",
+          "The maxumimum duration (ms) of the outgoing soundpacket. "
+          "(0 = no limit)", 0, G_MAXUINT, DEFAULT_MAX_DURATION,
+          G_PARAM_READWRITE));
 
   gstbasertpdepayload_class->process =
-    GST_DEBUG_FUNCPTR (gst_rtp_dtmf_depay_process);
+      GST_DEBUG_FUNCPTR (gst_rtp_dtmf_depay_process);
   gstbasertpdepayload_class->set_caps =
-    GST_DEBUG_FUNCPTR (gst_rtp_dtmf_depay_setcaps);
+      GST_DEBUG_FUNCPTR (gst_rtp_dtmf_depay_setcaps);
 
 }
 
@@ -231,7 +232,7 @@ static void
 gst_rtp_dtmf_depay_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec)
 {
-  GstRtpDTMFDepay * rtpdtmfdepay;
+  GstRtpDTMFDepay *rtpdtmfdepay;
 
   rtpdtmfdepay = GST_RTP_DTMF_DEPAY (object);
 
@@ -252,7 +253,7 @@ static void
 gst_rtp_dtmf_depay_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec)
 {
-  GstRtpDTMFDepay * rtpdtmfdepay;
+  GstRtpDTMFDepay *rtpdtmfdepay;
 
   rtpdtmfdepay = GST_RTP_DTMF_DEPAY (object);
 
@@ -274,7 +275,7 @@ gst_rtp_dtmf_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
 {
   GstCaps *srccaps;
   GstStructure *structure = gst_caps_get_structure (caps, 0);
-  gint clock_rate = 8000;      /* default */
+  gint clock_rate = 8000;       /* default */
 
   gst_structure_get_int (structure, "clock-rate", &clock_rate);
   filter->clock_rate = clock_rate;
@@ -284,8 +285,7 @@ gst_rtp_dtmf_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
       "depth", G_TYPE_INT, 16,
       "endianness", G_TYPE_INT, G_BYTE_ORDER,
       "signed", G_TYPE_BOOLEAN, TRUE,
-      "channels", G_TYPE_INT, 1,
-      "rate", G_TYPE_INT, clock_rate, NULL);
+      "channels", G_TYPE_INT, 1, "rate", G_TYPE_INT, clock_rate, NULL);
   gst_pad_set_caps (GST_BASE_RTP_DEPAYLOAD_SRCPAD (filter), srccaps);
   gst_caps_unref (srccaps);
 
@@ -293,7 +293,7 @@ gst_rtp_dtmf_depay_setcaps (GstBaseRTPDepayload * filter, GstCaps * caps)
 }
 
 static void
-gst_dtmf_src_generate_tone(GstRtpDTMFDepay *rtpdtmfdepay,
+gst_dtmf_src_generate_tone (GstRtpDTMFDepay * rtpdtmfdepay,
     GstRTPDTMFPayload payload, GstBuffer * buffer)
 {
   gint16 *p;
@@ -302,16 +302,16 @@ gst_dtmf_src_generate_tone(GstRtpDTMFDepay *rtpdtmfdepay,
   double amplitude, f1, f2;
   double volume_factor;
   DTMF_KEY key = DTMF_KEYS[payload.event];
-  guint32 clock_rate = 8000 /* default */;
-  GstBaseRTPDepayload * depayload = GST_BASE_RTP_DEPAYLOAD (rtpdtmfdepay);
+  guint32 clock_rate = 8000 /* default */ ;
+  GstBaseRTPDepayload *depayload = GST_BASE_RTP_DEPAYLOAD (rtpdtmfdepay);
   gint volume;
 
   clock_rate = depayload->clock_rate;
 
   /* Create a buffer for the tone */
-  tone_size = (payload.duration*SAMPLE_SIZE*CHANNELS)/8;
+  tone_size = (payload.duration * SAMPLE_SIZE * CHANNELS) / 8;
   GST_BUFFER_SIZE (buffer) = tone_size;
-  GST_BUFFER_MALLOCDATA (buffer) = g_malloc(tone_size);
+  GST_BUFFER_MALLOCDATA (buffer) = g_malloc (tone_size);
   GST_BUFFER_DATA (buffer) = GST_BUFFER_MALLOCDATA (buffer);
   GST_BUFFER_DURATION (buffer) = payload.duration * GST_SECOND / clock_rate;
   volume = payload.volume;
@@ -324,12 +324,14 @@ gst_dtmf_src_generate_tone(GstRtpDTMFDepay *rtpdtmfdepay,
    * For each sample point we calculate 'x' as the
    * the amplitude value.
    */
-  for (i = 0; i < (tone_size / (SAMPLE_SIZE/8)); i++) {
+  for (i = 0; i < (tone_size / (SAMPLE_SIZE / 8)); i++) {
     /*
      * We add the fundamental frequencies together.
      */
-    f1 = sin(2 * M_PI * key.low_frequency * (rtpdtmfdepay->sample / clock_rate));
-    f2 = sin(2 * M_PI * key.high_frequency * (rtpdtmfdepay->sample / clock_rate));
+    f1 = sin (2 * M_PI * key.low_frequency * (rtpdtmfdepay->sample /
+            clock_rate));
+    f2 = sin (2 * M_PI * key.high_frequency * (rtpdtmfdepay->sample /
+            clock_rate));
 
     amplitude = (f1 + f2) / 2;
 
@@ -369,7 +371,7 @@ gst_rtp_dtmf_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
   payload_len = gst_rtp_buffer_get_payload_len (buf);
   payload = gst_rtp_buffer_get_payload (buf);
 
-  if (payload_len != sizeof(GstRTPDTMFPayload) )
+  if (payload_len != sizeof (GstRTPDTMFPayload))
     goto bad_packet;
 
   memcpy (&dtmf_payload, payload, sizeof (GstRTPDTMFPayload));
@@ -385,12 +387,10 @@ gst_rtp_dtmf_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
   dtmf_payload.duration = g_ntohs (dtmf_payload.duration);
 
   /* clip to whole units of unit_time */
-  if (rtpdtmfdepay->unit_time)
-  {
+  if (rtpdtmfdepay->unit_time) {
     guint unit_time_clock =
         (rtpdtmfdepay->unit_time * depayload->clock_rate) / 1000;
-    if (dtmf_payload.duration % unit_time_clock)
-    {
+    if (dtmf_payload.duration % unit_time_clock) {
       /* Make sure we don't overflow the duration */
       if (dtmf_payload.duration < G_MAXUINT16 - unit_time_clock)
         dtmf_payload.duration += unit_time_clock -
@@ -401,8 +401,7 @@ gst_rtp_dtmf_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
   }
 
   /* clip to max duration */
-  if (rtpdtmfdepay->max_duration)
-  {
+  if (rtpdtmfdepay->max_duration) {
     guint max_duration_clock =
         (rtpdtmfdepay->max_duration * depayload->clock_rate) / 1000;
 
@@ -415,7 +414,8 @@ gst_rtp_dtmf_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
       "marker=%d - timestamp=%u - event=%d - duration=%d",
       marker, timestamp, dtmf_payload.event, dtmf_payload.duration);
 
-  GST_DEBUG_OBJECT (depayload, "Previous information : timestamp=%u - duration=%d",
+  GST_DEBUG_OBJECT (depayload,
+      "Previous information : timestamp=%u - duration=%d",
       rtpdtmfdepay->previous_ts, rtpdtmfdepay->previous_duration);
 
   /* First packet */
@@ -428,14 +428,14 @@ gst_rtp_dtmf_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
     structure = gst_structure_new ("dtmf-event",
         "number", G_TYPE_INT, dtmf_payload.event,
         "volume", G_TYPE_INT, dtmf_payload.volume,
-        "type", G_TYPE_INT, 1,
-        "method", G_TYPE_INT, 1,
-        NULL);
+        "type", G_TYPE_INT, 1, "method", G_TYPE_INT, 1, NULL);
     if (structure) {
-      dtmf_message = gst_message_new_element (GST_OBJECT (depayload), structure);
+      dtmf_message =
+          gst_message_new_element (GST_OBJECT (depayload), structure);
       if (dtmf_message) {
         if (!gst_element_post_message (GST_ELEMENT (depayload), dtmf_message)) {
-          GST_ERROR_OBJECT (depayload, "Unable to send dtmf-event message to bus");
+          GST_ERROR_OBJECT (depayload,
+              "Unable to send dtmf-event message to bus");
         }
       } else {
         GST_ERROR_OBJECT (depayload, "Unable to create dtmf-event message");
@@ -460,7 +460,7 @@ gst_rtp_dtmf_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
   /* If late or duplicate packet (like the redundant end packet). Ignore */
   if (dtmf_payload.duration > 0) {
     outbuf = gst_buffer_new ();
-    gst_dtmf_src_generate_tone(rtpdtmfdepay, dtmf_payload, outbuf);
+    gst_dtmf_src_generate_tone (rtpdtmfdepay, dtmf_payload, outbuf);
 
 
     GST_BUFFER_TIMESTAMP (outbuf) = rtpdtmfdepay->first_gst_ts +
@@ -468,9 +468,9 @@ gst_rtp_dtmf_depay_process (GstBaseRTPDepayload * depayload, GstBuffer * buf)
         GST_SECOND / depayload->clock_rate;
     GST_BUFFER_OFFSET (outbuf) =
         (rtpdtmfdepay->previous_duration - dtmf_payload.duration) *
-          GST_SECOND / depayload->clock_rate;
+        GST_SECOND / depayload->clock_rate;
     GST_BUFFER_OFFSET_END (outbuf) = rtpdtmfdepay->previous_duration *
-          GST_SECOND / depayload->clock_rate;
+        GST_SECOND / depayload->clock_rate;
 
     GST_DEBUG_OBJECT (depayload, "timestamp : %llu - time %" GST_TIME_FORMAT,
         GST_BUFFER_TIMESTAMP (buf), GST_TIME_ARGS (GST_BUFFER_TIMESTAMP (buf)));
@@ -492,4 +492,3 @@ gst_rtp_dtmf_depay_plugin_init (GstPlugin * plugin)
   return gst_element_register (plugin, "rtpdtmfdepay",
       GST_RANK_MARGINAL, GST_TYPE_RTP_DTMF_DEPAY);
 }
-
index 4fb31a0..1fb8ff7 100644 (file)
@@ -30,7 +30,6 @@
 #include "gstrtpdtmfcommon.h"
 
 G_BEGIN_DECLS
-
 #define GST_TYPE_RTP_DTMF_DEPAY \
   (gst_rtp_dtmf_depay_get_type())
 #define GST_RTP_DTMF_DEPAY(obj) \
@@ -41,18 +40,16 @@ G_BEGIN_DECLS
   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_DTMF_DEPAY))
 #define GST_IS_RTP_DTMF_DEPAY_CLASS(klass) \
   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_DTMF_DEPAY))
-
-
 typedef struct _GstRtpDTMFDepay GstRtpDTMFDepay;
 typedef struct _GstRtpDTMFDepayClass GstRtpDTMFDepayClass;
 
 struct _GstRtpDTMFDepay
 {
-  GstBaseRTPDepayload  depayload;
-  double               sample;
-  guint32              previous_ts;
-  guint16              previous_duration;
-  GstClockTime         first_gst_ts;
+  GstBaseRTPDepayload depayload;
+  double sample;
+  guint32 previous_ts;
+  guint16 previous_duration;
+  GstClockTime first_gst_ts;
   guint unit_time;
   guint max_duration;
 };
@@ -65,5 +62,4 @@ struct _GstRtpDTMFDepayClass
 gboolean gst_rtp_dtmf_depay_plugin_init (GstPlugin * plugin);
 
 G_END_DECLS
-
 #endif /* __GST_RTP_DTMF_DEPAY_H__ */
index 588cda4..e1d252b 100644 (file)
 #include "gstrtpdtmfsrc.h"
 
 #define GST_RTP_DTMF_TYPE_EVENT  1
-#define DEFAULT_PACKET_INTERVAL  50 /* ms */
-#define MIN_PACKET_INTERVAL      10 /* ms */
-#define MAX_PACKET_INTERVAL      50 /* ms */
+#define DEFAULT_PACKET_INTERVAL  50     /* ms */
+#define MIN_PACKET_INTERVAL      10     /* ms */
+#define MAX_PACKET_INTERVAL      50     /* ms */
 #define DEFAULT_SSRC             -1
 #define DEFAULT_PT               96
 #define DEFAULT_TIMESTAMP_OFFSET -1
 #define MIN_VOLUME               0
 #define MAX_VOLUME               36
 
-#define MIN_INTER_DIGIT_INTERVAL 50 /* ms */
-#define MIN_PULSE_DURATION       70 /* ms */
+#define MIN_INTER_DIGIT_INTERVAL 50     /* ms */
+#define MIN_PULSE_DURATION       70     /* ms */
 
 #define DEFAULT_PACKET_REDUNDANCY 1
 #define MIN_PACKET_REDUNDANCY 1
@@ -198,7 +198,6 @@ GST_STATIC_PAD_TEMPLATE ("src",
         "ssrc = (int) [ 0, MAX ], "
         "encoding-name = (string) \"TELEPHONE-EVENT\"")
     /*  "events = (string) \"0-15\" */
-
     );
 
 
@@ -215,16 +214,16 @@ static void gst_rtp_dtmf_src_set_property (GObject * object, guint prop_id,
     const GValue * value, GParamSpec * pspec);
 static void gst_rtp_dtmf_src_get_property (GObject * object, guint prop_id,
     GValue * value, GParamSpec * pspec);
-static gboolean gst_rtp_dtmf_src_handle_event (GstBaseSrc *basesrc,
+static gboolean gst_rtp_dtmf_src_handle_event (GstBaseSrc * basesrc,
     GstEvent * event);
 static GstStateChangeReturn gst_rtp_dtmf_src_change_state (GstElement * element,
     GstStateChange transition);
-static void gst_rtp_dtmf_src_add_start_event (GstRTPDTMFSrc *dtmfsrc,
+static void gst_rtp_dtmf_src_add_start_event (GstRTPDTMFSrc * dtmfsrc,
     gint event_number, gint event_volume);
-static void gst_rtp_dtmf_src_add_stop_event (GstRTPDTMFSrc *dtmfsrc);
+static void gst_rtp_dtmf_src_add_stop_event (GstRTPDTMFSrc * dtmfsrc);
 
-static gboolean gst_rtp_dtmf_src_unlock (GstBaseSrc *src);
-static gboolean gst_rtp_dtmf_src_unlock_stop (GstBaseSrc *src);
+static gboolean gst_rtp_dtmf_src_unlock (GstBaseSrc * src);
+static gboolean gst_rtp_dtmf_src_unlock_stop (GstBaseSrc * src);
 static GstFlowReturn gst_rtp_dtmf_src_create (GstBaseSrc * basesrc,
     guint64 offset, guint length, GstBuffer ** buffer);
 static gboolean gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc);
@@ -236,7 +235,7 @@ gst_rtp_dtmf_src_base_init (gpointer g_class)
   GstElementClass *element_class = GST_ELEMENT_CLASS (g_class);
 
   GST_DEBUG_CATEGORY_INIT (gst_rtp_dtmf_src_debug,
-          "rtpdtmfsrc", 0, "rtpdtmfsrc element");
+      "rtpdtmfsrc", 0, "rtpdtmfsrc element");
 
   gst_element_class_add_pad_template (element_class,
       gst_static_pad_template_get (&gst_rtp_dtmf_src_template));
@@ -305,17 +304,13 @@ gst_rtp_dtmf_src_class_init (GstRTPDTMFSrcClass * klass)
   gstelement_class->change_state =
       GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_change_state);
 
-  gstbasesrc_class->unlock =
-      GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_unlock);
+  gstbasesrc_class->unlock = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_unlock);
   gstbasesrc_class->unlock_stop =
       GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_unlock_stop);
 
-  gstbasesrc_class->event =
-      GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_handle_event);
-  gstbasesrc_class->create =
-      GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_create);
-  gstbasesrc_class->negotiate =
-      GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_negotiate);
+  gstbasesrc_class->event = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_handle_event);
+  gstbasesrc_class->create = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_create);
+  gstbasesrc_class->negotiate = GST_DEBUG_FUNCPTR (gst_rtp_dtmf_src_negotiate);
 }
 
 static void
@@ -355,16 +350,16 @@ gst_rtp_dtmf_src_finalize (GObject * object)
 }
 
 static gboolean
-gst_rtp_dtmf_src_handle_dtmf_event (GstRTPDTMFSrc *dtmfsrc,
-        const GstStructure * event_structure)
+gst_rtp_dtmf_src_handle_dtmf_event (GstRTPDTMFSrc * dtmfsrc,
+    const GstStructure * event_structure)
 {
   gint event_type;
   gboolean start;
   gint method;
 
   if (!gst_structure_get_int (event_structure, "type", &event_type) ||
-          !gst_structure_get_boolean (event_structure, "start", &start) ||
-          event_type != GST_RTP_DTMF_TYPE_EVENT)
+      !gst_structure_get_boolean (event_structure, "start", &start) ||
+      event_type != GST_RTP_DTMF_TYPE_EVENT)
     goto failure;
 
   if (gst_structure_get_int (event_structure, "method", &method)) {
@@ -378,11 +373,11 @@ gst_rtp_dtmf_src_handle_dtmf_event (GstRTPDTMFSrc *dtmfsrc,
     gint event_volume;
 
     if (!gst_structure_get_int (event_structure, "number", &event_number) ||
-            !gst_structure_get_int (event_structure, "volume", &event_volume))
+        !gst_structure_get_int (event_structure, "volume", &event_volume))
       goto failure;
 
     GST_DEBUG_OBJECT (dtmfsrc, "Received start event %d with volume %d",
-            event_number, event_volume);
+        event_number, event_volume);
     gst_rtp_dtmf_src_add_start_event (dtmfsrc, event_number, event_volume);
   }
 
@@ -397,7 +392,7 @@ failure:
 }
 
 static gboolean
-gst_rtp_dtmf_src_handle_custom_upstream (GstRTPDTMFSrc *dtmfsrc,
+gst_rtp_dtmf_src_handle_custom_upstream (GstRTPDTMFSrc * dtmfsrc,
     GstEvent * event)
 {
   gboolean result = FALSE;
@@ -426,7 +421,7 @@ ret:
 }
 
 static gboolean
-gst_rtp_dtmf_src_handle_event (GstBaseSrc *basesrc, GstEvent * event)
+gst_rtp_dtmf_src_handle_event (GstBaseSrc * basesrc, GstEvent * event)
 {
   GstRTPDTMFSrc *dtmfsrc;
   gboolean result = FALSE;
@@ -522,23 +517,23 @@ gst_rtp_dtmf_src_get_property (GObject * object, guint prop_id, GValue * value,
 }
 
 static void
-gst_rtp_dtmf_src_set_stream_lock (GstRTPDTMFSrc *dtmfsrc, gboolean lock)
+gst_rtp_dtmf_src_set_stream_lock (GstRTPDTMFSrc * dtmfsrc, gboolean lock)
 {
-   GstEvent *event;
-   GstStructure *structure;
+  GstEvent *event;
+  GstStructure *structure;
 
-   structure = gst_structure_new ("stream-lock",
-                      "lock", G_TYPE_BOOLEAN, lock, NULL);
+  structure = gst_structure_new ("stream-lock",
+      "lock", G_TYPE_BOOLEAN, lock, NULL);
 
-   event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, structure);
-   if (!gst_pad_push_event (GST_BASE_SRC_PAD (dtmfsrc), event)) {
-     GST_WARNING_OBJECT (dtmfsrc, "stream-lock event not handled");
-   }
+  event = gst_event_new_custom (GST_EVENT_CUSTOM_DOWNSTREAM_OOB, structure);
+  if (!gst_pad_push_event (GST_BASE_SRC_PAD (dtmfsrc), event)) {
+    GST_WARNING_OBJECT (dtmfsrc, "stream-lock event not handled");
+  }
 
 }
 
 static void
-gst_rtp_dtmf_prepare_timestamps (GstRTPDTMFSrc *dtmfsrc)
+gst_rtp_dtmf_prepare_timestamps (GstRTPDTMFSrc * dtmfsrc)
 {
   GstClock *clock;
   GstClockTime base_time;
@@ -563,19 +558,18 @@ gst_rtp_dtmf_prepare_timestamps (GstRTPDTMFSrc *dtmfsrc)
   }
 
   dtmfsrc->rtp_timestamp = dtmfsrc->ts_base +
-      gst_util_uint64_scale_int (
-          gst_segment_to_running_time (&GST_BASE_SRC (dtmfsrc)->segment,
-              GST_FORMAT_TIME, dtmfsrc->timestamp),
-          dtmfsrc->clock_rate, GST_SECOND);
+      gst_util_uint64_scale_int (gst_segment_to_running_time (&GST_BASE_SRC
+          (dtmfsrc)->segment, GST_FORMAT_TIME, dtmfsrc->timestamp),
+      dtmfsrc->clock_rate, GST_SECOND);
 }
 
 
 static void
-gst_rtp_dtmf_src_add_start_event (GstRTPDTMFSrc *dtmfsrc, gint event_number,
+gst_rtp_dtmf_src_add_start_event (GstRTPDTMFSrc * dtmfsrc, gint event_number,
     gint event_volume)
 {
 
-  GstRTPDTMFSrcEvent * event = g_malloc (sizeof(GstRTPDTMFSrcEvent));
+  GstRTPDTMFSrcEvent *event = g_malloc (sizeof (GstRTPDTMFSrcEvent));
   event->event_type = RTP_DTMF_EVENT_TYPE_START;
 
   event->payload = g_new0 (GstRTPDTMFPayload, 1);
@@ -587,10 +581,10 @@ gst_rtp_dtmf_src_add_start_event (GstRTPDTMFSrc *dtmfsrc, gint event_number,
 }
 
 static void
-gst_rtp_dtmf_src_add_stop_event (GstRTPDTMFSrc *dtmfsrc)
+gst_rtp_dtmf_src_add_stop_event (GstRTPDTMFSrc * dtmfsrc)
 {
 
-  GstRTPDTMFSrcEvent * event = g_malloc (sizeof(GstRTPDTMFSrcEvent));
+  GstRTPDTMFSrcEvent *event = g_malloc (sizeof (GstRTPDTMFSrcEvent));
   event->event_type = RTP_DTMF_EVENT_TYPE_STOP;
 
   g_async_queue_push (dtmfsrc->event_queue, event);
@@ -598,7 +592,7 @@ gst_rtp_dtmf_src_add_stop_event (GstRTPDTMFSrc *dtmfsrc)
 
 
 static void
-gst_rtp_dtmf_prepare_rtp_headers (GstRTPDTMFSrc *dtmfsrc, GstBuffer *buf)
+gst_rtp_dtmf_prepare_rtp_headers (GstRTPDTMFSrc * dtmfsrc, GstBuffer * buf)
 {
   gst_rtp_buffer_set_ssrc (buf, dtmfsrc->current_ssrc);
   gst_rtp_buffer_set_payload_type (buf, dtmfsrc->pt);
@@ -617,7 +611,7 @@ gst_rtp_dtmf_prepare_rtp_headers (GstRTPDTMFSrc *dtmfsrc, GstBuffer *buf)
 }
 
 static void
-gst_rtp_dtmf_prepare_buffer_data (GstRTPDTMFSrc *dtmfsrc, GstBuffer *buf)
+gst_rtp_dtmf_prepare_buffer_data (GstRTPDTMFSrc * dtmfsrc, GstBuffer * buf)
 {
   GstRTPDTMFPayload *payload;
 
@@ -641,7 +635,7 @@ gst_rtp_dtmf_prepare_buffer_data (GstRTPDTMFSrc *dtmfsrc, GstBuffer *buf)
    * if its the end of the event
    */
   if (payload->e &&
-      payload->duration < MIN_PULSE_DURATION * dtmfsrc->clock_rate / 1000 )
+      payload->duration < MIN_PULSE_DURATION * dtmfsrc->clock_rate / 1000)
     payload->duration = MIN_PULSE_DURATION * dtmfsrc->clock_rate / 1000;
 
   payload->duration = g_htons (payload->duration);
@@ -656,7 +650,7 @@ gst_rtp_dtmf_prepare_buffer_data (GstRTPDTMFSrc *dtmfsrc, GstBuffer *buf)
 }
 
 static GstBuffer *
-gst_rtp_dtmf_src_create_next_rtp_packet (GstRTPDTMFSrc *dtmfsrc)
+gst_rtp_dtmf_src_create_next_rtp_packet (GstRTPDTMFSrc * dtmfsrc)
 {
   GstBuffer *buf = NULL;
 
@@ -676,7 +670,7 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
     guint length, GstBuffer ** buffer)
 {
   GstRTPDTMFSrcEvent *event;
-  GstRTPDTMFSrc * dtmfsrc;
+  GstRTPDTMFSrc *dtmfsrc;
   GstClock *clock;
   GstClockID *clockid;
   GstClockReturn clockret;
@@ -726,7 +720,7 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
 
       g_free (event);
     } else if (!dtmfsrc->first_packet && !dtmfsrc->last_packet &&
-        (dtmfsrc->timestamp - dtmfsrc->start_timestamp)/GST_MSECOND >=
+        (dtmfsrc->timestamp - dtmfsrc->start_timestamp) / GST_MSECOND >=
         MIN_PULSE_DURATION) {
       GST_DEBUG_OBJECT (dtmfsrc, "try popping");
       event = g_async_queue_try_pop (dtmfsrc->event_queue);
@@ -790,7 +784,7 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
     GST_OBJECT_LOCK (dtmfsrc);
     if (dtmfsrc->paused)
       clockret = GST_CLOCK_UNSCHEDULED;
-  } else  {
+  } else {
     clockret = GST_CLOCK_UNSCHEDULED;
   }
   gst_clock_id_unref (clockid);
@@ -801,7 +795,7 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
     goto paused;
   }
 
- send_last:
+send_last:
 
   if (dtmfsrc->dirty)
     if (!gst_rtp_dtmf_src_negotiate (basesrc))
@@ -830,11 +824,11 @@ gst_rtp_dtmf_src_create (GstBaseSrc * basesrc, guint64 offset,
 
   return GST_FLOW_OK;
 
- paused_locked:
+paused_locked:
 
   GST_OBJECT_UNLOCK (dtmfsrc);
 
- paused:
+paused:
 
   if (dtmfsrc->payload) {
     dtmfsrc->first_packet = FALSE;
@@ -910,8 +904,7 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc)
     } else {
       if (gst_structure_has_field (s, "payload")) {
         /* can only fixate if there is a field */
-        gst_structure_fixate_field_nearest_int (s, "payload",
-            dtmfsrc->pt);
+        gst_structure_fixate_field_nearest_int (s, "payload", dtmfsrc->pt);
         gst_structure_get_int (s, "payload", &pt);
         GST_LOG_OBJECT (dtmfsrc, "using peer pt %d", pt);
       } else {
@@ -922,8 +915,7 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc)
       }
     }
 
-    if (gst_structure_get_int (s, "clock-rate", &clock_rate))
-    {
+    if (gst_structure_get_int (s, "clock-rate", &clock_rate)) {
       dtmfsrc->clock_rate = clock_rate;
       GST_LOG_OBJECT (dtmfsrc, "using clock-rate from caps %d",
           dtmfsrc->clock_rate);
@@ -931,8 +923,7 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc)
       GST_LOG_OBJECT (dtmfsrc, "using existing clock-rate %d",
           dtmfsrc->clock_rate);
     }
-    gst_structure_set (s, "clock-rate", G_TYPE_INT, dtmfsrc->clock_rate,
-        NULL);
+    gst_structure_set (s, "clock-rate", G_TYPE_INT, dtmfsrc->clock_rate, NULL);
 
 
     if (gst_structure_has_field_typed (s, "ssrc", G_TYPE_UINT)) {
@@ -982,7 +973,7 @@ gst_rtp_dtmf_src_negotiate (GstBaseSrc * basesrc)
 
 
 static void
-gst_rtp_dtmf_src_ready_to_paused (GstRTPDTMFSrc *dtmfsrc)
+gst_rtp_dtmf_src_ready_to_paused (GstRTPDTMFSrc * dtmfsrc)
 {
   if (dtmfsrc->ssrc == -1)
     dtmfsrc->current_ssrc = g_random_int ();
@@ -1008,7 +999,7 @@ gst_rtp_dtmf_src_change_state (GstElement * element, GstStateChange transition)
   GstRTPDTMFSrc *dtmfsrc;
   GstStateChangeReturn result;
   gboolean no_preroll = FALSE;
-  GstRTPDTMFSrcEvent *event= NULL;
+  GstRTPDTMFSrcEvent *event = NULL;
 
   dtmfsrc = GST_RTP_DTMF_SRC (element);
 
@@ -1037,7 +1028,7 @@ gst_rtp_dtmf_src_change_state (GstElement * element, GstStateChange transition)
       break;
     case GST_STATE_CHANGE_PAUSED_TO_READY:
 
-     /* Flushing the event queue */
+      /* Flushing the event queue */
       while ((event = g_async_queue_try_pop (dtmfsrc->event_queue)) != NULL)
         g_free (event);
 
@@ -1063,7 +1054,8 @@ failure:
 
 
 static gboolean
-gst_rtp_dtmf_src_unlock (GstBaseSrc *src) {
+gst_rtp_dtmf_src_unlock (GstBaseSrc * src)
+{
   GstRTPDTMFSrc *dtmfsrc = GST_RTP_DTMF_SRC (src);
   GstRTPDTMFSrcEvent *event = NULL;
 
@@ -1077,7 +1069,7 @@ gst_rtp_dtmf_src_unlock (GstBaseSrc *src) {
   GST_OBJECT_UNLOCK (dtmfsrc);
 
   GST_DEBUG_OBJECT (dtmfsrc, "Pushing the PAUSE_TASK event on unlock request");
-  event = g_malloc (sizeof(GstRTPDTMFSrcEvent));
+  event = g_malloc (sizeof (GstRTPDTMFSrcEvent));
   event->event_type = RTP_DTMF_EVENT_TYPE_PAUSE_TASK;
   g_async_queue_push (dtmfsrc->event_queue, event);
 
@@ -1086,7 +1078,8 @@ gst_rtp_dtmf_src_unlock (GstBaseSrc *src) {
 
 
 static gboolean
-gst_rtp_dtmf_src_unlock_stop (GstBaseSrc *src) {
+gst_rtp_dtmf_src_unlock_stop (GstBaseSrc * src)
+{
   GstRTPDTMFSrc *dtmfsrc = GST_RTP_DTMF_SRC (src);
 
   GST_DEBUG_OBJECT (dtmfsrc, "Unlock stopped");
index ade3a67..1b40160 100644 (file)
@@ -32,7 +32,6 @@
 #include "gstrtpdtmfcommon.h"
 
 G_BEGIN_DECLS
-
 #define GST_TYPE_RTP_DTMF_SRC          (gst_rtp_dtmf_src_get_type())
 #define GST_RTP_DTMF_SRC(obj)          (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_DTMF_SRC,GstRTPDTMFSrc))
 #define GST_RTP_DTMF_SRC_CLASS(klass)  (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_DTMF_SRC,GstRTPDTMFSrcClass))
@@ -40,14 +39,13 @@ G_BEGIN_DECLS
 #define GST_IS_RTP_DTMF_SRC(obj)               (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_DTMF_SRC))
 #define GST_IS_RTP_DTMF_SRC_CLASS(klass)       (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_DTMF_SRC))
 #define GST_RTP_DTMF_SRC_CAST(obj)             ((GstRTPDTMFSrc *)(obj))
-
-
 typedef struct _GstRTPDTMFSrc GstRTPDTMFSrc;
 typedef struct _GstRTPDTMFSrcClass GstRTPDTMFSrcClass;
 
 
 
-enum _GstRTPDTMFEventType {
+enum _GstRTPDTMFEventType
+{
   RTP_DTMF_EVENT_TYPE_START,
   RTP_DTMF_EVENT_TYPE_STOP,
   RTP_DTMF_EVENT_TYPE_PAUSE_TASK
@@ -55,9 +53,10 @@ enum _GstRTPDTMFEventType {
 
 typedef enum _GstRTPDTMFEventType GstRTPDTMFEventType;
 
-struct _GstRTPDTMFSrcEvent {
-  GstRTPDTMFEventType  event_type;
-  GstRTPDTMFPayload*   payload;
+struct _GstRTPDTMFSrcEvent
+{
+  GstRTPDTMFEventType event_type;
+  GstRTPDTMFPayload *payload;
 };
 
 typedef struct _GstRTPDTMFSrcEvent GstRTPDTMFSrcEvent;
@@ -68,36 +67,38 @@ typedef struct _GstRTPDTMFSrcEvent GstRTPDTMFSrcEvent;
  *
  * The opaque #GstRTPDTMFSrc data structure.
  */
-struct _GstRTPDTMFSrc {
-  GstBaseSrc           basesrc;
-
-  GAsyncQueue*        event_queue;
-  GstClockID           clockid;
-  gboolean             paused;
-  GstRTPDTMFPayload*   payload;
-
-  GstClockTime      timestamp;
-  GstClockTime      start_timestamp;
-  gboolean          first_packet;
-  gboolean          last_packet;
-  guint32           ts_base;
-  guint16           seqnum_base;
-  gint16            seqnum_offset;
-  guint16           seqnum;
-  gint32            ts_offset;
-  guint32           rtp_timestamp;
-  guint             pt;
-  guint             ssrc;
-  guint             current_ssrc;
-  guint16          interval;
-  guint16          packet_redundancy;
-  guint32           clock_rate;
-
-  gboolean          dirty;
-  guint16           redundancy_count;
+struct _GstRTPDTMFSrc
+{
+  GstBaseSrc basesrc;
+
+  GAsyncQueue *event_queue;
+  GstClockID clockid;
+  gboolean paused;
+  GstRTPDTMFPayload *payload;
+
+  GstClockTime timestamp;
+  GstClockTime start_timestamp;
+  gboolean first_packet;
+  gboolean last_packet;
+  guint32 ts_base;
+  guint16 seqnum_base;
+  gint16 seqnum_offset;
+  guint16 seqnum;
+  gint32 ts_offset;
+  guint32 rtp_timestamp;
+  guint pt;
+  guint ssrc;
+  guint current_ssrc;
+  guint16 interval;
+  guint16 packet_redundancy;
+  guint32 clock_rate;
+
+  gboolean dirty;
+  guint16 redundancy_count;
 };
 
-struct _GstRTPDTMFSrcClass {
+struct _GstRTPDTMFSrcClass
+{
   GstBaseSrcClass parent_class;
 };
 
@@ -107,5 +108,4 @@ gboolean gst_rtp_dtmf_src_plugin_init (GstPlugin * plugin);
 
 
 G_END_DECLS
-
 #endif /* __GST_RTP_DTMF_SRC_H__ */