Re-indent to Gst style

This commit is contained in:
Olivier Crête 2009-02-20 17:37:43 -05:00 committed by Edward Hervey
parent edca624b55
commit 8d6d58e94e
8 changed files with 324 additions and 350 deletions

View 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", "");

View file

@ -157,7 +157,8 @@
#define MIN_DUTY_CYCLE (MIN_INTER_DIGIT_INTERVAL + MIN_PULSE_DURATION)
typedef struct st_dtmf_key {
typedef struct st_dtmf_key
{
char *event_name;
int event_encoding;
float low_frequency;
@ -185,23 +186,24 @@ static const DTMF_KEY DTMF_KEYS[] = {
#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->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->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,7 +333,7 @@ gst_dtmf_src_finalize (GObject * object)
}
static gboolean
gst_dtmf_src_handle_dtmf_event (GstDTMFSrc *dtmfsrc,
gst_dtmf_src_handle_dtmf_event (GstDTMFSrc * dtmfsrc,
const GstStructure * event_structure)
{
gint event_type;
@ -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,7 +450,7 @@ 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;
@ -475,7 +466,7 @@ gst_dtmf_src_set_stream_lock (GstDTMFSrc *dtmfsrc, gboolean lock)
}
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;
@ -611,7 +602,7 @@ gst_dtmf_src_create_next_tone_packet (GstDTMFSrc *dtmfsrc,
dtmfsrc->sample_rate);
} else {
GST_DEBUG_OBJECT (dtmfsrc, "Generating tone");
gst_dtmf_src_generate_tone(event, DTMF_KEYS[event->event_number],
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;
@ -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);
}

View 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,7 +58,8 @@ enum _GstDTMFEventType {
typedef enum _GstDTMFEventType GstDTMFEventType;
struct _GstDTMFSrcEvent {
struct _GstDTMFSrcEvent
{
GstDTMFEventType event_type;
double sample;
guint16 event_number;
@ -69,10 +69,11 @@ struct _GstDTMFSrcEvent {
typedef struct _GstDTMFSrcEvent GstDTMFSrcEvent;
struct _GstDTMFSrc {
struct _GstDTMFSrc
{
GstBaseSrc parent;
GAsyncQueue* event_queue;
GstDTMFSrcEvent* last_event;
GAsyncQueue *event_queue;
GstDTMFSrcEvent *last_event;
guint16 interval;
GstClockTime timestamp;
@ -84,7 +85,8 @@ struct _GstDTMFSrc {
};
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__ */

View file

@ -3,7 +3,8 @@
#define __GST_RTP_DTMF_COMMON_H__
typedef struct {
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 */

View file

@ -55,7 +55,8 @@
#define DEFAULT_MAX_DURATION 0
typedef struct st_dtmf_key {
typedef struct st_dtmf_key
{
char *event_name;
int event_encoding;
float low_frequency;
@ -83,23 +84,24 @@ static const DTMF_KEY DTMF_KEYS[] = {
#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 =
@ -204,8 +205,8 @@ gst_rtp_dtmf_depay_class_init (GstRtpDTMFDepayClass * klass)
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));
"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",
@ -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);
@ -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 +
@ -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);
}

View 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,8 +40,6 @@ 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;
@ -65,5 +62,4 @@ struct _GstRtpDTMFDepayClass
gboolean gst_rtp_dtmf_depay_plugin_init (GstPlugin * plugin);
G_END_DECLS
#endif /* __GST_RTP_DTMF_DEPAY_H__ */

View file

@ -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);
@ -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,7 +350,7 @@ gst_rtp_dtmf_src_finalize (GObject * object)
}
static gboolean
gst_rtp_dtmf_src_handle_dtmf_event (GstRTPDTMFSrc *dtmfsrc,
gst_rtp_dtmf_src_handle_dtmf_event (GstRTPDTMFSrc * dtmfsrc,
const GstStructure * event_structure)
{
gint event_type;
@ -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,7 +517,7 @@ 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;
@ -538,7 +533,7 @@ gst_rtp_dtmf_src_set_stream_lock (GstRTPDTMFSrc *dtmfsrc, gboolean lock)
}
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),
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);
@ -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);
@ -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");

View 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 {
struct _GstRTPDTMFSrcEvent
{
GstRTPDTMFEventType event_type;
GstRTPDTMFPayload* payload;
GstRTPDTMFPayload *payload;
};
typedef struct _GstRTPDTMFSrcEvent GstRTPDTMFSrcEvent;
@ -68,13 +67,14 @@ typedef struct _GstRTPDTMFSrcEvent GstRTPDTMFSrcEvent;
*
* The opaque #GstRTPDTMFSrc data structure.
*/
struct _GstRTPDTMFSrc {
struct _GstRTPDTMFSrc
{
GstBaseSrc basesrc;
GAsyncQueue* event_queue;
GAsyncQueue *event_queue;
GstClockID clockid;
gboolean paused;
GstRTPDTMFPayload* payload;
GstRTPDTMFPayload *payload;
GstClockTime timestamp;
GstClockTime start_timestamp;
@ -97,7 +97,8 @@ struct _GstRTPDTMFSrc {
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__ */