*
* You should have received a copy of the GNU Library General Public
* License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * Free Software Foundation, Inc., 51 Franklin St, Fifth Floor,
+ * Boston, MA 02110-1301, USA.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
#include "gstrtspdefs.h"
-#ifdef G_OS_WIN32
-#include <winsock2.h>
-#else
-#include <netdb.h>
-#endif
-
struct rtsp_header
{
const gchar *name;
/* Since 0.10.36 */
{"RTCP-Interval", FALSE},
+ /* Since 1.4 */
+ {"KeyMgmt", FALSE},
+
{NULL, FALSE}
};
"Only aggregate operation allowed");
DEF_STATUS (GST_RTSP_STS_UNSUPPORTED_TRANSPORT, "Unsupported transport");
DEF_STATUS (GST_RTSP_STS_DESTINATION_UNREACHABLE, "Destination unreachable");
+ DEF_STATUS (GST_RTSP_STS_KEY_MANAGEMENT_FAILURE, "Key management failure");
DEF_STATUS (GST_RTSP_STS_INTERNAL_SERVER_ERROR, "Internal Server Error");
DEF_STATUS (GST_RTSP_STS_NOT_IMPLEMENTED, "Not Implemented");
DEF_STATUS (GST_RTSP_STS_BAD_GATEWAY, "Bad Gateway");
switch (result) {
case GST_RTSP_OK:
return g_strdup ("OK");
-#ifdef G_OS_WIN32
- case GST_RTSP_ESYS:
- case GST_RTSP_ENET:
- {
- gchar *res, *msg;
- msg = g_win32_error_message (WSAGetLastError ());
- if (result == GST_RTSP_ESYS)
- res = g_strdup_printf ("System error: %s", msg);
- else
- res = g_strdup_printf ("Network error: %s", msg);
- g_free (msg);
- return res;
- }
-#else
case GST_RTSP_ESYS:
- return g_strdup_printf ("System error: %s", g_strerror (errno));
+ return g_strdup ("System error");
case GST_RTSP_ENET:
- return g_strdup_printf ("Network error: %s", hstrerror (h_errno));
-#endif
+ return g_strdup ("Network error");
case GST_RTSP_ERROR:
return g_strdup ("Generic error");
case GST_RTSP_EINVAL:
* Convert @options to a string.
*
* Returns: a new string of @options. g_free() after usage.
- *
- * Since: 0.10.23
*/
gchar *
gst_rtsp_options_as_text (GstRTSPMethod options)
}
/**
+ * gst_rtsp_options_from_text:
+ * @options: a comma separated list of options
+ *
+ * Convert the comma separated list @options to a #GstRTSPMethod bitwise or
+ * of methods. This functions is the reverse of gst_rtsp_options_as_text().
+ *
+ * Returns: a #GstRTSPMethod
+ *
+ * Since: 1.2
+ */
+GstRTSPMethod
+gst_rtsp_options_from_text (const gchar * options)
+{
+ GstRTSPMethod methods;
+ gchar **ostr;
+ gint i;
+
+ /* The string is like:
+ * OPTIONS, DESCRIBE, ANNOUNCE, PLAY, SETUP, ...
+ */
+ ostr = g_strsplit (options, ",", 0);
+
+ methods = 0;
+ for (i = 0; ostr[i]; i++) {
+ gchar *stripped;
+ GstRTSPMethod method;
+
+ stripped = g_strstrip (ostr[i]);
+ method = gst_rtsp_find_method (stripped);
+
+ /* keep bitfield of supported methods */
+ if (method != GST_RTSP_INVALID)
+ methods |= method;
+ }
+ g_strfreev (ostr);
+
+ return methods;
+}
+
+/**
* gst_rtsp_header_allow_multiple:
* @field: a #GstRTSPHeaderField
*
* Check whether @field may appear multiple times in a message.
*
* Returns: %TRUE if multiple headers are allowed.
- *
- * Since: 0.10.25
*/
gboolean
gst_rtsp_header_allow_multiple (GstRTSPHeaderField field)