Commit 19e0dd31 authored by Wim Taymans's avatar Wim Taymans
Browse files

Move SDP and RTSP from helper objects in -good to a reusable library.

Original commit message from CVS:
* configure.ac:
* gst-libs/gst/Makefile.am:
* gst-libs/gst/rtsp/Makefile.am:
* gst-libs/gst/rtsp/gstrtspbase64.c: (gst_rtsp_base64_encode):
* gst-libs/gst/rtsp/gstrtspbase64.h:
* gst-libs/gst/rtsp/gstrtspconnection.c: (inet_aton),
(gst_rtsp_connection_create), (gst_rtsp_connection_connect),
(add_auth_header), (add_date_header), (gst_rtsp_connection_write),
(gst_rtsp_connection_send), (read_line), (read_string), (read_key),
(parse_response_status), (parse_request_line), (parse_line),
(gst_rtsp_connection_read), (read_body),
(gst_rtsp_connection_receive), (gst_rtsp_connection_close),
(gst_rtsp_connection_free), (gst_rtsp_connection_next_timeout),
(gst_rtsp_connection_reset_timeout), (gst_rtsp_connection_flush),
(gst_rtsp_connection_set_auth):
* gst-libs/gst/rtsp/gstrtspconnection.h:
* gst-libs/gst/rtsp/gstrtspdefs.c: (rtsp_init_status),
(gst_rtsp_strresult), (gst_rtsp_method_as_text),
(gst_rtsp_version_as_text), (gst_rtsp_header_as_text),
(gst_rtsp_status_as_text), (gst_rtsp_find_header_field),
(gst_rtsp_find_method):
* gst-libs/gst/rtsp/gstrtspdefs.h:
* gst-libs/gst/rtsp/gstrtspmessage.c: (key_value_foreach),
(gst_rtsp_message_new), (gst_rtsp_message_init),
(gst_rtsp_message_new_request), (gst_rtsp_message_init_request),
(gst_rtsp_message_new_response), (gst_rtsp_message_init_response),
(gst_rtsp_message_init_data), (gst_rtsp_message_unset),
(gst_rtsp_message_free), (gst_rtsp_message_add_header),
(gst_rtsp_message_remove_header), (gst_rtsp_message_get_header),
(gst_rtsp_message_append_headers), (gst_rtsp_message_set_body),
(gst_rtsp_message_take_body), (gst_rtsp_message_get_body),
(gst_rtsp_message_steal_body), (dump_mem), (dump_key_value),
(gst_rtsp_message_dump):
* gst-libs/gst/rtsp/gstrtspmessage.h:
* gst-libs/gst/rtsp/gstrtsprange.c: (parse_npt_time),
(parse_npt_range), (parse_clock_range), (parse_smpte_range),
(gst_rtsp_range_parse), (gst_rtsp_range_free):
* gst-libs/gst/rtsp/gstrtsprange.h:
* gst-libs/gst/rtsp/gstrtsptransport.c: (gst_rtsp_transport_new),
(gst_rtsp_transport_init), (gst_rtsp_transport_get_mime),
(gst_rtsp_transport_get_manager), (parse_mode), (parse_range),
(range_as_text), (rtsp_transport_mode_as_text),
(rtsp_transport_profile_as_text), (rtsp_transport_ltrans_as_text),
(gst_rtsp_transport_parse), (gst_rtsp_transport_as_text),
(gst_rtsp_transport_free):
* gst-libs/gst/rtsp/gstrtsptransport.h:
* gst-libs/gst/rtsp/gstrtspurl.c: (gst_rtsp_url_parse),
(gst_rtsp_url_free), (gst_rtsp_url_set_port),
(gst_rtsp_url_get_port), (gst_rtsp_url_get_request_uri):
* gst-libs/gst/rtsp/gstrtspurl.h:
* gst-libs/gst/sdp/Makefile.am:
* gst-libs/gst/sdp/gstsdp.h:
* gst-libs/gst/sdp/gstsdpmessage.c: (gst_sdp_origin_init),
(gst_sdp_connection_init), (gst_sdp_bandwidth_init),
(gst_sdp_time_init), (gst_sdp_zone_init), (gst_sdp_key_init),
(gst_sdp_attribute_init), (gst_sdp_message_new),
(gst_sdp_message_init), (gst_sdp_message_uninit),
(gst_sdp_message_free), (gst_sdp_media_new), (gst_sdp_media_init),
(gst_sdp_media_uninit), (gst_sdp_media_free),
(gst_sdp_message_set_origin), (gst_sdp_message_get_origin),
(gst_sdp_message_set_connection), (gst_sdp_message_get_connection),
(gst_sdp_message_add_bandwidth), (gst_sdp_message_add_time),
(gst_sdp_message_add_zone), (gst_sdp_message_set_key),
(gst_sdp_message_get_key), (gst_sdp_message_get_attribute_val_n),
(gst_sdp_message_get_attribute_val),
(gst_sdp_message_add_attribute), (gst_sdp_message_add_media),
(gst_sdp_media_add_attribute), (gst_sdp_media_add_bandwidth),
(gst_sdp_media_add_format), (gst_sdp_media_get_attribute),
(gst_sdp_media_get_attribute_val_n),
(gst_sdp_media_get_attribute_val), (gst_sdp_media_get_format),
(read_string), (read_string_del), (gst_sdp_parse_line),
(gst_sdp_message_parse_buffer), (print_media),
(gst_sdp_message_dump):
* gst-libs/gst/sdp/gstsdpmessage.h:
* pkgconfig/gstreamer-plugins-base-uninstalled.pc.in:
Move SDP and RTSP from helper objects in -good to a reusable library.
Use a proper gst_ namespace.
parent 9137e989
2007-07-24 Wim Taymans <wim.taymans@gmail.com>
* configure.ac:
* gst-libs/gst/Makefile.am:
* gst-libs/gst/rtsp/Makefile.am:
* gst-libs/gst/rtsp/gstrtspbase64.c: (gst_rtsp_base64_encode):
* gst-libs/gst/rtsp/gstrtspbase64.h:
* gst-libs/gst/rtsp/gstrtspconnection.c: (inet_aton),
(gst_rtsp_connection_create), (gst_rtsp_connection_connect),
(add_auth_header), (add_date_header), (gst_rtsp_connection_write),
(gst_rtsp_connection_send), (read_line), (read_string), (read_key),
(parse_response_status), (parse_request_line), (parse_line),
(gst_rtsp_connection_read), (read_body),
(gst_rtsp_connection_receive), (gst_rtsp_connection_close),
(gst_rtsp_connection_free), (gst_rtsp_connection_next_timeout),
(gst_rtsp_connection_reset_timeout), (gst_rtsp_connection_flush),
(gst_rtsp_connection_set_auth):
* gst-libs/gst/rtsp/gstrtspconnection.h:
* gst-libs/gst/rtsp/gstrtspdefs.c: (rtsp_init_status),
(gst_rtsp_strresult), (gst_rtsp_method_as_text),
(gst_rtsp_version_as_text), (gst_rtsp_header_as_text),
(gst_rtsp_status_as_text), (gst_rtsp_find_header_field),
(gst_rtsp_find_method):
* gst-libs/gst/rtsp/gstrtspdefs.h:
* gst-libs/gst/rtsp/gstrtspmessage.c: (key_value_foreach),
(gst_rtsp_message_new), (gst_rtsp_message_init),
(gst_rtsp_message_new_request), (gst_rtsp_message_init_request),
(gst_rtsp_message_new_response), (gst_rtsp_message_init_response),
(gst_rtsp_message_init_data), (gst_rtsp_message_unset),
(gst_rtsp_message_free), (gst_rtsp_message_add_header),
(gst_rtsp_message_remove_header), (gst_rtsp_message_get_header),
(gst_rtsp_message_append_headers), (gst_rtsp_message_set_body),
(gst_rtsp_message_take_body), (gst_rtsp_message_get_body),
(gst_rtsp_message_steal_body), (dump_mem), (dump_key_value),
(gst_rtsp_message_dump):
* gst-libs/gst/rtsp/gstrtspmessage.h:
* gst-libs/gst/rtsp/gstrtsprange.c: (parse_npt_time),
(parse_npt_range), (parse_clock_range), (parse_smpte_range),
(gst_rtsp_range_parse), (gst_rtsp_range_free):
* gst-libs/gst/rtsp/gstrtsprange.h:
* gst-libs/gst/rtsp/gstrtsptransport.c: (gst_rtsp_transport_new),
(gst_rtsp_transport_init), (gst_rtsp_transport_get_mime),
(gst_rtsp_transport_get_manager), (parse_mode), (parse_range),
(range_as_text), (rtsp_transport_mode_as_text),
(rtsp_transport_profile_as_text), (rtsp_transport_ltrans_as_text),
(gst_rtsp_transport_parse), (gst_rtsp_transport_as_text),
(gst_rtsp_transport_free):
* gst-libs/gst/rtsp/gstrtsptransport.h:
* gst-libs/gst/rtsp/gstrtspurl.c: (gst_rtsp_url_parse),
(gst_rtsp_url_free), (gst_rtsp_url_set_port),
(gst_rtsp_url_get_port), (gst_rtsp_url_get_request_uri):
* gst-libs/gst/rtsp/gstrtspurl.h:
* gst-libs/gst/sdp/Makefile.am:
* gst-libs/gst/sdp/gstsdp.h:
* gst-libs/gst/sdp/gstsdpmessage.c: (gst_sdp_origin_init),
(gst_sdp_connection_init), (gst_sdp_bandwidth_init),
(gst_sdp_time_init), (gst_sdp_zone_init), (gst_sdp_key_init),
(gst_sdp_attribute_init), (gst_sdp_message_new),
(gst_sdp_message_init), (gst_sdp_message_uninit),
(gst_sdp_message_free), (gst_sdp_media_new), (gst_sdp_media_init),
(gst_sdp_media_uninit), (gst_sdp_media_free),
(gst_sdp_message_set_origin), (gst_sdp_message_get_origin),
(gst_sdp_message_set_connection), (gst_sdp_message_get_connection),
(gst_sdp_message_add_bandwidth), (gst_sdp_message_add_time),
(gst_sdp_message_add_zone), (gst_sdp_message_set_key),
(gst_sdp_message_get_key), (gst_sdp_message_get_attribute_val_n),
(gst_sdp_message_get_attribute_val),
(gst_sdp_message_add_attribute), (gst_sdp_message_add_media),
(gst_sdp_media_add_attribute), (gst_sdp_media_add_bandwidth),
(gst_sdp_media_add_format), (gst_sdp_media_get_attribute),
(gst_sdp_media_get_attribute_val_n),
(gst_sdp_media_get_attribute_val), (gst_sdp_media_get_format),
(read_string), (read_string_del), (gst_sdp_parse_line),
(gst_sdp_message_parse_buffer), (print_media),
(gst_sdp_message_dump):
* gst-libs/gst/sdp/gstsdpmessage.h:
* pkgconfig/gstreamer-plugins-base-uninstalled.pc.in:
Move SDP and RTSP from helper objects in -good to a reusable library.
Use a proper gst_ namespace.
2007-07-23 Sebastian Dröge <slomo@circular-chaos.org>
 
