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"
40 #define GST_TYPE_RTSP_CLIENT (gst_rtsp_client_get_type ())
41 #define GST_IS_RTSP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_CLIENT))
42 #define GST_IS_RTSP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_CLIENT))
43 #define GST_RTSP_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
44 #define GST_RTSP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClient))
45 #define GST_RTSP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
46 #define GST_RTSP_CLIENT_CAST(obj) ((GstRTSPClient*)(obj))
47 #define GST_RTSP_CLIENT_CLASS_CAST(klass) ((GstRTSPClientClass*)(klass))
51 * @request: the complete request
52 * @uri: the complete url parsed from @request
53 * @method: the parsed method of @uri
54 * @session: the session, can be NULL
55 * @sessmedia: the session media for the url can be NULL
56 * @factory: the media factory for the url, can be NULL.
57 * @media: the media for the url can be NULL
58 * @stream: the stream for the url can be NULL
59 * @response: the response
61 * Information passed around containing the client state of a request.
63 struct _GstRTSPClientState {
64 GstRTSPMessage *request;
67 GstRTSPSession *session;
68 GstRTSPSessionMedia *sessmedia;
69 GstRTSPMediaFactory *factory;
71 GstRTSPStream *stream;
72 GstRTSPMessage *response;
76 * GstRTSPClientSendFunc:
77 * @client: a #GstRTSPClient
78 * @message: a #GstRTSPMessage
79 * @close: close the connection
80 * @user_data: user data when registering the callback
82 * This callback is called when @client wants to send @message. When @close is
83 * %TRUE, the connection should be closed when the message has been sent.
85 * Returns: %TRUE on success.
87 typedef gboolean (*GstRTSPClientSendFunc) (GstRTSPClient *client,
88 GstRTSPMessage *message,
95 * The client structure.
97 struct _GstRTSPClient {
100 GstRTSPClientPrivate *priv;
103 struct _GstRTSPClientClass {
104 GObjectClass parent_class;
106 GstSDPMessage * (*create_sdp) (GstRTSPClient *client, GstRTSPMedia *media);
109 void (*closed) (GstRTSPClient *client);
110 void (*new_session) (GstRTSPClient *client, GstRTSPSession *session);
111 void (*options_request) (GstRTSPClient *client, GstRTSPClientState *state);
112 void (*describe_request) (GstRTSPClient *client, GstRTSPClientState *state);
113 void (*setup_request) (GstRTSPClient *client, GstRTSPClientState *state);
114 void (*play_request) (GstRTSPClient *client, GstRTSPClientState *state);
115 void (*pause_request) (GstRTSPClient *client, GstRTSPClientState *state);
116 void (*teardown_request) (GstRTSPClient *client, GstRTSPClientState *state);
117 void (*set_parameter_request) (GstRTSPClient *client, GstRTSPClientState *state);
118 void (*get_parameter_request) (GstRTSPClient *client, GstRTSPClientState *state);
121 GType gst_rtsp_client_get_type (void);
123 GstRTSPClient * gst_rtsp_client_new (void);
125 void gst_rtsp_client_set_session_pool (GstRTSPClient *client,
126 GstRTSPSessionPool *pool);
127 GstRTSPSessionPool * gst_rtsp_client_get_session_pool (GstRTSPClient *client);
129 void gst_rtsp_client_set_mount_points (GstRTSPClient *client,
130 GstRTSPMountPoints *mounts);
131 GstRTSPMountPoints * gst_rtsp_client_get_mount_points (GstRTSPClient *client);
133 void gst_rtsp_client_set_use_client_settings (GstRTSPClient * client,
134 gboolean use_client_settings);
135 gboolean gst_rtsp_client_get_use_client_settings (GstRTSPClient * client);
137 void gst_rtsp_client_set_auth (GstRTSPClient *client, GstRTSPAuth *auth);
138 GstRTSPAuth * gst_rtsp_client_get_auth (GstRTSPClient *client);
140 void gst_rtsp_client_set_send_func (GstRTSPClient *client,
141 GstRTSPClientSendFunc func,
143 GDestroyNotify notify);
144 GstRTSPResult gst_rtsp_client_handle_message (GstRTSPClient *client,
145 GstRTSPMessage *message);
147 gboolean gst_rtsp_client_accept (GstRTSPClient *client,
149 GCancellable *cancellable,
152 gboolean gst_rtsp_client_use_socket (GstRTSPClient * client,
156 const gchar *initial_buffer,
159 guint gst_rtsp_client_attach (GstRTSPClient *client,
160 GMainContext *context);
165 #endif /* __GST_RTSP_CLIENT_H__ */