Initial release including wifi display based on gst-rtsp-server-1.4.1
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-client-wfd.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/gstrtspconnection.h>
22
23 #ifndef __GST_RTSP_WFD_CLIENT_H__
24 #define __GST_RTSP_WFD_CLIENT_H__
25
26 G_BEGIN_DECLS
27
28 typedef struct _GstRTSPWFDClient GstRTSPWFDClient;
29 typedef struct _GstRTSPWFDClientClass GstRTSPWFDClientClass;
30 typedef struct _GstRTSPWFDClientPrivate GstRTSPWFDClientPrivate;
31
32 #include "rtsp-context.h"
33 #include "rtsp-mount-points.h"
34 #include "rtsp-sdp.h"
35 #include "rtsp-auth.h"
36 #include "rtsp-client.h"
37
38 #define GST_TYPE_RTSP_WFD_CLIENT              (gst_rtsp_wfd_client_get_type ())
39 #define GST_IS_RTSP_WFD_CLIENT(obj)           (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_WFD_CLIENT))
40 #define GST_IS_RTSP_WFD_CLIENT_CLASS(klass)   (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_WFD_CLIENT))
41 #define GST_RTSP_WFD_CLIENT_GET_CLASS(obj)    (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_WFD_CLIENT, GstRTSPWFDClientClass))
42 #define GST_RTSP_WFD_CLIENT(obj)              (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_WFD_CLIENT, GstRTSPWFDClient))
43 #define GST_RTSP_WFD_CLIENT_CLASS(klass)      (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_WFD_CLIENT, GstRTSPWFDClientClass))
44 #define GST_RTSP_WFD_CLIENT_CAST(obj)         ((GstRTSPWFDClient*)(obj))
45 #define GST_RTSP_WFD_CLIENT_CLASS_CAST(klass) ((GstRTSPWFDClientClass*)(klass))
46
47
48 /**
49  *
50  */
51 typedef enum {
52   WFD_TRIGGER_SETUP,
53   WFD_TRIGGER_PAUSE,
54   WFD_TRIGGER_TEARDOWN,
55   WFD_TRIGGER_PLAY
56 } GstWFDTriggerType;
57
58 /**
59  * GstRTSPWFDClientSendFunc:
60  * @client: a #GstRTSPWFDClient
61  * @message: a #GstRTSPMessage
62  * @close: close the connection
63  * @user_data: user data when registering the callback
64  *
65  * This callback is called when @client wants to send @message. When @close is
66  * %TRUE, the connection should be closed when the message has been sent.
67  *
68  * Returns: %TRUE on success.
69  */
70 typedef gboolean (*GstRTSPWFDClientSendFunc)      (GstRTSPWFDClient *client,
71                                                 GstRTSPMessage *message,
72                                                 gboolean close,
73                                                 gpointer user_data);
74
75 /**
76  * GstRTSPWFDClient:
77  *
78  * The client object represents the connection and its state with a client.
79  */
80 struct _GstRTSPWFDClient {
81   GstRTSPClient  parent;
82
83   gint           supported_methods;
84   /*< private >*/
85   GstRTSPWFDClientPrivate *priv;
86   gpointer _gst_reserved[GST_PADDING];
87 };
88
89 /**
90  * GstRTSPWFDClientClass:
91  * @create_sdp: called when the SDP needs to be created for media.
92  * @configure_client_media: called when the stream in media needs to be configured.
93  *    The default implementation will configure the blocksize on the payloader when
94  *    spcified in the request headers.
95  * @configure_client_transport: called when the client transport needs to be
96  *    configured.
97  * @params_set: set parameters. This function should also initialize the
98  *    RTSP response(ctx->response) via a call to gst_rtsp_message_init_response()
99  * @params_get: get parameters. This function should also initialize the
100  *    RTSP response(ctx->response) via a call to gst_rtsp_message_init_response()
101  *
102  * The client class structure.
103  */
104 struct _GstRTSPWFDClientClass {
105   GstRTSPClientClass  parent_class;
106
107   /* signals */
108   void     (*wfd_options_request)         (GstRTSPWFDClient *client);
109   void     (*wfd_get_param_request)        (GstRTSPWFDClient *client);
110
111   /*< private >*/
112   gpointer _gst_reserved[GST_PADDING_LARGE];
113 };
114
115 GType                 gst_rtsp_wfd_client_get_type          (void);
116
117 GstRTSPWFDClient *    gst_rtsp_wfd_client_new               (void);
118
119 void                  gst_rtsp_wfd_client_start_wfd(GstRTSPWFDClient *client);
120 GstRTSPResult         gst_rtsp_wfd_client_trigger_request (
121                           GstRTSPWFDClient * client, GstWFDTriggerType type);
122
123 GstRTSPResult         gst_rtsp_wfd_client_set_video_supported_resolution (
124                           GstRTSPWFDClient * client, guint64 supported_reso);
125
126 /**
127  * GstRTSPWFDClientSessionFilterFunc:
128  * @client: a #GstRTSPWFDClient object
129  * @sess: a #GstRTSPSession in @client
130  * @user_data: user data that has been given to gst_rtsp_wfd_client_session_filter()
131  *
132  * This function will be called by the gst_rtsp_wfd_client_session_filter(). An
133  * implementation should return a value of #GstRTSPFilterResult.
134  *
135  * When this function returns #GST_RTSP_FILTER_REMOVE, @sess will be removed
136  * from @client.
137  *
138  * A return value of #GST_RTSP_FILTER_KEEP will leave @sess untouched in
139  * @client.
140  *
141  * A value of #GST_RTSP_FILTER_REF will add @sess to the result #GList of
142  * gst_rtsp_wfd_client_session_filter().
143  *
144  * Returns: a #GstRTSPFilterResult.
145  */
146 typedef GstRTSPFilterResult (*GstRTSPWFDClientSessionFilterFunc)  (GstRTSPWFDClient *client,
147                                                                 GstRTSPSession *sess,
148                                                                 gpointer user_data);
149
150
151
152 G_END_DECLS
153
154 #endif /* __GST_RTSP_WFD_CLIENT_H__ */