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 gint supported_methods;
86 GstRTSPWFDClientPrivate *priv;
87 gpointer _gst_reserved[GST_PADDING];
91 * GstRTSPWFDClientClass:
92 * @create_sdp: called when the SDP needs to be created for media.
93 * @configure_client_media: called when the stream in media needs to be configured.
94 * The default implementation will configure the blocksize on the payloader when
95 * spcified in the request headers.
96 * @configure_client_transport: called when the client transport needs to be
98 * @params_set: set parameters. This function should also initialize the
99 * RTSP response(ctx->response) via a call to gst_rtsp_message_init_response()
100 * @params_get: get parameters. This function should also initialize the
101 * RTSP response(ctx->response) via a call to gst_rtsp_message_init_response()
103 * The client class structure.
105 struct _GstRTSPWFDClientClass {
106 GstRTSPClientClass parent_class;
108 GstRTSPResult (*prepare_resource) (GstRTSPWFDClient *client, GstRTSPContext *ctx);
109 GstRTSPResult (*confirm_resource) (GstRTSPWFDClient *client, GstRTSPContext *ctx);
112 void (*wfd_options_request) (GstRTSPWFDClient *client, GstRTSPContext *ctx);
113 void (*wfd_get_param_request) (GstRTSPWFDClient *client, GstRTSPContext *ctx);
114 void (*wfd_keep_alive_fail) (GstRTSPWFDClient *client);
115 void (*wfd_playing_done) (GstRTSPWFDClient *client);
118 gpointer _gst_reserved[GST_PADDING_LARGE];
121 GType gst_rtsp_wfd_client_get_type (void);
123 GstRTSPWFDClient * gst_rtsp_wfd_client_new (void);
125 void gst_rtsp_wfd_client_set_host_address (
126 GstRTSPWFDClient *client, const gchar * address);
128 void gst_rtsp_wfd_client_start_wfd(GstRTSPWFDClient *client);
129 GstRTSPResult gst_rtsp_wfd_client_trigger_request (
130 GstRTSPWFDClient * client, GstWFDTriggerType type);
132 GstRTSPResult gst_rtsp_wfd_client_set_video_supported_resolution (
133 GstRTSPWFDClient * client, guint64 supported_reso);
134 GstRTSPResult gst_rtsp_wfd_client_set_video_native_resolution (
135 GstRTSPWFDClient * client, guint64 native_reso);
136 GstRTSPResult gst_rtsp_wfd_client_set_audio_codec (
137 GstRTSPWFDClient * client, guint8 audio_codec);
138 GstRTSPResult gst_prepare_request (GstRTSPWFDClient * client,
139 GstRTSPMessage * request, GstRTSPMethod method, gchar * url);
140 void gst_send_request (GstRTSPWFDClient * client,
141 GstRTSPSession * session, GstRTSPMessage * request);
143 guint gst_rtsp_wfd_client_get_audio_codec(GstRTSPWFDClient *client);
144 guint gst_rtsp_wfd_client_get_audio_freq(GstRTSPWFDClient *client);
145 guint gst_rtsp_wfd_client_get_audio_channels(GstRTSPWFDClient *client);
146 guint gst_rtsp_wfd_client_get_audio_bit_width(GstRTSPWFDClient *client);
147 guint gst_rtsp_wfd_client_get_audio_latency(GstRTSPWFDClient *client);
148 guint gst_rtsp_wfd_client_get_video_codec(GstRTSPWFDClient *client);
149 guint gst_rtsp_wfd_client_get_video_native(GstRTSPWFDClient *client);
150 guint64 gst_rtsp_wfd_client_get_video_native_resolution(GstRTSPWFDClient *client);
151 guint64 gst_rtsp_wfd_client_get_video_cea_resolution(GstRTSPWFDClient *client);
152 guint64 gst_rtsp_wfd_client_get_video_vesa_resolution(GstRTSPWFDClient *client);
153 guint64 gst_rtsp_wfd_client_get_video_hh_resolution(GstRTSPWFDClient *client);
154 guint gst_rtsp_wfd_client_get_video_profile(GstRTSPWFDClient *client);
155 guint gst_rtsp_wfd_client_get_video_level(GstRTSPWFDClient *client);
156 guint gst_rtsp_wfd_client_get_video_latency(GstRTSPWFDClient *client);
157 guint32 gst_rtsp_wfd_client_get_video_max_height(GstRTSPWFDClient *client);
158 guint32 gst_rtsp_wfd_client_get_video_max_width(GstRTSPWFDClient *client);
159 guint32 gst_rtsp_wfd_client_get_video_framerate(GstRTSPWFDClient *client);
160 guint32 gst_rtsp_wfd_client_get_video_min_slice_size(GstRTSPWFDClient *client);
161 guint32 gst_rtsp_wfd_client_get_video_slice_enc_params(GstRTSPWFDClient *client);
162 guint gst_rtsp_wfd_client_get_video_framerate_control(GstRTSPWFDClient *client);
163 guint32 gst_rtsp_wfd_client_get_rtp_port0(GstRTSPWFDClient *client);
164 guint32 gst_rtsp_wfd_client_get_rtp_port1(GstRTSPWFDClient *client);
165 gboolean gst_rtsp_wfd_client_get_edid_supported(GstRTSPWFDClient *client);
166 guint32 gst_rtsp_wfd_client_get_edid_hresolution(GstRTSPWFDClient *client);
167 guint32 gst_rtsp_wfd_client_get_edid_vresolution(GstRTSPWFDClient *client);
168 gboolean gst_rtsp_wfd_client_get_protection_enabled(GstRTSPWFDClient *client);
170 void gst_rtsp_wfd_client_set_audio_freq(GstRTSPWFDClient *client, guint freq);
171 void gst_rtsp_wfd_client_set_edid_supported(GstRTSPWFDClient *client, gboolean supported);
172 void gst_rtsp_wfd_client_set_edid_hresolution(GstRTSPWFDClient *client, guint32 reso);
173 void gst_rtsp_wfd_client_set_edid_vresolution(GstRTSPWFDClient *client, guint32 reso);
174 void gst_rtsp_wfd_client_set_protection_enabled(GstRTSPWFDClient *client, gboolean enable);
175 void gst_rtsp_wfd_client_set_hdcp_version(GstRTSPWFDClient *client, GstWFDHDCPProtection version);
176 void gst_rtsp_wfd_client_set_hdcp_port(GstRTSPWFDClient *client, guint32 port);
177 void gst_rtsp_wfd_client_set_keep_alive_flag(GstRTSPWFDClient *client, gboolean flag);
178 void gst_rtsp_wfd_client_set_aud_codec(GstRTSPWFDClient *client, guint acodec);
179 void gst_rtsp_wfd_client_set_audio_channels(GstRTSPWFDClient *client, guint channels);
180 void gst_rtsp_wfd_client_set_audio_bit_width(GstRTSPWFDClient *client, guint bwidth);
181 void gst_rtsp_wfd_client_set_audio_latency(GstRTSPWFDClient *client, guint latency);
182 void gst_rtsp_wfd_client_set_video_codec(GstRTSPWFDClient *client, guint vcodec);
183 void gst_rtsp_wfd_client_set_video_native(GstRTSPWFDClient *client, guint native);
184 void gst_rtsp_wfd_client_set_vid_native_resolution(GstRTSPWFDClient *client, guint64 res);
185 void gst_rtsp_wfd_client_set_video_cea_resolution(GstRTSPWFDClient *client, guint64 res);
186 void gst_rtsp_wfd_client_set_video_vesa_resolution(GstRTSPWFDClient *client, guint64 res);
187 void gst_rtsp_wfd_client_set_video_hh_resolution(GstRTSPWFDClient *client, guint64 res);
188 void gst_rtsp_wfd_client_set_video_profile(GstRTSPWFDClient *client, guint profile);
189 void gst_rtsp_wfd_client_set_video_level(GstRTSPWFDClient *client, guint level);
190 void gst_rtsp_wfd_client_set_video_latency(GstRTSPWFDClient *client, guint latency);
191 void gst_rtsp_wfd_client_set_video_max_height(GstRTSPWFDClient *client, guint32 height);
192 void gst_rtsp_wfd_client_set_video_max_width(GstRTSPWFDClient *client, guint32 width);
193 void gst_rtsp_wfd_client_set_video_framerate(GstRTSPWFDClient *client, guint32 framerate);
194 void gst_rtsp_wfd_client_set_video_min_slice_size(GstRTSPWFDClient *client, guint32 slice_size);
195 void gst_rtsp_wfd_client_set_video_slice_enc_params(GstRTSPWFDClient *client, guint32 enc_params);
196 void gst_rtsp_wfd_client_set_video_framerate_control(GstRTSPWFDClient *client, guint framerate);
197 void gst_rtsp_wfd_client_set_rtp_port0(GstRTSPWFDClient *client, guint32 port);
198 void gst_rtsp_wfd_client_set_rtp_port1(GstRTSPWFDClient *client, guint32 port);
201 * GstRTSPWFDClientSessionFilterFunc:
202 * @client: a #GstRTSPWFDClient object
203 * @sess: a #GstRTSPSession in @client
204 * @user_data: user data that has been given to gst_rtsp_wfd_client_session_filter()
206 * This function will be called by the gst_rtsp_wfd_client_session_filter(). An
207 * implementation should return a value of #GstRTSPFilterResult.
209 * When this function returns #GST_RTSP_FILTER_REMOVE, @sess will be removed
212 * A return value of #GST_RTSP_FILTER_KEEP will leave @sess untouched in
215 * A value of #GST_RTSP_FILTER_REF will add @sess to the result #GList of
216 * gst_rtsp_wfd_client_session_filter().
218 * Returns: a #GstRTSPFilterResult.
220 typedef GstRTSPFilterResult (*GstRTSPWFDClientSessionFilterFunc) (GstRTSPWFDClient *client,
221 GstRTSPSession *sess,
228 #endif /* __GST_RTSP_WFD_CLIENT_H__ */