client: fix compilation
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-stream-transport.h
1 /* GStreamer
2  * Copyright (C) 2008 Wim Taymans <wim.taymans at 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 #include <gst/gst.h>
21 #include <gst/rtsp/gstrtsprange.h>
22 #include <gst/rtsp/gstrtspurl.h>
23
24 #ifndef __GST_RTSP_STREAM_TRANSPORT_H__
25 #define __GST_RTSP_STREAM_TRANSPORT_H__
26
27 G_BEGIN_DECLS
28
29 /* types for the media */
30 #define GST_TYPE_RTSP_STREAM_TRANSPORT              (gst_rtsp_stream_transport_get_type ())
31 #define GST_IS_RTSP_STREAM_TRANSPORT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_STREAM_TRANSPORT))
32 #define GST_IS_RTSP_STREAM_TRANSPORT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_STREAM_TRANSPORT))
33 #define GST_RTSP_STREAM_TRANSPORT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_STREAM_TRANSPORT, GstRTSPStreamTransportClass))
34 #define GST_RTSP_STREAM_TRANSPORT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_STREAM_TRANSPORT, GstRTSPStreamTransport))
35 #define GST_RTSP_STREAM_TRANSPORT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_STREAM_TRANSPORT, GstRTSPStreamTransportClass))
36 #define GST_RTSP_STREAM_TRANSPORT_CAST(obj)         ((GstRTSPStreamTransport*)(obj))
37 #define GST_RTSP_STREAM_TRANSPORT_CLASS_CAST(klass) ((GstRTSPStreamTransportClass*)(klass))
38
39 typedef struct _GstRTSPStreamTransport GstRTSPStreamTransport;
40 typedef struct _GstRTSPStreamTransportClass GstRTSPStreamTransportClass;
41
42 #include "rtsp-stream.h"
43 #include "rtsp-address-pool.h"
44
45 typedef gboolean (*GstRTSPSendFunc)      (GstBuffer *buffer, guint8 channel, gpointer user_data);
46 typedef void     (*GstRTSPKeepAliveFunc) (gpointer user_data);
47
48 /**
49  * GstRTSPStreamTransport:
50  * @parent: parent instance
51  * @stream: the GstRTSPStream we manage
52  * @send_rtp: callback for sending RTP messages
53  * @send_rtcp: callback for sending RTCP messages
54  * @user_data: user data passed in the callbacks
55  * @notify: free function for the user_data.
56  * @keep_alive: keep alive callback
57  * @ka_user_data: data passed to @keep_alive
58  * @ka_notify: called when @ka_user_data is freed
59  * @active: if we are actively sending
60  * @timeout: if we timed out
61  * @transport: a transport description
62  * @addr: an optional address
63  * @rtpsource: the receiver rtp source object
64  *
65  * A Transport description for stream @idx
66  */
67 struct _GstRTSPStreamTransport {
68   GObject              parent;
69
70   GstRTSPStream       *stream;
71
72   GstRTSPSendFunc      send_rtp;
73   GstRTSPSendFunc      send_rtcp;
74   gpointer             user_data;
75   GDestroyNotify       notify;
76
77   GstRTSPKeepAliveFunc keep_alive;
78   gpointer             ka_user_data;
79   GDestroyNotify       ka_notify;
80   gboolean             active;
81   gboolean             timeout;
82
83   GstRTSPTransport    *transport;
84
85   GObject             *rtpsource;
86 };
87
88 struct _GstRTSPStreamTransportClass {
89   GObjectClass parent_class;
90 };
91
92 GType                    gst_rtsp_stream_transport_get_type (void);
93
94 GstRTSPStreamTransport * gst_rtsp_stream_transport_new           (GstRTSPStream *stream,
95                                                                   GstRTSPTransport *tr);
96
97 void                     gst_rtsp_stream_transport_set_transport (GstRTSPStreamTransport *trans,
98                                                                   GstRTSPTransport * tr);
99
100 void                     gst_rtsp_stream_transport_set_callbacks (GstRTSPStreamTransport *trans,
101                                                                   GstRTSPSendFunc send_rtp,
102                                                                   GstRTSPSendFunc send_rtcp,
103                                                                   gpointer user_data,
104                                                                   GDestroyNotify  notify);
105 void                     gst_rtsp_stream_transport_set_keepalive (GstRTSPStreamTransport *trans,
106                                                                   GstRTSPKeepAliveFunc keep_alive,
107                                                                   gpointer user_data,
108                                                                   GDestroyNotify  notify);
109
110 gboolean                 gst_rtsp_stream_transport_send_rtp      (GstRTSPStreamTransport *trans,
111                                                                   GstBuffer *buffer);
112 gboolean                 gst_rtsp_stream_transport_send_rtcp     (GstRTSPStreamTransport *trans,
113                                                                   GstBuffer *buffer);
114
115 void                     gst_rtsp_stream_transport_keep_alive    (GstRTSPStreamTransport *trans);
116
117 G_END_DECLS
118
119 #endif /* __GST_RTSP_STREAM_TRANSPORT_H__ */