1 /* GStreamer RTP DTMF source
5 * Copyright (C) <2007> Nokia Corporation.
6 * Contact: Zeeshan Ali <zeeshan.ali@nokia.com>
7 * Copyright (C) <2005> Wim Taymans <wim@fluendo.com>
9 * This library is free software; you can redistribute it and/or
10 * modify it under the terms of the GNU Library General Public
11 * License as published by the Free Software Foundation; either
12 * version 2 of the License, or (at your option) any later version.
14 * This library is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
17 * Library General Public License for more details.
19 * You should have received a copy of the GNU Library General Public
20 * License along with this library; if not, write to the
21 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
22 * Boston, MA 02111-1307, USA.
25 #ifndef __GST_RTP_DTMF_SRC_H__
26 #define __GST_RTP_DTMF_SRC_H__
29 #include <gst/base/gstbasesrc.h>
30 #include <gst/rtp/gstrtpbuffer.h>
34 #define GST_TYPE_RTP_DTMF_SRC (gst_rtp_dtmf_src_get_type())
35 #define GST_RTP_DTMF_SRC(obj) (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_DTMF_SRC,GstRTPDTMFSrc))
36 #define GST_RTP_DTMF_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_DTMF_SRC,GstRTPDTMFSrcClass))
37 #define GST_RTP_DTMF_SRC_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_DTMF_SRC, GstRTPDTMFSrcClass))
38 #define GST_IS_RTP_DTMF_SRC(obj) (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_DTMF_SRC))
39 #define GST_IS_RTP_DTMF_SRC_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_DTMF_SRC))
40 #define GST_RTP_DTMF_SRC_CAST(obj) ((GstRTPDTMFSrc *)(obj))
43 unsigned event:8; /* Current DTMF event */
44 #if G_BYTE_ORDER == G_LITTLE_ENDIAN
45 unsigned volume:6; /* power level of the tone, in dBm0 */
46 unsigned r:1; /* Reserved-bit */
47 unsigned e:1; /* End-bit */
48 #elif G_BYTE_ORDER == G_BIG_ENDIAN
49 unsigned e:1; /* End-bit */
50 unsigned r:1; /* Reserved-bit */
51 unsigned volume:6; /* power level of the tone, in dBm0 */
53 #error "G_BYTE_ORDER should be big or little endian."
55 unsigned duration:16; /* Duration of digit, in timestamp units */
58 typedef struct _GstRTPDTMFSrc GstRTPDTMFSrc;
59 typedef struct _GstRTPDTMFSrcClass GstRTPDTMFSrcClass;
63 enum _GstRTPDTMFEventType {
64 RTP_DTMF_EVENT_TYPE_START,
65 RTP_DTMF_EVENT_TYPE_STOP,
66 RTP_DTMF_EVENT_TYPE_PAUSE_TASK
69 typedef enum _GstRTPDTMFEventType GstRTPDTMFEventType;
71 struct _GstRTPDTMFSrcEvent {
72 GstRTPDTMFEventType event_type;
73 GstRTPDTMFPayload* payload;
76 typedef struct _GstRTPDTMFSrcEvent GstRTPDTMFSrcEvent;
80 * @element: the parent element.
82 * The opaque #GstRTPDTMFSrc data structure.
84 struct _GstRTPDTMFSrc {
87 GAsyncQueue* event_queue;
90 GstRTPDTMFPayload* payload;
92 GstClockTime timestamp;
93 GstClockTime start_timestamp;
94 gboolean first_packet;
101 guint32 rtp_timestamp;
106 guint16 packet_redundancy;
110 guint16 redundancy_count;
113 struct _GstRTPDTMFSrcClass {
114 GstBaseSrcClass parent_class;
117 GType gst_rtp_dtmf_src_get_type (void);
119 gboolean gst_rtp_dtmf_src_plugin_init (GstPlugin * plugin);
124 #endif /* __GST_RTP_DTMF_SRC_H__ */