rtspwms: reply to extension commands

Reply with OK to the extension commands for WMS.
This commit is contained in:
Wim Taymans 2009-04-14 10:54:37 +02:00
parent 4203f7189c
commit ef31993f34

View file

@ -44,6 +44,7 @@ GST_ELEMENT_DETAILS ("WMS RTSP Extension",
#define SERVER_PREFIX "WMServer/"
#define HEADER_PREFIX "data:application/vnd.ms.wms-hdr.asfv1;base64,"
#define EXTENSION_CMD "application/x-wms-extension-cmd"
static GstRTSPResult
gst_rtsp_wms_before_send (GstRTSPExtension * ext, GstRTSPMessage * request)
@ -158,6 +159,55 @@ gst_rtsp_wms_configure_stream (GstRTSPExtension * ext, GstCaps * caps)
return TRUE;
}
static GstRTSPResult
gst_rtsp_wms_receive_request (GstRTSPExtension * ext, GstRTSPMessage * request)
{
GstRTSPWMS *ctx;
GstRTSPResult res = GST_RTSP_ENOTIMPL;
GstRTSPMessage response = { 0 };
ctx = (GstRTSPWMS *) ext;
GST_DEBUG_OBJECT (ext, "before send");
switch (request->type_data.request.method) {
case GST_RTSP_SET_PARAMETER:
{
gchar *content_type = NULL;
gst_rtsp_message_get_header (request, GST_RTSP_HDR_CONTENT_TYPE,
&content_type, 0);
if (content_type && g_ascii_strcasecmp (content_type, EXTENSION_CMD)) {
/* parse the command */
/* default implementation, send OK */
res = gst_rtsp_message_init_response (&response, GST_RTSP_STS_OK, "OK",
request);
if (res < 0)
goto send_error;
GST_DEBUG_OBJECT (ctx, "replying with OK");
/* send reply */
if ((res = gst_rtsp_extension_send (ext, request, &response)) < 0)
goto send_error;
res = GST_RTSP_EEOF;
}
break;
}
default:
break;
}
return res;
send_error:
{
return res;
}
}
static void gst_rtsp_wms_finalize (GObject * object);
static GstStateChangeReturn gst_rtsp_wms_change_state (GstElement * element,
@ -245,4 +295,5 @@ gst_rtsp_wms_extension_init (gpointer g_iface, gpointer iface_data)
iface->before_send = gst_rtsp_wms_before_send;
iface->after_send = gst_rtsp_wms_after_send;
iface->configure_stream = gst_rtsp_wms_configure_stream;
iface->receive_request = gst_rtsp_wms_receive_request;
}