2 * Copyright (C) 2008 Wim Taymans <wim.taymans at gmail.com>
4 * Copyright (c) 2012, 2013 Samsung Electronics Co., Ltd.
6 * This library is free software; you can redistribute it and/or
7 * modify it under the terms of the GNU Library General Public
8 * License as published by the Free Software Foundation; either
9 * version 2 of the License, or (at your option) any later version.
11 * This library is distributed in the hope that it will be useful,
12 * but WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * Library General Public License for more details.
16 * You should have received a copy of the GNU Library General Public
17 * License along with this library; if not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
22 * * Modifications by Samsung Electronics Co., Ltd.
24 * 1. Applied Miracast WFD Server function
28 #include <gst/rtsp/gstrtspconnection.h>
31 #ifndef __GST_RTSP_CLIENT_H__
32 #define __GST_RTSP_CLIENT_H__
36 typedef struct _GstRTSPClient GstRTSPClient;
37 typedef struct _GstRTSPClientClass GstRTSPClientClass;
38 typedef struct _GstRTSPClientState GstRTSPClientState;
39 typedef struct _GstRTSPClientSrcBin GstRTSPClientSrcBin;
41 #include "wfdconfigmessage.h"
42 #include "rtsp-server.h"
43 #include "rtsp-media.h"
44 #include "rtsp-media-mapping.h"
45 #include "rtsp-session-pool.h"
46 #include "rtsp-auth.h"
48 #define GST_TYPE_RTSP_CLIENT (gst_rtsp_client_get_type ())
49 #define GST_IS_RTSP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_CLIENT))
50 #define GST_IS_RTSP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_CLIENT))
51 #define GST_RTSP_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
52 #define GST_RTSP_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_CLIENT, GstRTSPClient))
53 #define GST_RTSP_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_CLIENT, GstRTSPClientClass))
54 #define GST_RTSP_CLIENT_CAST(obj) ((GstRTSPClient*)(obj))
55 #define GST_RTSP_CLIENT_CLASS_CAST(klass) ((GstRTSPClientClass*)(klass))
58 CLIENT_STATE_UNKNOWN = -1,
59 CLIENT_STATE_CONNECTING = 0,
60 CLIENT_STATE_CONNECTED = 1,
83 typedef enum __wfd_ini_videosink_element
85 WFD_INI_VSINK_V4l2SINK = 0,
86 WFD_INI_VSINK_XIMAGESINK,
87 WFD_INI_VSINK_XVIMAGESINK,
88 WFD_INI_VSINK_FAKESINK,
89 WFD_INI_VSINK_EVASIMAGESINK,
90 WFD_INI_VSINK_GLIMAGESINK,
92 }WFD_INI_VSINK_ELEMENT;
94 typedef enum __wfd_ini_videosrc_element
96 WFD_INI_VSRC_XVIMAGESRC,
98 WFD_INI_VSRC_CAMERASRC,
99 WFD_INI_VSRC_VIDEOTESTSRC,
101 }WFD_INI_VSRC_ELEMENT;
103 typedef enum __wfd_ini_session_mode
105 WFD_INI_AUDIO_VIDEO_MUXED,
108 WFD_INI_AUDIO_VIDEO_SAPERATE
109 }WFD_INI_SESSION_MODE;
112 * GstRTSPClientState:
113 * @request: the complete request
114 * @uri: the complete url parsed from @request
115 * @method: the parsed method of @uri
116 * @session: the session, can be NULL
117 * @sessmedia: the session media for the url can be NULL
118 * @factory: the media factory for the url, can be NULL.
119 * @media: the session media for the url can be NULL
120 * @response: the response
122 * Information passed around containing the client state of a request.
124 struct _GstRTSPClientState{
125 GstRTSPMessage *request;
127 GstRTSPMethod method;
128 GstRTSPSession *session;
129 GstRTSPSessionMedia *sessmedia;
130 GstRTSPMediaFactory *factory;
132 GstRTSPMessage *response;
135 struct _GstRTSPClientSrcBin{
141 GstPad *mux_vsinkpad;
142 GstPad *mux_asinkpad;
150 * @connection: the connection object handling the client request.
151 * @watch: watch for the connection
152 * @watchid: id of the watch
153 * @ip: ip address used by the client to connect to us
154 * @session_pool: handle to the session pool used by the client.
155 * @media_mapping: handle to the media mapping used by the client.
157 * @media: cached media
158 * @streams: a list of streams using @connection.
159 * @sessions: a list of sessions managed by @connection.
161 * The client structure.
163 struct _GstRTSPClient {
166 GstRTSPConnection *connection;
173 GstRTSPServer *server;
174 GstRTSPSessionPool *session_pool;
176 GstRTSPMediaMapping *media_mapping;
185 /* supported methods */
188 GstRTSPClientSrcBin *srcbin;
196 ClientState client_state;
198 WFDAudioFormats caCodec;
200 WFDAudioChannels cChanels;
203 WFDVideoCodecs cvCodec;
204 WFDVideoNativeResolution cNative;
205 guint64 cNativeResolution;
206 WFDVideoCEAResolution cCEAResolution;
207 WFDVideoVESAResolution cVESAResolution;
208 WFDVideoHHResolution cHHResolution;
209 WFDVideoH264Profile cProfile;
210 WFDVideoH264Level cLevel;
213 guint32 cmin_slice_size;
214 guint32 cslice_enc_params;
215 guint cframe_rate_control;
219 WFDRTSPTransMode ctrans;
220 WFDRTSPProfile cprofile;
221 WFDRTSPLowerTrans clowertrans;
226 WFDHDCPProtection hdcp_version;
227 guint32 hdcp_tcpport;
228 gboolean hdcp_support;
229 #ifdef STANDBY_RESUME_CAPABILITY
230 gboolean standby_resume_capability_support;
233 gboolean keep_alive_flag;
234 GMutex *keep_alive_lock;
238 struct _GstRTSPClientClass {
239 GObjectClass parent_class;
242 void (*closed) (GstRTSPClient *client);
243 void (*on_error) (GstRTSPClient *client);
246 GType gst_rtsp_client_get_type (void);
248 GstRTSPClient * gst_rtsp_client_new (void);
250 void gst_rtsp_client_set_server (GstRTSPClient * client, GstRTSPServer * server);
251 GstRTSPServer * gst_rtsp_client_get_server (GstRTSPClient * client);
253 void gst_rtsp_client_set_session_pool (GstRTSPClient *client,
254 GstRTSPSessionPool *pool);
255 GstRTSPSessionPool * gst_rtsp_client_get_session_pool (GstRTSPClient *client);
257 void gst_rtsp_client_set_media_mapping (GstRTSPClient *client,
258 GstRTSPMediaMapping *mapping);
259 GstRTSPMediaMapping * gst_rtsp_client_get_media_mapping (GstRTSPClient *client);
261 void gst_rtsp_client_set_auth (GstRTSPClient *client, GstRTSPAuth *auth);
262 GstRTSPAuth * gst_rtsp_client_get_auth (GstRTSPClient *client);
265 gboolean gst_rtsp_client_accept (GstRTSPClient *client, int sock);
268 gst_rtsp_client_accept (GstRTSPClient * client, GIOChannel * channel, GSource *source);
270 gboolean gst_rtsp_client_negotiate (GstRTSPClient * client);
271 gboolean gst_rtsp_client_start (GstRTSPClient * client);
272 gboolean gst_rtsp_client_pause (GstRTSPClient * client);
273 gboolean gst_rtsp_client_resume (GstRTSPClient * client);
274 gboolean gst_rtsp_client_standby (GstRTSPClient * client);
275 gboolean gst_rtsp_client_stop (GstRTSPClient * client);
276 void gst_rtsp_client_set_params (GstRTSPClient *client, int videosrc_type, gint session_mode, int videobitrate, gint mtu_size, gchar *infile);
280 #endif /* __GST_RTSP_CLIENT_H__ */