docs: update docs
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-stream.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., 59 Temple Place - Suite 330,
17  * Boston, MA 02111-1307, 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_H__
25 #define __GST_RTSP_STREAM_H__
26
27 G_BEGIN_DECLS
28
29 /* types for the media stream */
30 #define GST_TYPE_RTSP_STREAM              (gst_rtsp_stream_get_type ())
31 #define GST_IS_RTSP_STREAM(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_STREAM))
32 #define GST_IS_RTSP_STREAM_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_STREAM))
33 #define GST_RTSP_STREAM_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_STREAM, GstRTSPStreamClass))
34 #define GST_RTSP_STREAM(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_STREAM, GstRTSPStream))
35 #define GST_RTSP_STREAM_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_STREAM, GstRTSPStreamClass))
36 #define GST_RTSP_STREAM_CAST(obj)         ((GstRTSPStream*)(obj))
37 #define GST_RTSP_STREAM_CLASS_CAST(klass) ((GstRTSPStreamClass*)(klass))
38
39 typedef struct _GstRTSPStream GstRTSPStream;
40 typedef struct _GstRTSPStreamClass GstRTSPStreamClass;
41
42 #include "rtsp-stream-transport.h"
43
44 /**
45  * GstRTSPStream:
46  * @parent: the parent instance
47  * @idx: the stream index
48  * @srcpad: the srcpad of the stream
49  * @payloader: the payloader of the format
50  * @is_ipv6: should this stream be IPv6
51  * @buffer_size: the UDP buffer size
52  * @is_joined: if the stream is joined in a bin
53  * @recv_rtp_sink: sinkpad for RTP buffers
54  * @recv_rtcp_sink: sinkpad for RTCP buffers
55  * @send_rtp_src: srcpad for RTP buffers
56  * @send_rtcp_src: srcpad for RTCP buffers
57  * @udpsrc: the udp source elements for RTP/RTCP
58  * @udpsink: the udp sink elements for RTP/RTCP
59  * @appsrc: the app source elements for RTP/RTCP
60  * @appsink: the app sink elements for RTP/RTCP
61  * @server_port: the server ports for this stream
62  * @caps_sig: the signal id for detecting caps
63  * @caps: the caps of the stream
64  * @n_active: the number of active transports in @transports
65  * @transports: list of #GstStreamTransport being streamed to
66  *
67  * The definition of a media stream. The streams are identified by @id.
68  */
69 struct _GstRTSPStream {
70   GObject       parent;
71
72   guint         idx;
73   GstPad       *srcpad;
74   GstElement   *payloader;
75   gboolean      is_ipv6;
76   guint         buffer_size;
77   gboolean      is_joined;
78
79   /* pads on the rtpbin */
80   GstPad       *recv_rtcp_sink;
81   GstPad       *recv_rtp_sink;
82   GstPad       *send_rtp_sink;
83   GstPad       *send_rtp_src;
84   GstPad       *send_rtcp_src;
85
86   /* the RTPSession object */
87   GObject      *session;
88
89   /* sinks used for sending and receiving RTP and RTCP, they share
90    * sockets */
91   GstElement   *udpsrc[2];
92   GstElement   *udpsink[2];
93   /* for TCP transport */
94   GstElement   *appsrc[2];
95   GstElement   *appqueue[2];
96   GstElement   *appsink[2];
97
98   GstElement   *tee[2];
99   GstElement   *selector[2];
100
101   /* server ports for sending/receiving */
102   GstRTSPRange  server_port;
103
104   /* the caps of the stream */
105   gulong        caps_sig;
106   GstCaps      *caps;
107
108   /* transports we stream to */
109   guint         n_active;
110   GList        *transports;
111 };
112
113 struct _GstRTSPStreamClass {
114   GObjectClass parent_class;
115 };
116
117 GType             gst_rtsp_stream_get_type         (void);
118
119 GstRTSPStream *   gst_rtsp_stream_new              (guint idx, GstElement *payloader,
120                                                     GstPad *srcpad);
121
122 void              gst_rtsp_stream_set_mtu          (GstRTSPStream * stream, guint mtu);
123 guint             gst_rtsp_stream_get_mtu          (GstRTSPStream * stream);
124
125 gboolean          gst_rtsp_stream_join_bin         (GstRTSPStream * stream,
126                                                     GstBin *bin, GstElement *rtpbin);
127 gboolean          gst_rtsp_stream_leave_bin        (GstRTSPStream * stream,
128                                                     GstBin *bin, GstElement *rtpbin);
129
130 gboolean          gst_rtsp_stream_get_rtpinfo      (GstRTSPStream * stream,
131                                                     guint *rtptime, guint * seq);
132
133 GstFlowReturn     gst_rtsp_stream_recv_rtp         (GstRTSPStream *stream,
134                                                     GstBuffer *buffer);
135 GstFlowReturn     gst_rtsp_stream_recv_rtcp        (GstRTSPStream *stream,
136                                                     GstBuffer *buffer);
137
138 gboolean          gst_rtsp_stream_add_transport    (GstRTSPStream *stream,
139                                                     GstRTSPStreamTransport *trans);
140 gboolean          gst_rtsp_stream_remove_transport (GstRTSPStream *stream,
141                                                     GstRTSPStreamTransport *trans);
142
143 G_END_DECLS
144
145 #endif /* __GST_RTSP_STREAM_H__ */