Initial release including wifi display based on gst-rtsp-server-1.4.1
[platform/upstream/gstreamer.git] / gst / rtsp-server / from_upstream.diff
1 diff -urN /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/Makefile.am ./Makefile.am
2 --- /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/Makefile.am    2014-01-13 01:50:54.000000000 +0900
3 +++ ./Makefile.am       2015-01-15 16:49:47.091243189 +0900
4 @@ -7,6 +7,7 @@
5                 rtsp-thread-pool.h \
6                 rtsp-media.h \
7                 rtsp-media-factory.h \
8 +               rtsp-media-factory-wfd.h \
9                 rtsp-media-factory-uri.h \
10                 rtsp-mount-points.h \
11                 rtsp-permissions.h \
12 @@ -16,8 +17,11 @@
13                 rtsp-session-media.h \
14                 rtsp-session-pool.h \
15                 rtsp-token.h \
16 +               rtsp-client-wfd.h \
17                 rtsp-client.h \
18 -               rtsp-server.h
19 +               rtsp-server-wfd.h \
20 +               rtsp-server.h \
21 +               gstwfdmessage.h
22  
23  c_sources = \
24         rtsp-auth.c \
25 @@ -28,6 +32,7 @@
26         rtsp-thread-pool.c \
27         rtsp-media.c \
28         rtsp-media-factory.c \
29 +       rtsp-media-factory-wfd.c \
30         rtsp-media-factory-uri.c \
31         rtsp-mount-points.c \
32         rtsp-permissions.c \
33 @@ -37,7 +42,10 @@
34         rtsp-session-media.c \
35         rtsp-session-pool.c \
36         rtsp-token.c \
37 +       gstwfdmessage.c \
38 +       rtsp-client-wfd.c \
39         rtsp-client.c \
40 +       rtsp-server-wfd.c \
41         rtsp-server.c
42  
43  noinst_HEADERS = 
44 diff -urN /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/rtsp-client.c ./rtsp-client.c
45 --- /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/rtsp-client.c  2014-02-10 21:43:30.000000000 +0900
46 +++ ./rtsp-client.c     2015-02-23 16:33:37.059801061 +0900
47 @@ -137,6 +137,12 @@
48      GstRTSPContext * ctx);
49  static gchar *default_make_path_from_uri (GstRTSPClient * client,
50      const GstRTSPUrl * uri);
51 +static gboolean default_handle_options_request (GstRTSPClient * client,
52 +    GstRTSPContext * ctx);
53 +static gboolean default_handle_set_param_request (GstRTSPClient * client,
54 +    GstRTSPContext * ctx);
55 +static gboolean default_handle_get_param_request (GstRTSPClient * client,
56 +    GstRTSPContext * ctx);
57  
58  G_DEFINE_TYPE (GstRTSPClient, gst_rtsp_client, G_TYPE_OBJECT);
59  
60 @@ -159,6 +165,9 @@
61    klass->params_set = default_params_set;
62    klass->params_get = default_params_get;
63    klass->make_path_from_uri = default_make_path_from_uri;
64 +  klass->handle_options_request = default_handle_options_request;
65 +  klass->handle_set_param_request = default_handle_set_param_request;
66 +  klass->handle_get_param_request = default_handle_get_param_request;
67  
68    g_object_class_install_property (gobject_class, PROP_SESSION_POOL,
69        g_param_spec_object ("session-pool", "Session Pool",
70 @@ -869,7 +878,7 @@
71  }
72  
73  static gboolean
74 -handle_get_param_request (GstRTSPClient * client, GstRTSPContext * ctx)
75 +default_handle_get_param_request (GstRTSPClient * client, GstRTSPContext * ctx)
76  {
77    GstRTSPResult res;
78    guint8 *data;
79 @@ -906,7 +915,7 @@
80  }
81  
82  static gboolean
83 -handle_set_param_request (GstRTSPClient * client, GstRTSPContext * ctx)
84 +default_handle_set_param_request (GstRTSPClient * client, GstRTSPContext * ctx)
85  {
86    GstRTSPResult res;
87    guint8 *data;
88 @@ -1462,6 +1471,8 @@
89    if (media == NULL)
90      goto media_not_found_no_reply;
91  
92 +  /* FIXME-WFD : wfd url problem */
93 +#if 0
94    if (path[matched] == '\0')
95      goto control_not_found;
96  
97 @@ -1469,6 +1480,9 @@
98    path[matched] = '\0';
99    /* control is remainder */
100    control = &path[matched + 1];
101 +#else
102 +  control = g_strdup ("stream=0");
103 +#endif
104  
105    /* find the stream now using the control part */
106    stream = gst_rtsp_media_find_stream (media, control);
107 @@ -1534,6 +1548,10 @@
108    /* create and serialize the server transport */
109    st = make_server_transport (client, ctx, ct);
110    trans_str = gst_rtsp_transport_as_text (st);
111 +
112 +  /* FIXME-WFD : Temporarily force to set profile string */
113 +  trans_str = g_strjoinv ("RTP/AVP/UDP", g_strsplit (trans_str, "RTP/AVP", -1));
114 +
115    gst_rtsp_transport_free (st);
116  
117    /* construct the response now */
118 @@ -1820,7 +1838,7 @@
119  }
120  
121  static gboolean
122 -handle_options_request (GstRTSPClient * client, GstRTSPContext * ctx)
123 +default_handle_options_request (GstRTSPClient * client, GstRTSPContext * ctx)
124  {
125    GstRTSPMethod options;
126    gchar *str;
127 @@ -1906,6 +1924,9 @@
128    GstRTSPContext sctx = { NULL }, *ctx;
129    GstRTSPMessage response = { 0 };
130    gchar *sessid;
131 +  GstRTSPClientClass *klass;
132 +
133 +  klass = GST_RTSP_CLIENT_GET_CLASS (client);
134  
135    if (!(ctx = gst_rtsp_context_get_current ())) {
136      ctx = &sctx;
137 @@ -1995,7 +2016,7 @@
138    /* now see what is asked and dispatch to a dedicated handler */
139    switch (method) {
140      case GST_RTSP_OPTIONS:
141 -      handle_options_request (client, ctx);
142 +      klass->handle_options_request (client, ctx);
143        break;
144      case GST_RTSP_DESCRIBE:
145        handle_describe_request (client, ctx);
146 @@ -2013,10 +2034,10 @@
147        handle_teardown_request (client, ctx);
148        break;
149      case GST_RTSP_SET_PARAMETER:
150 -      handle_set_param_request (client, ctx);
151 +      klass->handle_set_param_request (client, ctx);
152        break;
153      case GST_RTSP_GET_PARAMETER:
154 -      handle_get_param_request (client, ctx);
155 +      klass->handle_get_param_request (client, ctx);
156        break;
157      case GST_RTSP_ANNOUNCE:
158      case GST_RTSP_RECORD:
159 diff -urN /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/rtsp-client.h ./rtsp-client.h
160 --- /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/rtsp-client.h  2014-01-13 01:50:54.000000000 +0900
161 +++ ./rtsp-client.h     2015-02-17 15:57:28.047757756 +0900
162 @@ -102,6 +102,10 @@
163    GstRTSPResult   (*params_get) (GstRTSPClient *client, GstRTSPContext *ctx);
164    gchar *         (*make_path_from_uri) (GstRTSPClient *client, const GstRTSPUrl *uri);
165  
166 +  gboolean        (*handle_options_request) (GstRTSPClient * client, GstRTSPContext * ctx);
167 +  gboolean        (*handle_set_param_request) (GstRTSPClient * client, GstRTSPContext * ctx);
168 +  gboolean        (*handle_get_param_request) (GstRTSPClient * client, GstRTSPContext * ctx);
169 +
170    /* signals */
171    void     (*closed)                  (GstRTSPClient *client);
172    void     (*new_session)             (GstRTSPClient *client, GstRTSPSession *session);
173 @@ -177,7 +181,7 @@
174                                                                  GstRTSPSession *sess,
175                                                                  gpointer user_data);
176  
177 -GList *                gst_rtsp_client_session_filter    (GstRTSPClient *client,
178 +GList *               gst_rtsp_client_session_filter    (GstRTSPClient *client,
179                                                            GstRTSPClientSessionFilterFunc func,
180                                                            gpointer user_data);
181  
182 diff -urN /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/rtsp-media.c ./rtsp-media.c
183 --- /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/rtsp-media.c   2014-02-22 00:11:11.000000000 +0900
184 +++ ./rtsp-media.c      2015-02-17 15:57:25.483757666 +0900
185 @@ -241,10 +241,12 @@
186            "If this media pipeline can be reused after an unprepare",
187            DEFAULT_REUSABLE, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
188  
189 +#ifdef GST_TYPE_RTSP_PROFILE
190    g_object_class_install_property (gobject_class, PROP_PROFILES,
191        g_param_spec_flags ("profiles", "Profiles",
192            "Allowed transfer profiles", GST_TYPE_RTSP_PROFILE,
193            DEFAULT_PROFILES, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
194 +#endif
195  
196    g_object_class_install_property (gobject_class, PROP_PROTOCOLS,
197        g_param_spec_flags ("protocols", "Protocols",
198 diff -urN /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/rtsp-stream.c ./rtsp-stream.c
199 --- /home/zzoon.ko/opensrc/tarball/gst-rtsp-server-1.2.3/gst/rtsp-server/rtsp-stream.c  2014-02-22 00:11:11.000000000 +0900
200 +++ ./rtsp-stream.c     2015-02-17 15:57:25.527757667 +0900
201 @@ -173,10 +173,12 @@
202            "The control string for this stream", DEFAULT_CONTROL,
203            G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
204  
205 +#ifdef GST_TYPE_RTSP_PROFILE
206    g_object_class_install_property (gobject_class, PROP_PROFILES,
207        g_param_spec_flags ("profiles", "Profiles",
208            "Allowed transfer profiles", GST_TYPE_RTSP_PROFILE,
209            DEFAULT_PROFILES, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
210 +#endif
211  
212    g_object_class_install_property (gobject_class, PROP_PROTOCOLS,
213        g_param_spec_flags ("protocols", "Protocols",
214 @@ -1001,6 +1003,9 @@
215        inetaddr = g_inet_address_new_any (family);
216    }
217  
218 +  /* FIXME-WFD : Force to set 19000 as port number */
219 +  tmp_rtp = 19000;
220 +
221    rtp_sockaddr = g_inet_socket_address_new (inetaddr, tmp_rtp);
222    if (!g_socket_bind (rtp_socket, rtp_sockaddr, FALSE, NULL)) {
223      g_object_unref (rtp_sockaddr);
224 @@ -1171,9 +1176,14 @@
225        G_SOCKET_FAMILY_IPV4, priv->udpsrc_v4, priv->udpsink,
226        &priv->server_port_v4, &priv->server_addr_v4);
227  
228 +  /* FIXME-WFD : force to disable ipv6 mode in WFD mode */
229 +#if 0
230    priv->have_ipv6 = alloc_ports_one_family (priv->pool, priv->buffer_size,
231        G_SOCKET_FAMILY_IPV6, priv->udpsrc_v6, priv->udpsink,
232        &priv->server_port_v6, &priv->server_addr_v6);
233 +#else
234 +  priv->have_ipv6 = FALSE;
235 +#endif
236  
237    return priv->have_ipv4 || priv->have_ipv6;
238  }
239 @@ -1552,6 +1562,8 @@
240  
241    /* get the session */
242    g_signal_emit_by_name (rtpbin, "get-internal-session", idx, &priv->session);
243 +  GST_DEBUG("zzoon unref internal session");
244 +  g_object_unref(priv->session);
245  
246    g_signal_connect (priv->session, "on-new-ssrc", (GCallback) on_new_ssrc,
247        stream);
248 @@ -1841,6 +1853,7 @@
249    gst_object_unref (priv->send_src[1]);
250    priv->send_src[1] = NULL;
251  
252 +  GST_DEBUG("Unref rtp session");
253    g_object_unref (priv->session);
254    priv->session = NULL;
255    if (priv->caps)