1 /* GStreamer RTP DTMF source
2  *
3  * gstrtpdtmfsrc.h:
4  *
5  * Copyright (C) <2007> Nokia Corporation.
6  *   Contact: Zeeshan Ali <zeeshan.ali@nokia.com>
7  * Copyright (C) <2005> Wim Taymans <wim@fluendo.com>
8  *
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.
13  *
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.
18  *
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., 51 Franklin St, Fifth Floor,
22  * Boston, MA 02110-1301, USA.
23  */
24 
25 #ifndef __GST_RTP_DTMF_SRC_H__
26 #define __GST_RTP_DTMF_SRC_H__
27 
28 #include <gst/gst.h>
29 #include <gst/base/gstbasesrc.h>
30 #include <gst/rtp/gstrtpbuffer.h>
31 
32 #include "gstdtmfcommon.h"
33 
34 G_BEGIN_DECLS
35 #define GST_TYPE_RTP_DTMF_SRC		(gst_rtp_dtmf_src_get_type())
36 #define GST_RTP_DTMF_SRC(obj)		(G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_RTP_DTMF_SRC,GstRTPDTMFSrc))
37 #define GST_RTP_DTMF_SRC_CLASS(klass)	(G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_RTP_DTMF_SRC,GstRTPDTMFSrcClass))
38 #define GST_RTP_DTMF_SRC_GET_CLASS(obj)     (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTP_DTMF_SRC, GstRTPDTMFSrcClass))
39 #define GST_IS_RTP_DTMF_SRC(obj)		(G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_RTP_DTMF_SRC))
40 #define GST_IS_RTP_DTMF_SRC_CLASS(klass)	(G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_RTP_DTMF_SRC))
41 #define GST_RTP_DTMF_SRC_CAST(obj)		((GstRTPDTMFSrc *)(obj))
42 typedef struct _GstRTPDTMFSrc GstRTPDTMFSrc;
43 typedef struct _GstRTPDTMFSrcClass GstRTPDTMFSrcClass;
44 
45 
46 
47 enum _GstRTPDTMFEventType
48 {
49   RTP_DTMF_EVENT_TYPE_START,
50   RTP_DTMF_EVENT_TYPE_STOP,
51   RTP_DTMF_EVENT_TYPE_PAUSE_TASK
52 };
53 
54 typedef enum _GstRTPDTMFEventType GstRTPDTMFEventType;
55 
56 struct _GstRTPDTMFSrcEvent
57 {
58   GstRTPDTMFEventType event_type;
59   GstRTPDTMFPayload *payload;
60 };
61 
62 typedef struct _GstRTPDTMFSrcEvent GstRTPDTMFSrcEvent;
63 
64 /**
65  * GstRTPDTMFSrc:
66  * @element: the parent element.
67  *
68  * The opaque #GstRTPDTMFSrc data structure.
69  */
70 struct _GstRTPDTMFSrc
71 {
72   /*< private >*/
73   GstBaseSrc basesrc;
74 
75   GAsyncQueue *event_queue;
76   GstClockID clockid;
77   gboolean paused;
78   GstRTPDTMFPayload *payload;
79 
80   GstClockTime timestamp;
81   GstClockTime start_timestamp;
82   gboolean first_packet;
83   gboolean last_packet;
84   guint32 ts_base;
85   guint16 seqnum_base;
86   gint16 seqnum_offset;
87   guint16 seqnum;
88   gint32 ts_offset;
89   guint32 rtp_timestamp;
90   guint pt;
91   guint ssrc;
92   guint current_ssrc;
93   guint16 ptime;
94   guint16 packet_redundancy;
95   guint32 clock_rate;
96   gboolean last_event_was_start;
97 
98   GstClockTime last_stop;
99 
100   gboolean dirty;
101   guint16 redundancy_count;
102 };
103 
104 struct _GstRTPDTMFSrcClass
105 {
106   GstBaseSrcClass parent_class;
107 };
108 
109 GType gst_rtp_dtmf_src_get_type (void);
110 
111 gboolean gst_rtp_dtmf_src_plugin_init (GstPlugin * plugin);
112 
113 
114 G_END_DECLS
115 #endif /* __GST_RTP_DTMF_SRC_H__ */
116