• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /* GStreamer
2  * Copyright (C) <2007> Wim Taymans <wim.taymans@gmail.com>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Library General Public
6  * License as published by the Free Software Foundation; either
7  * version 2 of the License, or (at your option) any later version.
8  *
9  * This library is distributed in the hope that it will be useful,
10  * but WITHOUT ANY WARRANTY; without even the implied warranty of
11  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
12  * Library General Public License for more details.
13  *
14  * You should have received a copy of the GNU Library General Public
15  * License along with this library; if not, write to the
16  * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
17  * Boston, MA 02110-1301, USA.
18  */
19 
20 #ifndef __GST_SDP_DEMUX_H__
21 #define __GST_SDP_DEMUX_H__
22 
23 #include <gst/gst.h>
24 #include <gst/base/gstadapter.h>
25 #include <gio/gio.h>
26 
27 G_BEGIN_DECLS
28 
29 #define GST_TYPE_SDP_DEMUX \
30   (gst_sdp_demux_get_type())
31 #define GST_SDP_DEMUX(obj) \
32   (G_TYPE_CHECK_INSTANCE_CAST((obj),GST_TYPE_SDP_DEMUX,GstSDPDemux))
33 #define GST_SDP_DEMUX_CLASS(klass) \
34   (G_TYPE_CHECK_CLASS_CAST((klass),GST_TYPE_SDP_DEMUX,GstSDPDemuxClass))
35 #define GST_IS_SDP_DEMUX(obj) \
36   (G_TYPE_CHECK_INSTANCE_TYPE((obj),GST_TYPE_SDP_DEMUX))
37 #define GST_IS_SDP_DEMUX_CLASS(klass) \
38   (G_TYPE_CHECK_CLASS_TYPE((klass),GST_TYPE_SDP_DEMUX))
39 #define GST_SDP_DEMUX_CAST(obj) \
40   ((GstSDPDemux *)(obj))
41 
42 typedef struct _GstSDPDemux GstSDPDemux;
43 typedef struct _GstSDPDemuxClass GstSDPDemuxClass;
44 
45 #define GST_SDP_STREAM_GET_LOCK(sdp)   (&GST_SDP_DEMUX_CAST(sdp)->stream_rec_lock)
46 #define GST_SDP_STREAM_LOCK(sdp)       (g_rec_mutex_lock (GST_SDP_STREAM_GET_LOCK(sdp)))
47 #define GST_SDP_STREAM_UNLOCK(sdp)     (g_rec_mutex_unlock (GST_SDP_STREAM_GET_LOCK(sdp)))
48 
49 typedef struct _GstSDPStream GstSDPStream;
50 
51 struct _GstSDPStream {
52   gint          id;
53   guint32       ssrc;
54 
55   GstSDPDemux    *parent; /* parent, no extra ref to parent is taken */
56 
57   /* pad we expose or NULL when it does not have an actual pad */
58   GstPad       *srcpad;
59   GstFlowReturn last_ret;
60   gboolean      added;
61   gboolean      disabled;
62   GstCaps      *caps;
63   gboolean      eos;
64 
65   /* our udp sources */
66   GstElement   *udpsrc[2];
67   GstPad       *channelpad[2];
68   guint         rtp_port;
69   guint         rtcp_port;
70 
71   gchar        *destination;
72   guint         ttl;
73   gboolean      multicast;
74 
75   /* our udp sink back to the server */
76   GstElement   *udpsink;
77   GstPad       *rtcppad;
78 
79   /* state */
80   gint          pt;
81   gboolean      container;
82 };
83 
84 struct _GstSDPDemux {
85   GstBin           parent;
86 
87   GstPad          *sinkpad;
88   GstAdapter      *adapter;
89   GstState         target;
90 
91   /* task for UDP loop */
92   gboolean         ignore_timeout;
93 
94   gint             numstreams;
95   GRecMutex        stream_rec_lock;
96   GList           *streams;
97 
98   /* properties */
99   gboolean          debug;
100   guint64           udp_timeout;
101   guint             latency;
102   gboolean          redirect;
103 
104   /* session management */
105   GstElement      *session;
106   gulong           session_sig_id;
107   gulong           session_ptmap_id;
108   gulong           session_nmp_id;
109 };
110 
111 struct _GstSDPDemuxClass {
112   GstBinClass parent_class;
113 };
114 
115 GType gst_sdp_demux_get_type(void);
116 GST_ELEMENT_REGISTER_DECLARE (sdpdemux);
117 
118 G_END_DECLS
119 
120 #endif /* __GST_SDP_DEMUX_H__ */
121