2 * Copyright (C) 2015 Samsung Electronics Hyunjun Ko <zzoon.ko@samsung.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_WFD_CLIENT_H__
24 #define __GST_RTSP_WFD_CLIENT_H__
28 typedef struct _GstRTSPWFDClient GstRTSPWFDClient;
29 typedef struct _GstRTSPWFDClientClass GstRTSPWFDClientClass;
30 typedef struct _GstRTSPWFDClientPrivate GstRTSPWFDClientPrivate;
32 #include "rtsp-context.h"
33 #include "rtsp-mount-points.h"
35 #include "rtsp-auth.h"
36 #include "rtsp-client.h"
37 #include "gstwfdmessage.h"
39 #define GST_TYPE_RTSP_WFD_CLIENT (gst_rtsp_wfd_client_get_type ())
40 #define GST_IS_RTSP_WFD_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), GST_TYPE_RTSP_WFD_CLIENT))
41 #define GST_IS_RTSP_WFD_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), GST_TYPE_RTSP_WFD_CLIENT))
42 #define GST_RTSP_WFD_CLIENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), GST_TYPE_RTSP_WFD_CLIENT, GstRTSPWFDClientClass))
43 #define GST_RTSP_WFD_CLIENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), GST_TYPE_RTSP_WFD_CLIENT, GstRTSPWFDClient))
44 #define GST_RTSP_WFD_CLIENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), GST_TYPE_RTSP_WFD_CLIENT, GstRTSPWFDClientClass))
45 #define GST_RTSP_WFD_CLIENT_CAST(obj) ((GstRTSPWFDClient*)(obj))
46 #define GST_RTSP_WFD_CLIENT_CLASS_CAST(klass) ((GstRTSPWFDClientClass*)(klass))
60 * GstRTSPWFDClientSendFunc:
61 * @client: a #GstRTSPWFDClient
62 * @message: a #GstRTSPMessage
63 * @close: close the connection
64 * @user_data: user data when registering the callback
66 * This callback is called when @client wants to send @message. When @close is
67 * %TRUE, the connection should be closed when the message has been sent.
69 * Returns: %TRUE on success.
71 typedef gboolean (*GstRTSPWFDClientSendFunc) (GstRTSPWFDClient *client,
72 GstRTSPMessage *message,
79 * The client object represents the connection and its state with a client.
81 struct _GstRTSPWFDClient {
84 #if 0 /* unused variable */
85 gint supported_methods;
88 GstRTSPWFDClientPrivate *priv;
89 gpointer _gst_reserved[GST_PADDING];
93 * GstRTSPWFDClientClass:
94 * @create_sdp: called when the SDP needs to be created for media.
95 * @configure_client_media: called when the stream in media needs to be configured.
96 * The default implementation will configure the blocksize on the payloader when
97 * spcified in the request headers.
98 * @configure_client_transport: called when the client transport needs to be
100 * @params_set: set parameters. This function should also initialize the
101 * RTSP response(ctx->response) via a call to gst_rtsp_message_init_response()
102 * @params_get: get parameters. This function should also initialize the
103 * RTSP response(ctx->response) via a call to gst_rtsp_message_init_response()
105 * The client class structure.
107 struct _GstRTSPWFDClientClass {
108 GstRTSPClientClass parent_class;
110 GstRTSPResult (*prepare_resource) (GstRTSPWFDClient *client, GstRTSPContext *ctx);
111 GstRTSPResult (*confirm_resource) (GstRTSPWFDClient *client, GstRTSPContext *ctx);
112 gboolean (*configure_client_media) (GstRTSPClient * client,
113 GstRTSPMedia * media, GstRTSPStream * stream,
114 GstRTSPContext * ctx);
117 void (*wfd_options_request) (GstRTSPWFDClient *client, GstRTSPContext *ctx);
118 void (*wfd_get_param_request) (GstRTSPWFDClient *client, GstRTSPContext *ctx);
119 void (*wfd_keep_alive_fail) (GstRTSPWFDClient *client);
120 void (*wfd_playing_done) (GstRTSPWFDClient *client);
121 void (*wfd_rtp_stats) (GstRTSPWFDClient *client, GstStructure *stats);
122 gchar* (*wfd_handle_m3_req_msg) (GstRTSPWFDClient *client, gchar *data);
123 void (*wfd_handle_m3_res_msg) (GstRTSPWFDClient *client, gchar *data);
124 gchar* (*wfd_handle_m4_req_msg) (GstRTSPWFDClient *client, gchar *data);
125 void (*wfd_handle_set_param_msg) (GstRTSPWFDClient *client, gchar *data);
128 gpointer _gst_reserved[GST_PADDING_LARGE];
131 GType gst_rtsp_wfd_client_get_type (void);
133 GstRTSPWFDClient * gst_rtsp_wfd_client_new (void);
135 void gst_rtsp_wfd_client_set_host_address (
136 GstRTSPWFDClient *client, const gchar * address);
138 void gst_rtsp_wfd_client_start_wfd(GstRTSPWFDClient *client);
139 GstRTSPResult gst_rtsp_wfd_client_trigger_request (
140 GstRTSPWFDClient * client, GstWFDTriggerType type);
142 GstRTSPResult gst_rtsp_wfd_client_set_video_supported_resolution (
143 GstRTSPWFDClient * client, guint64 supported_reso);
144 GstRTSPResult gst_rtsp_wfd_client_set_video_native_resolution (
145 GstRTSPWFDClient * client, guint64 native_reso);
146 GstRTSPResult gst_rtsp_wfd_client_set_audio_codec (
147 GstRTSPWFDClient * client, guint8 audio_codec);
148 GstRTSPResult gst_prepare_request (GstRTSPWFDClient * client,
149 GstRTSPMessage * request, GstRTSPMethod method, gchar * url);
150 void gst_send_request (GstRTSPWFDClient * client,
151 GstRTSPSession * session, GstRTSPMessage * request);
153 guint gst_rtsp_wfd_client_get_audio_codec(GstRTSPWFDClient *client);
154 guint gst_rtsp_wfd_client_get_audio_freq(GstRTSPWFDClient *client);
155 guint gst_rtsp_wfd_client_get_audio_channels(GstRTSPWFDClient *client);
156 guint gst_rtsp_wfd_client_get_audio_bit_width(GstRTSPWFDClient *client);
157 guint gst_rtsp_wfd_client_get_audio_latency(GstRTSPWFDClient *client);
158 guint gst_rtsp_wfd_client_get_video_codec(GstRTSPWFDClient *client);
159 guint gst_rtsp_wfd_client_get_video_native(GstRTSPWFDClient *client);
160 guint64 gst_rtsp_wfd_client_get_video_native_resolution(GstRTSPWFDClient *client);
161 guint64 gst_rtsp_wfd_client_get_video_cea_resolution(GstRTSPWFDClient *client);
162 guint64 gst_rtsp_wfd_client_get_video_vesa_resolution(GstRTSPWFDClient *client);
163 guint64 gst_rtsp_wfd_client_get_video_hh_resolution(GstRTSPWFDClient *client);
164 guint gst_rtsp_wfd_client_get_video_profile(GstRTSPWFDClient *client);
165 guint gst_rtsp_wfd_client_get_video_level(GstRTSPWFDClient *client);
166 guint gst_rtsp_wfd_client_get_video_latency(GstRTSPWFDClient *client);
167 guint32 gst_rtsp_wfd_client_get_video_max_height(GstRTSPWFDClient *client);
168 guint32 gst_rtsp_wfd_client_get_video_max_width(GstRTSPWFDClient *client);
169 guint32 gst_rtsp_wfd_client_get_video_framerate(GstRTSPWFDClient *client);
170 guint32 gst_rtsp_wfd_client_get_video_min_slice_size(GstRTSPWFDClient *client);
171 guint32 gst_rtsp_wfd_client_get_video_slice_enc_params(GstRTSPWFDClient *client);
172 guint gst_rtsp_wfd_client_get_video_framerate_control(GstRTSPWFDClient *client);
173 guint32 gst_rtsp_wfd_client_get_rtp_port0(GstRTSPWFDClient *client);
174 guint32 gst_rtsp_wfd_client_get_rtp_port1(GstRTSPWFDClient *client);
175 gboolean gst_rtsp_wfd_client_get_edid_supported(GstRTSPWFDClient *client);
176 guint32 gst_rtsp_wfd_client_get_edid_hresolution(GstRTSPWFDClient *client);
177 guint32 gst_rtsp_wfd_client_get_edid_vresolution(GstRTSPWFDClient *client);
178 gboolean gst_rtsp_wfd_client_get_protection_enabled(GstRTSPWFDClient *client);
180 void gst_rtsp_wfd_client_set_audio_freq(GstRTSPWFDClient *client, guint freq);
181 void gst_rtsp_wfd_client_set_edid_supported(GstRTSPWFDClient *client, gboolean supported);
182 void gst_rtsp_wfd_client_set_edid_hresolution(GstRTSPWFDClient *client, guint32 reso);
183 void gst_rtsp_wfd_client_set_edid_vresolution(GstRTSPWFDClient *client, guint32 reso);
184 void gst_rtsp_wfd_client_set_protection_enabled(GstRTSPWFDClient *client, gboolean enable);
185 void gst_rtsp_wfd_client_set_hdcp_version(GstRTSPWFDClient *client, GstWFDHDCPProtection version);
186 void gst_rtsp_wfd_client_set_hdcp_port(GstRTSPWFDClient *client, guint32 port);
187 void gst_rtsp_wfd_client_set_keep_alive_flag(GstRTSPWFDClient *client, gboolean flag);
188 void gst_rtsp_wfd_client_set_aud_codec(GstRTSPWFDClient *client, guint acodec);
189 void gst_rtsp_wfd_client_set_audio_channels(GstRTSPWFDClient *client, guint channels);
190 void gst_rtsp_wfd_client_set_audio_bit_width(GstRTSPWFDClient *client, guint bwidth);
191 void gst_rtsp_wfd_client_set_audio_latency(GstRTSPWFDClient *client, guint latency);
192 void gst_rtsp_wfd_client_set_video_codec(GstRTSPWFDClient *client, guint vcodec);
193 void gst_rtsp_wfd_client_set_video_native(GstRTSPWFDClient *client, guint native);
194 void gst_rtsp_wfd_client_set_vid_native_resolution(GstRTSPWFDClient *client, guint64 res);
195 void gst_rtsp_wfd_client_set_video_cea_resolution(GstRTSPWFDClient *client, guint64 res);
196 void gst_rtsp_wfd_client_set_video_vesa_resolution(GstRTSPWFDClient *client, guint64 res);
197 void gst_rtsp_wfd_client_set_video_hh_resolution(GstRTSPWFDClient *client, guint64 res);
198 void gst_rtsp_wfd_client_set_video_profile(GstRTSPWFDClient *client, guint profile);
199 void gst_rtsp_wfd_client_set_video_level(GstRTSPWFDClient *client, guint level);
200 void gst_rtsp_wfd_client_set_video_latency(GstRTSPWFDClient *client, guint latency);
201 void gst_rtsp_wfd_client_set_video_max_height(GstRTSPWFDClient *client, guint32 height);
202 void gst_rtsp_wfd_client_set_video_max_width(GstRTSPWFDClient *client, guint32 width);
203 void gst_rtsp_wfd_client_set_video_framerate(GstRTSPWFDClient *client, guint32 framerate);
204 void gst_rtsp_wfd_client_set_video_min_slice_size(GstRTSPWFDClient *client, guint32 slice_size);
205 void gst_rtsp_wfd_client_set_video_slice_enc_params(GstRTSPWFDClient *client, guint32 enc_params);
206 void gst_rtsp_wfd_client_set_video_framerate_control(GstRTSPWFDClient *client, guint framerate);
207 void gst_rtsp_wfd_client_set_rtp_port0(GstRTSPWFDClient *client, guint32 port);
208 void gst_rtsp_wfd_client_set_rtp_port1(GstRTSPWFDClient *client, guint32 port);
210 gchar *gst_rtsp_wfd_client_get_sink_user_agent(GstRTSPWFDClient *client);
213 * GstRTSPWFDClientSessionFilterFunc:
214 * @client: a #GstRTSPWFDClient object
215 * @sess: a #GstRTSPSession in @client
216 * @user_data: user data that has been given to gst_rtsp_wfd_client_session_filter()
218 * This function will be called by the gst_rtsp_wfd_client_session_filter(). An
219 * implementation should return a value of #GstRTSPFilterResult.
221 * When this function returns #GST_RTSP_FILTER_REMOVE, @sess will be removed
224 * A return value of #GST_RTSP_FILTER_KEEP will leave @sess untouched in
227 * A value of #GST_RTSP_FILTER_REF will add @sess to the result #GList of
228 * gst_rtsp_wfd_client_session_filter().
230 * Returns: a #GstRTSPFilterResult.
232 typedef GstRTSPFilterResult (*GstRTSPWFDClientSessionFilterFunc) (GstRTSPWFDClient *client,
233 GstRTSPSession *sess,
240 #endif /* __GST_RTSP_WFD_CLIENT_H__ */