Added gst-plugins-base-subtitles0.10-0.10.34 for Meego Harmattan 1.2
[mafwsubrenderer] / gst-plugins-base-subtitles0.10 / gst-libs / gst / rtsp / gstrtspmessage.h
1 /* GStreamer
2  * Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.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  * Unless otherwise indicated, Source Code is licensed under MIT license.
21  * See further explanation attached in License Statement (distributed in the file
22  * LICENSE).
23  *
24  * Permission is hereby granted, free of charge, to any person obtaining a copy of
25  * this software and associated documentation files (the "Software"), to deal in
26  * the Software without restriction, including without limitation the rights to
27  * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
28  * of the Software, and to permit persons to whom the Software is furnished to do
29  * so, subject to the following conditions:
30  *
31  * The above copyright notice and this permission notice shall be included in all
32  * copies or substantial portions of the Software.
33  *
34  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
35  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
36  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
37  * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
38  * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
39  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
40  * SOFTWARE.
41  */
42
43 #ifndef __GST_RTSP_MESSAGE_H__
44 #define __GST_RTSP_MESSAGE_H__
45
46 #include <glib.h>
47
48 #include <gst/rtsp/gstrtspdefs.h>
49
50 G_BEGIN_DECLS
51
52 /**
53  * GstRTSPMsgType:
54  * @GST_RTSP_MESSAGE_INVALID: invalid message type
55  * @GST_RTSP_MESSAGE_REQUEST: RTSP request message
56  * @GST_RTSP_MESSAGE_RESPONSE: RTSP response message
57  * @GST_RTSP_MESSAGE_HTTP_REQUEST: HTTP request message. Since 0.10.25
58  * @GST_RTSP_MESSAGE_HTTP_RESPONSE: HTTP response message. Since 0.10.25
59  * @GST_RTSP_MESSAGE_DATA: data message
60  *
61  * The type of a message.
62  */
63 typedef enum
64 {
65   GST_RTSP_MESSAGE_INVALID,
66   GST_RTSP_MESSAGE_REQUEST,
67   GST_RTSP_MESSAGE_RESPONSE,
68   GST_RTSP_MESSAGE_HTTP_REQUEST,
69   GST_RTSP_MESSAGE_HTTP_RESPONSE,
70   GST_RTSP_MESSAGE_DATA
71 } GstRTSPMsgType;
72
73 typedef struct _GstRTSPMessage GstRTSPMessage;
74
75 /**
76  * GstRTSPMessage:
77  * @type: the message type
78  *
79  * An RTSP message containing request, response or data messages. Depending on
80  * the @type, the appropriate structure may be accessed.
81  */
82 struct _GstRTSPMessage
83 {
84   GstRTSPMsgType    type;
85
86   union {
87     struct {
88       GstRTSPMethod      method;
89       gchar             *uri;
90       GstRTSPVersion     version;
91     } request;
92     struct {
93       GstRTSPStatusCode  code;
94       gchar             *reason;
95       GstRTSPVersion     version;
96     } response;
97     struct {
98       guint8             channel;
99     } data;
100   } type_data;
101
102   /*< private >*/
103   GArray        *hdr_fields;
104
105   guint8        *body;
106   guint          body_size;
107 };
108
109 /* memory management */
110 GstRTSPResult      gst_rtsp_message_new             (GstRTSPMessage **msg);
111 GstRTSPResult      gst_rtsp_message_init            (GstRTSPMessage *msg);
112 GstRTSPResult      gst_rtsp_message_unset           (GstRTSPMessage *msg);
113 GstRTSPResult      gst_rtsp_message_free            (GstRTSPMessage *msg);
114
115 GstRTSPMsgType     gst_rtsp_message_get_type        (GstRTSPMessage *msg);
116
117 /* request */
118 GstRTSPResult      gst_rtsp_message_new_request     (GstRTSPMessage **msg,
119                                                      GstRTSPMethod method,
120                                                      const gchar *uri);
121 GstRTSPResult      gst_rtsp_message_init_request    (GstRTSPMessage *msg,
122                                                      GstRTSPMethod method,
123                                                      const gchar *uri);
124 GstRTSPResult      gst_rtsp_message_parse_request   (GstRTSPMessage *msg,
125                                                      GstRTSPMethod *method,
126                                                      const gchar **uri,
127                                                      GstRTSPVersion *version);
128
129 /* response */
130 GstRTSPResult      gst_rtsp_message_new_response    (GstRTSPMessage **msg,
131                                                      GstRTSPStatusCode code,
132                                                      const gchar *reason,
133                                                      const GstRTSPMessage *request);
134 GstRTSPResult      gst_rtsp_message_init_response   (GstRTSPMessage *msg,
135                                                      GstRTSPStatusCode code,
136                                                      const gchar *reason,
137                                                      const GstRTSPMessage *request);
138 GstRTSPResult      gst_rtsp_message_parse_response  (GstRTSPMessage *msg,
139                                                      GstRTSPStatusCode *code,
140                                                      const gchar **reason,
141                                                      GstRTSPVersion *version);
142
143 /* data */
144 GstRTSPResult      gst_rtsp_message_new_data        (GstRTSPMessage **msg,
145                                                      guint8 channel);
146 GstRTSPResult      gst_rtsp_message_init_data       (GstRTSPMessage *msg,
147                                                      guint8 channel);
148 GstRTSPResult      gst_rtsp_message_parse_data      (GstRTSPMessage *msg,
149                                                      guint8 *channel);
150
151 /* headers */
152 GstRTSPResult      gst_rtsp_message_add_header      (GstRTSPMessage *msg,
153                                                      GstRTSPHeaderField field,
154                                                      const gchar *value);
155 GstRTSPResult      gst_rtsp_message_take_header     (GstRTSPMessage *msg,
156                                                      GstRTSPHeaderField field,
157                                                      gchar *value);
158 GstRTSPResult      gst_rtsp_message_remove_header   (GstRTSPMessage *msg,
159                                                      GstRTSPHeaderField field,
160                                                      gint indx);
161 GstRTSPResult      gst_rtsp_message_get_header      (const GstRTSPMessage *msg,
162                                                      GstRTSPHeaderField field,
163                                                      gchar **value,
164                                                      gint indx);
165 GstRTSPResult      gst_rtsp_message_append_headers  (const GstRTSPMessage *msg,
166                                                      GString *str);
167
168 /* handling the body */
169 GstRTSPResult      gst_rtsp_message_set_body        (GstRTSPMessage *msg,
170                                                      const guint8 *data,
171                                                      guint size);
172 GstRTSPResult      gst_rtsp_message_take_body       (GstRTSPMessage *msg,
173                                                      guint8 *data,
174                                                      guint size);
175 GstRTSPResult      gst_rtsp_message_get_body        (const GstRTSPMessage *msg,
176                                                      guint8 **data,
177                                                      guint *size);
178 GstRTSPResult      gst_rtsp_message_steal_body      (GstRTSPMessage *msg,
179                                                      guint8 **data,
180                                                      guint *size);
181
182 /* debug */
183 GstRTSPResult      gst_rtsp_message_dump            (GstRTSPMessage *msg);
184
185 G_END_DECLS
186
187 #endif /* __GST_RTSP_MESSAGE_H__ */