rtspsrc: allow sending short RTSP requests to a server

Some encoders (Arecont) do not like the long OPTIONS sent at startup as sent by
GStreamer, but do accept the short header as sent by Live555.

This patch makes the extending the request optional by adding a property
(short-header).

Fixes #655805.

API: GstRTSPSrc:short-header
This commit is contained in:
Marc Leeman 2011-09-05 13:18:39 +02:00 committed by Mark Nauwelaerts
parent d4778dbe43
commit ce276d903c
2 changed files with 17 additions and 1 deletions

View file

@ -173,6 +173,7 @@ gst_rtsp_src_buffer_mode_get_type (void)
#define DEFAULT_USER_PW NULL
#define DEFAULT_BUFFER_MODE BUFFER_MODE_AUTO
#define DEFAULT_PORT_RANGE NULL
#define DEFAULT_SHORT_HEADER FALSE
enum
{
@ -194,6 +195,7 @@ enum
PROP_BUFFER_MODE,
PROP_PORT_RANGE,
PROP_UDP_BUFFER_SIZE,
PROP_SHORT_HEADER,
PROP_LAST
};
@ -472,6 +474,11 @@ gst_rtspsrc_class_init (GstRTSPSrcClass * klass)
0, G_MAXINT, DEFAULT_UDP_BUFFER_SIZE,
G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
g_object_class_install_property (gobject_class, PROP_SHORT_HEADER,
g_param_spec_boolean ("short-header", "Short Header",
"Only send the basic RTSP headers for broken encoders",
DEFAULT_SHORT_HEADER, G_PARAM_READWRITE | G_PARAM_STATIC_STRINGS));
gstelement_class->send_event = gst_rtspsrc_send_event;
gstelement_class->change_state = gst_rtspsrc_change_state;
@ -510,6 +517,7 @@ gst_rtspsrc_init (GstRTSPSrc * src, GstRTSPSrcClass * g_class)
src->client_port_range.min = 0;
src->client_port_range.max = 0;
src->udp_buffer_size = DEFAULT_UDP_BUFFER_SIZE;
src->short_header = DEFAULT_SHORT_HEADER;
/* get a list of all extensions */
src->extensions = gst_rtsp_ext_list_get ();
@ -703,6 +711,9 @@ gst_rtspsrc_set_property (GObject * object, guint prop_id, const GValue * value,
case PROP_UDP_BUFFER_SIZE:
rtspsrc->udp_buffer_size = g_value_get_int (value);
break;
case PROP_SHORT_HEADER:
rtspsrc->short_header = g_value_get_boolean (value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -795,6 +806,9 @@ gst_rtspsrc_get_property (GObject * object, guint prop_id, GValue * value,
case PROP_UDP_BUFFER_SIZE:
g_value_set_int (value, rtspsrc->udp_buffer_size);
break;
case PROP_SHORT_HEADER:
g_value_set_boolean (value, rtspsrc->short_header);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, prop_id, pspec);
break;
@ -4452,7 +4466,8 @@ gst_rtspsrc_try_send (GstRTSPSrc * src, GstRTSPConnection * conn,
gint try = 0;
again:
gst_rtsp_ext_list_before_send (src->extensions, request);
if (!src->short_header)
gst_rtsp_ext_list_before_send (src->extensions, request);
GST_DEBUG_OBJECT (src, "sending message");

View file

@ -214,6 +214,7 @@ struct _GstRTSPSrc {
gint buffer_mode;
GstRTSPRange client_port_range;
gint udp_buffer_size;
gboolean short_header;
/* state */
GstRTSPState state;