client: expose connection
[platform/upstream/gstreamer.git] / gst / rtsp-server / rtsp-client.c
index 1bb43c1..af07253 100644 (file)
@@ -859,6 +859,7 @@ handle_play_request (GstRTSPClient * client, GstRTSPClientState * state)
   GstRTSPTimeRange *range;
   GstRTSPResult res;
   GstRTSPState rtspstate;
+  GstRTSPRangeUnit unit = GST_RTSP_RANGE_NPT;
 
   if (!(session = state->session))
     goto no_session;
@@ -882,6 +883,7 @@ handle_play_request (GstRTSPClient * client, GstRTSPClientState * state)
     if (gst_rtsp_range_parse (str, &range) == GST_RTSP_OK) {
       /* we have a range, seek to the position */
       gst_rtsp_media_seek (gst_rtsp_session_media_get_media (media), range);
+      unit = range->unit;
       gst_rtsp_range_free (range);
     }
   }
@@ -943,7 +945,7 @@ handle_play_request (GstRTSPClient * client, GstRTSPClientState * state)
   /* add the range */
   str =
       gst_rtsp_media_get_range_string (gst_rtsp_session_media_get_media (media),
-      TRUE);
+      TRUE, unit);
   gst_rtsp_message_take_header (state->response, GST_RTSP_HDR_RANGE, str);
 
   send_response (client, session, state->response, FALSE);
@@ -2026,6 +2028,50 @@ gst_rtsp_client_get_auth (GstRTSPClient * client)
 }
 
 /**
+ * gst_rtsp_client_get_uri:
+ * @client: a #GstRTSPClient
+ *
+ * Get the #GstRTSPUrl of @client.
+ *
+ * Returns: (transfer full): the #GstRTSPUrl of @client. Free with
+ * gst_rtsp_url_free () after usage.
+ */
+GstRTSPUrl *
+gst_rtsp_client_get_uri (GstRTSPClient * client)
+{
+  GstRTSPClientPrivate *priv;
+  GstRTSPUrl *result = NULL;
+
+  g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), NULL);
+
+  priv = client->priv;
+
+  g_mutex_lock (&priv->lock);
+  if (priv->uri != NULL)
+    result = gst_rtsp_url_copy (priv->uri);
+  g_mutex_unlock (&priv->lock);
+
+  return result;
+}
+
+/**
+ * gst_rtsp_client_get_connection:
+ * @client: a #GstRTSPClient
+ *
+ * Get the #GstRTSPConnection of @client.
+ *
+ * Returns: (transfer none): the #GstRTSPConnection of @client.
+ * The connection object returned remains valid until the client is freed.
+ */
+GstRTSPConnection *
+gst_rtsp_client_get_connection (GstRTSPClient * client)
+{
+  g_return_val_if_fail (GST_IS_RTSP_CLIENT (client), NULL);
+
+  return client->priv->connection;
+}
+
+/**
  * gst_rtsp_client_set_send_func:
  * @client: a #GstRTSPClient
  * @func: a #GstRTSPClientSendFunc