/* add the new session header for new session ids */
if (session) {
- gchar *str;
-
- if (session->timeout != 60)
- str =
- g_strdup_printf ("%s; timeout=%d", session->sessionid,
- session->timeout);
- else
- str = g_strdup (session->sessionid);
-
- gst_rtsp_message_take_header (response, GST_RTSP_HDR_SESSION, str);
+ gst_rtsp_message_take_header (response, GST_RTSP_HDR_SESSION,
+ gst_rtsp_session_get_header (session));
}
if (gst_debug_category_get_threshold (rtsp_client_debug) >= GST_LEVEL_LOG) {
}
/**
+ * gst_rtsp_session_get_header:
+ * @session: a #GstRTSPSession
+ *
+ * Get the string that can be placed in the Session header field.
+ *
+ * Returns: (transfer full): the Session header of @session. g_free() after usage.
+ */
+gchar *
+gst_rtsp_session_get_header (GstRTSPSession * session)
+{
+ gchar *result;
+
+ g_return_val_if_fail (GST_IS_RTSP_SESSION (session), NULL);
+
+ if (session->timeout != 60)
+ result = g_strdup_printf ("%s; timeout=%d", session->sessionid,
+ session->timeout);
+ else
+ result = g_strdup (session->sessionid);
+
+ return result;
+}
+
+/**
* gst_rtsp_session_set_timeout:
* @session: a #GstRTSPSession
* @timeout: the new timeout
const gchar * gst_rtsp_session_get_sessionid (GstRTSPSession *session);
+gchar * gst_rtsp_session_get_header (GstRTSPSession *session);
+
void gst_rtsp_session_set_timeout (GstRTSPSession *session, guint timeout);
guint gst_rtsp_session_get_timeout (GstRTSPSession *session);