2 * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
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.
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.
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.
21 #include <gst/rtsp/gstrtspconnection.h>
23 #ifndef __GST_RTSP_CLIENT_H__
24 #define __GST_RTSP_CLIENT_H__
28 typedef struct _GstRTSPClient GstRTSPClient;
29 typedef struct _GstRTSPClientClass GstRTSPClientClass;
30 typedef struct _GstRTSPClientState GstRTSPClientState;
31 typedef struct _GstRTSPClientPrivate GstRTSPClientPrivate;
33 #include "rtsp-media.h"
34 #include "rtsp-mount-points.h"
35 #include "rtsp-session-pool.h"
36 #include "rtsp-session-media.h"
37 #include "rtsp-auth.h"
38 #include "rtsp-token.h"
41 #define GST_TYPE_RTSP_CLIENT (gst_rtsp_client_get_type ())
42 #define GST_IS_RTSP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_CLIENT))
43 #define GST_IS_RTSP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_CLIENT))
44 #define GST_RTSP_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
45 #define GST_RTSP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClient))
46 #define GST_RTSP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
47 #define GST_RTSP_CLIENT_CAST(obj) ((GstRTSPClient*)(obj))
48 #define GST_RTSP_CLIENT_CLASS_CAST(klass) ((GstRTSPClientClass*)(klass))
53 * @request: the complete request
54 * @uri: the complete url parsed from @request
55 * @method: the parsed method of @uri
56 * @auth: the current auth object or NULL
57 * @token: authorisation token
58 * @session: the session, can be NULL
59 * @sessmedia: the session media for the url can be NULL
60 * @factory: the media factory for the url, can be NULL.
61 * @media: the media for the url can be NULL
62 * @stream: the stream for the url can be NULL
63 * @response: the response
65 * Information passed around containing the client state of a request.
67 struct _GstRTSPClientState {
68 GstRTSPClient *client;
69 GstRTSPMessage *request;
74 GstRTSPSession *session;
75 GstRTSPSessionMedia *sessmedia;
76 GstRTSPMediaFactory *factory;
78 GstRTSPStream *stream;
79 GstRTSPMessage *response;
82 GstRTSPClientState * gst_rtsp_client_state_get_current (void);
85 * GstRTSPClientSendFunc:
86 * @client: a #GstRTSPClient
87 * @message: a #GstRTSPMessage
88 * @close: close the connection
89 * @user_data: user data when registering the callback
91 * This callback is called when @client wants to send @message. When @close is
92 * %TRUE, the connection should be closed when the message has been sent.
94 * Returns: %TRUE on success.
96 typedef gboolean (*GstRTSPClientSendFunc) (GstRTSPClient *client,
97 GstRTSPMessage *message,
104 * The client structure.
106 struct _GstRTSPClient {
109 GstRTSPClientPrivate *priv;
113 * GstRTSPClientClass:
114 * @params_set: set parameters. This function should also initialize the
115 * RTSP response(state->response) via a call to gst_rtsp_message_init_response()
116 * @params_get: get parameters. This function should also initialize the
117 * RTSP response(state->response) via a call to gst_rtsp_message_init_response()
119 * The client class structure.
121 struct _GstRTSPClientClass {
122 GObjectClass parent_class;
124 GstSDPMessage * (*create_sdp) (GstRTSPClient *client, GstRTSPMedia *media);
125 gboolean (*configure_client_transport) (GstRTSPClient * client,
126 GstRTSPClientState * state,
127 GstRTSPTransport * ct);
128 GstRTSPResult (*params_set) (GstRTSPClient *client, GstRTSPClientState *state);
129 GstRTSPResult (*params_get) (GstRTSPClient *client, GstRTSPClientState *state);
132 void (*closed) (GstRTSPClient *client);
133 void (*new_session) (GstRTSPClient *client, GstRTSPSession *session);
134 void (*options_request) (GstRTSPClient *client, GstRTSPClientState *state);
135 void (*describe_request) (GstRTSPClient *client, GstRTSPClientState *state);
136 void (*setup_request) (GstRTSPClient *client, GstRTSPClientState *state);
137 void (*play_request) (GstRTSPClient *client, GstRTSPClientState *state);
138 void (*pause_request) (GstRTSPClient *client, GstRTSPClientState *state);
139 void (*teardown_request) (GstRTSPClient *client, GstRTSPClientState *state);
140 void (*set_parameter_request) (GstRTSPClient *client, GstRTSPClientState *state);
141 void (*get_parameter_request) (GstRTSPClient *client, GstRTSPClientState *state);
144 GType gst_rtsp_client_get_type (void);
146 GstRTSPClient * gst_rtsp_client_new (void);
148 void gst_rtsp_client_set_session_pool (GstRTSPClient *client,
149 GstRTSPSessionPool *pool);
150 GstRTSPSessionPool * gst_rtsp_client_get_session_pool (GstRTSPClient *client);
152 void gst_rtsp_client_set_mount_points (GstRTSPClient *client,
153 GstRTSPMountPoints *mounts);
154 GstRTSPMountPoints * gst_rtsp_client_get_mount_points (GstRTSPClient *client);
156 void gst_rtsp_client_set_use_client_settings (GstRTSPClient * client,
157 gboolean use_client_settings);
158 gboolean gst_rtsp_client_get_use_client_settings (GstRTSPClient * client);
160 void gst_rtsp_client_set_auth (GstRTSPClient *client, GstRTSPAuth *auth);
161 GstRTSPAuth * gst_rtsp_client_get_auth (GstRTSPClient *client);
163 gboolean gst_rtsp_client_set_connection (GstRTSPClient *client, GstRTSPConnection *conn);
164 GstRTSPConnection * gst_rtsp_client_get_connection (GstRTSPClient *client);
166 void gst_rtsp_client_set_send_func (GstRTSPClient *client,
167 GstRTSPClientSendFunc func,
169 GDestroyNotify notify);
170 GstRTSPResult gst_rtsp_client_handle_message (GstRTSPClient *client,
171 GstRTSPMessage *message);
173 GstRTSPResult gst_rtsp_client_send_request (GstRTSPClient * client,
174 GstRTSPSession *session,
175 GstRTSPMessage *request);
176 guint gst_rtsp_client_attach (GstRTSPClient *client,
177 GMainContext *context);
180 * GstRTSPClientSessionFilterFunc:
181 * @client: a #GstRTSPClient object
182 * @sess: a #GstRTSPSession in @client
183 * @user_data: user data that has been given to gst_rtsp_client_session_filter()
185 * This function will be called by the gst_rtsp_client_session_filter(). An
186 * implementation should return a value of #GstRTSPFilterResult.
188 * When this function returns #GST_RTSP_FILTER_REMOVE, @sess will be removed
191 * A return value of #GST_RTSP_FILTER_KEEP will leave @sess untouched in
194 * A value of GST_RTSP_FILTER_REF will add @sess to the result #GList of
195 * gst_rtsp_client_session_filter().
197 * Returns: a #GstRTSPFilterResult.
199 typedef GstRTSPFilterResult (*GstRTSPClientSessionFilterFunc) (GstRTSPClient *client,
200 GstRTSPSession *sess,
203 GList * gst_rtsp_client_session_filter (GstRTSPClient *client,
204 GstRTSPClientSessionFilterFunc func,
211 #endif /* __GST_RTSP_CLIENT_H__ */