* ext/vorbis/vorbisdec.c: (vorbis_dec_push_forward),
......@@ -646,6 +646,8 @@ gst-libs/gst/interfaces/Makefile
gst-libs/gst/netbuffer/Makefile
gst-libs/gst/riff/Makefile
gst-libs/gst/rtp/Makefile
gst-libs/gst/rtsp/Makefile
gst-libs/gst/sdp/Makefile
gst-libs/gst/tag/Makefile
gst-libs/gst/pbutils/Makefile
gst-libs/gst/video/Makefile
......
......@@ -12,6 +12,8 @@ SUBDIRS = \
pbutils \
riff \
rtp \
rtsp \
sdp \
video
noinst_HEADERS = gettext.h gst-i18n-plugin.h
libgstrtspincludedir = $(includedir)/gstreamer-@GST_MAJORMINOR@/gst/rtsp
libgstrtspinclude_HEADERS = gstrtspbase64.h \
gstrtspconnection.h \
gstrtspdefs.h \
gstrtspmessage.h \
gstrtsprange.h \
gstrtsptransport.h \
gstrtspurl.h
#gstrtspextreal.h
#gstrtspextwms.h
lib_LTLIBRARIES = libgstrtsp-@GST_MAJORMINOR@.la
libgstrtsp_@GST_MAJORMINOR@_la_SOURCES = gstrtspbase64.c \
gstrtspconnection.c \
gstrtspdefs.c \
gstrtspmessage.c \
gstrtsprange.c \
gstrtsptransport.c \
gstrtspurl.c
#gstrtspextwms.c
#rtspextreal.c
libgstrtsp_@GST_MAJORMINOR@_la_CFLAGS = $(GST_PLUGINS_BASE_CFLAGS) $(GST_BASE_CFLAGS) $(GST_CFLAGS)
libgstrtsp_@GST_MAJORMINOR@_la_LIBADD = $(GST_LIBS)
libgstrtsp_@GST_MAJORMINOR@_la_LDFLAGS = $(GST_LIB_LDFLAGS) $(GST_ALL_LDFLAGS) $(GST_LT_LDFLAGS)
/* GStreamer
* Copyright (C) <2007> Mike Smith <msmith@xiph.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* 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.
*/
#ifdef HAVE_CONFIG_H
#include "config.h"
#endif
#include "gstrtspbase64.h"
static char base64table[64] = {
'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O',
'P',
'Q', 'R', 'S', 'T', 'U', 'V', 'W', 'X', 'Y', 'Z', 'a', 'b', 'c', 'd', 'e',
'f',
'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u',
'v',
'w', 'x', 'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', '+', '/'
};
/* This isn't efficient, but it doesn't need to be */
gchar *
gst_rtsp_base64_encode (gchar * data, gint len)
{
gchar *out = g_malloc (len * 4 / 3 + 4);
gchar *result = out;
int chunk;
while (len > 0) {
chunk = (len > 3) ? 3 : len;
*out++ = base64table[(*data & 0xFC) >> 2];
*out++ = base64table[((*data & 0x03) << 4) | ((*(data + 1) & 0xF0) >> 4)];
switch (chunk) {
case 3:
*out++ =
base64table[((*(data + 1) & 0x0F) << 2) | ((*(data +
2) & 0xC0) >> 6)];
*out++ = base64table[(*(data + 2)) & 0x3F];
break;
case 2:
*out++ = base64table[((*(data + 1) & 0x0F) << 2)];
*out++ = '=';
break;
case 1:
*out++ = '=';
*out++ = '=';
break;
}
data += chunk;
len -= chunk;
}
*out = 0;
return result;
}
/* GStreamer
* Copyright (C) <2007> Mike Smith <msmith@xiph.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* 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.
*/
#ifndef __BASE64_H__
#define __BASE64_H__
#include <glib.h>
G_BEGIN_DECLS
gchar *gst_rtsp_base64_encode(gchar *data, gint len);
G_END_DECLS
#endif
This diff is collapsed.
/* GStreamer
* Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#ifndef __GST_RTSP_CONNECTION_H__
#define __GST_RTSP_CONNECTION_H__
#include <glib.h>
#include <gst/rtsp/gstrtspdefs.h>
#include <gst/rtsp/gstrtspurl.h>
#include <gst/rtsp/gstrtspmessage.h>
G_BEGIN_DECLS
typedef struct _GstRTSPConnection
{
/* URL for the connection */
GstRTSPUrl *url;
/* connection state */
gint fd;
gint control_sock[2];
gchar *ip;
/* Session state */
gint cseq; /* sequence number */
gchar session_id[512]; /* session id */
gint timeout; /* session timeout in seconds */
GTimer *timer; /* timeout timer */
/* Authentication */
GstRTSPAuthMethod auth_method;
gchar *username;
gchar *passwd;
} GstRTSPConnection;
/* opening/closing a connection */
GstRTSPResult gst_rtsp_connection_create (GstRTSPUrl *url, GstRTSPConnection **conn);
GstRTSPResult gst_rtsp_connection_connect (GstRTSPConnection *conn, GTimeVal *timeout);
GstRTSPResult gst_rtsp_connection_close (GstRTSPConnection *conn);
GstRTSPResult gst_rtsp_connection_free (GstRTSPConnection *conn);
/* sending/receiving raw bytes */
GstRTSPResult gst_rtsp_connection_read (GstRTSPConnection * conn, guint8 * data,
guint size, GTimeVal * timeout);
GstRTSPResult gst_rtsp_connection_write (GstRTSPConnection * conn, const guint8 * data,
guint size, GTimeVal * timeout);
/* sending/receiving messages */
GstRTSPResult gst_rtsp_connection_send (GstRTSPConnection *conn, GstRTSPMessage *message, GTimeVal *timeout);
GstRTSPResult gst_rtsp_connection_receive (GstRTSPConnection *conn, GstRTSPMessage *message, GTimeVal *timeout);
/* reset the timeout */
GstRTSPResult gst_rtsp_connection_next_timeout (GstRTSPConnection *conn, GTimeVal *timeout);
GstRTSPResult gst_rtsp_connection_reset_timeout (GstRTSPConnection *conn);
/* flushing state */
GstRTSPResult gst_rtsp_connection_flush (GstRTSPConnection *conn, gboolean flush);
/* Configure Authentication data */
GstRTSPResult gst_rtsp_connection_set_auth (GstRTSPConnection *conn, GstRTSPAuthMethod method,
gchar *user, gchar *pass);
G_END_DECLS
#endif /* __GST_RTSP_CONNECTION_H__ */
/* GStreamer
* Copyright (C) <2005,2006> Wim Taymans <wim@fluendo.com>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Library General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Library General Public License for more details.
*
* 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.
*/
/*
* Unless otherwise indicated, Source Code is licensed under MIT license.
* See further explanation attached in License Statement (distributed in the file
* LICENSE).
*
* Permission is hereby granted, free of charge, to any person obtaining a copy of
* this software and associated documentation files (the "Software"), to deal in
* the Software without restriction, including without limitation the rights to
* use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
* of the Software, and to permit persons to whom the Software is furnished to do
* so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
#include <errno.h>
extern int h_errno;
#include "gstrtspdefs.h"
#ifndef G_OS_WIN32
#include <netdb.h>
#endif
static const gchar *rtsp_results[] = {
"OK",
/* errors */
"Generic error",
"Invalid parameter specified",
"Operation interrupted",
"Out of memory",
"Cannot resolve host",
"Function not implemented",
"System error: %s",
"Parse error",
"Error on WSAStartup",
"Windows sockets are not version 0x202",
"Received end-of-file",
"Network error: %s",
"Host is not a valid IP address",
"Timeout while waiting for server response",
"Unknown error (%d)",
NULL
};
static const gchar *rtsp_methods[] = {
"DESCRIBE",
"ANNOUNCE",
"GET_PARAMETER",
"OPTIONS",
"PAUSE",
"PLAY",
"RECORD",
"REDIRECT",
"SETUP",
"SET_PARAMETER",
"TEARDOWN",
NULL
};
static const gchar *rtsp_headers[] = {
"Accept", /* Accept R opt. entity */
"Accept-Encoding", /* Accept-Encoding R opt. entity */
"Accept-Language", /* Accept-Language R opt. all */
"Allow", /* Allow r opt. all */
"Authorization", /* Authorization R opt. all */
"Bandwidth", /* Bandwidth R opt. all */
"Blocksize", /* Blocksize R opt. all but OPTIONS, TEARDOWN */
"Cache-Control", /* Cache-Control g opt. SETUP */
"Conference", /* Conference R opt. SETUP */
"Connection", /* Connection g req. all */
"Content-Base", /* Content-Base e opt. entity */
"Content-Encoding", /* Content-Encoding e req. SET_PARAMETER, DESCRIBE, ANNOUNCE */
"Content-Language", /* Content-Language e req. DESCRIBE, ANNOUNCE */
"Content-Length", /* Content-Length e req. SET_PARAMETER, ANNOUNCE, entity */
"Content-Location", /* Content-Location e opt. entity */
"Content-Type", /* Content-Type e req. SET_PARAMETER, ANNOUNCE, entity */
"CSeq", /* CSeq g req. all */
"Date", /* Date g opt. all */
"Expires", /* Expires e opt. DESCRIBE, ANNOUNCE */
"From", /* From R opt. all */
"If-Modified-Since", /* If-Modified-Since R opt. DESCRIBE, SETUP */
"Last-Modified", /* Last-Modified e opt. entity */
"Proxy-Authenticate", /* Proxy-Authenticate */
"Proxy-Require", /* Proxy-Require R req. all */
"Public", /* Public r opt. all */
"Range", /* Range Rr opt. PLAY, PAUSE, RECORD */
"Referer", /* Referer R opt. all */
"Require", /* Require R req. all */
"Retry-After", /* Retry-After r opt. all */
"RTP-Info", /* RTP-Info r req. PLAY */
"Scale", /* Scale Rr opt. PLAY, RECORD */
"Session", /* Session Rr req. all but SETUP, OPTIONS */
"Server", /* Server r opt. all */
"Speed", /* Speed Rr opt. PLAY */
"Transport", /* Transport Rr req. SETUP */
"Unsupported", /* Unsupported r req. all */
"User-Agent", /* User-Agent R opt. all */
"Via", /* Via g opt. all */
"WWW-Authenticate", /* WWW-Authenticate r opt. all */
/* Real extensions */
"ClientChallenge", /* ClientChallenge */
"RealChallenge1", /* RealChallenge1 */
"RealChallenge2", /* RealChallenge2 */
"RealChallenge3", /* RealChallenge3 */
"Subscribe", /* Subscribe */
"Alert", /* Alert */
"ClientID", /* ClientID */
"CompanyID", /* CompanyID */
"GUID", /* GUID */
"RegionData", /* RegionData */
"SupportsMaximumASMBandwidth", /* SupportsMaximumASMBandwidth */
"Language", /* Language */
"PlayerStarttime", /* PlayerStarttime */
NULL
};
#define DEF_STATUS(c, t) \
g_hash_table_insert (statuses, GUINT_TO_POINTER(c), t)
static GHashTable *
rtsp_init_status (void)
{
GHashTable *statuses = g_hash_table_new (NULL, NULL);
DEF_STATUS (GST_RTSP_STS_CONTINUE, "Continue");
DEF_STATUS (GST_RTSP_STS_OK, "OK");
DEF_STATUS (GST_RTSP_STS_CREATED, "Created");
DEF_STATUS (GST_RTSP_STS_LOW_ON_STORAGE, "Low on Storage Space");
DEF_STATUS (GST_RTSP_STS_MULTIPLE_CHOICES, "Multiple Choices");
DEF_STATUS (GST_RTSP_STS_MOVED_PERMANENTLY, "Moved Permanently");
DEF_STATUS (GST_RTSP_STS_MOVE_TEMPORARILY, "Moved Temporarily");
DEF_STATUS (GST_RTSP_STS_SEE_OTHER, "See Other");
DEF_STATUS (GST_RTSP_STS_NOT_MODIFIED, "Not Modified");
DEF_STATUS (GST_RTSP_STS_USE_PROXY, "Use Proxy");
DEF_STATUS (GST_RTSP_STS_BAD_REQUEST, "Bad Request");
DEF_STATUS (GST_RTSP_STS_UNAUTHORIZED, "Unauthorized");
DEF_STATUS (GST_RTSP_STS_PAYMENT_REQUIRED, "Payment Required");
DEF_STATUS (GST_RTSP_STS_FORBIDDEN, "Forbidden");
DEF_STATUS (GST_RTSP_STS_NOT_FOUND, "Not Found");
DEF_STATUS (GST_RTSP_STS_METHOD_NOT_ALLOWED, "Method Not Allowed");
DEF_STATUS (GST_RTSP_STS_NOT_ACCEPTABLE, "Not Acceptable");
DEF_STATUS (GST_RTSP_STS_PROXY_AUTH_REQUIRED,
"Proxy Authentication Required");
DEF_STATUS (GST_RTSP_STS_REQUEST_TIMEOUT, "Request Time-out");
DEF_STATUS (GST_RTSP_STS_GONE, "Gone");
DEF_STATUS (GST_RTSP_STS_LENGTH_REQUIRED, "Length Required");
DEF_STATUS (GST_RTSP_STS_PRECONDITION_FAILED, "Precondition Failed");
DEF_STATUS (GST_RTSP_STS_REQUEST_ENTITY_TOO_LARGE,
"Request Entity Too Large");
DEF_STATUS (GST_RTSP_STS_REQUEST_URI_TOO_LARGE, "Request-URI Too Large");
DEF_STATUS (GST_RTSP_STS_UNSUPPORTED_MEDIA_TYPE, "Unsupported Media Type");
DEF_STATUS (GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD,
"Parameter Not Understood");
DEF_STATUS (GST_RTSP_STS_CONFERENCE_NOT_FOUND, "Conference Not Found");
DEF_STATUS (GST_RTSP_STS_NOT_ENOUGH_BANDWIDTH, "Not Enough Bandwidth");
DEF_STATUS (GST_RTSP_STS_SESSION_NOT_FOUND, "Session Not Found");
DEF_STATUS (GST_RTSP_STS_METHOD_NOT_VALID_IN_THIS_STATE,
"Method Not Valid in This State");
DEF_STATUS (GST_RTSP_STS_HEADER_FIELD_NOT_VALID_FOR_RESOURCE,
"Header Field Not Valid for Resource");
DEF_STATUS (GST_RTSP_STS_INVALID_RANGE, "Invalid Range");
DEF_STATUS (GST_RTSP_STS_PARAMETER_IS_READONLY, "Parameter Is Read-Only");
DEF_STATUS (GST_RTSP_STS_AGGREGATE_OPERATION_NOT_ALLOWED,
"Aggregate operation not allowed");
DEF_STATUS (GST_RTSP_STS_ONLY_AGGREGATE_OPERATION_ALLOWED,
"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_INTERNAL_SERVER_ERROR, "Internal Server Error");
DEF_STATUS (GST_RTSP_STS_NOT_IMPLEMENTED, "Not Implemented");
DEF_STATUS (GST_RTSP_STS_BAD_GATEWAY, "Bad Gateway");
DEF_STATUS (GST_RTSP_STS_SERVICE_UNAVAILABLE, "Service Unavailable");
DEF_STATUS (GST_RTSP_STS_GATEWAY_TIMEOUT, "Gateway Time-out");
DEF_STATUS (GST_RTSP_STS_RTSP_VERSION_NOT_SUPPORTED,
"RTSP Version not supported");
DEF_STATUS (GST_RTSP_STS_OPTION_NOT_SUPPORTED, "Option not supported");
return statuses;
}
gchar *
gst_rtsp_strresult (GstRTSPResult result)
{
gint idx;
gchar *res;
idx = ABS (result);
idx = CLAMP (idx, 0, -GST_RTSP_ELAST);
switch (idx) {
case -GST_RTSP_ESYS:
res = g_strdup_printf (rtsp_results[idx], g_strerror (errno));
break;
case -GST_RTSP_ENET:
#ifndef G_OS_WIN32
res = g_strdup_printf (rtsp_results[idx], hstrerror (h_errno));
#else
res =
g_strdup
("not supported on win32, implement me in a different way ??");
#endif
break;
case -GST_RTSP_ELAST:
res = g_strdup_printf (rtsp_results[idx], result);
break;
default:
res = g_strdup (rtsp_results[idx]);
break;
}
return res;
}
const gchar *
gst_rtsp_method_as_text (GstRTSPMethod method)
{
gint i;
if (method == GST_RTSP_INVALID)
return NULL;
i = 0;
while ((method & 1) == 0) {
i++;
method >>= 1;
}
return rtsp_methods[i];
}
const gchar *
gst_rtsp_version_as_text (GstRTSPVersion version)
{
switch (version) {
case GST_RTSP_VERSION_1_0:
return "1.0";
default:
return "0.0";
}
}
const gchar *
gst_rtsp_header_as_text (GstRTSPHeaderField field)