コード例 #1
0
void
rtsp_handle_options_request(RTSP_Client *client, RTSP_Ps *state)
{
	GstRTSPMethod options;
	gchar *str;

	rtsp_client_remove_dead_session(client);
	options = GST_RTSP_DESCRIBE |
		GST_RTSP_OPTIONS |
		GST_RTSP_PAUSE |
		GST_RTSP_PLAY |
		GST_RTSP_SETUP |
		GST_RTSP_GET_PARAMETER | GST_RTSP_SET_PARAMETER | GST_RTSP_TEARDOWN;

	str = gst_rtsp_options_as_text(options);

	gst_rtsp_message_init_response(
		state->response, 
		GST_RTSP_STS_OK,
		gst_rtsp_status_as_text(GST_RTSP_STS_OK),
		state->request
	);

	gst_rtsp_message_add_header(state->response, GST_RTSP_HDR_PUBLIC, str);
	g_free(str);

	rtsp_client_send_response(client, NULL, state->response);
}
コード例 #2
0
ファイル: nmp_dev_rtsp.c プロジェクト: dulton/nampu
static __inline__ void
nmp_rtsp_device_send_generic_response(NmpMediaDevice *device,
	GstRTSPStatusCode code, NmpRtspState *state)
{
	gst_rtsp_message_init_response(state->response, code,
		gst_rtsp_status_as_text(code), state->request);

	nmp_rtsp_device_send_response(device, state->response);
}
コード例 #3
0
/**
 * gst_rtsp_message_new_response:
 * @msg: a location for the new #GstRTSPMessage
 * @code: the status code
 * @reason: the status reason or #NULL
 * @request: the request that triggered the response or #NULL
 *
 * Create a new response #GstRTSPMessage with @code and @reason and store the
 * result message in @msg. 
 *
 * When @reason is #NULL, the default reason for @code will be used.
 *
 * When @request is not #NULL, the relevant headers will be copied to the new
 * response message.
 *
 * Returns: a #GstRTSPResult. Free with gst_rtsp_message_free().
 */
GstRTSPResult
gst_rtsp_message_new_response (GstRTSPMessage ** msg, GstRTSPStatusCode code,
    const gchar * reason, const GstRTSPMessage * request)
{
  GstRTSPMessage *newmsg;

  g_return_val_if_fail (msg != NULL, GST_RTSP_EINVAL);

  newmsg = g_new0 (GstRTSPMessage, 1);

  *msg = newmsg;

  return gst_rtsp_message_init_response (newmsg, code, reason, request);
}
コード例 #4
0
/**
 * gst_rtsp_params_get:
 * @client: a #GstRTSPClient
 * @ctx: a #GstRTSPContext
 *
 * Get parameters (not implemented yet)
 *
 * Returns: a #GstRTSPResult
 */
GstRTSPResult
gst_rtsp_params_get (GstRTSPClient * client, GstRTSPContext * ctx)
{
  GstRTSPStatusCode code;

  /* FIXME, actually parse the request based on the mime type and try to repond
   * with a list of the parameters */
  code = GST_RTSP_STS_PARAMETER_NOT_UNDERSTOOD;

  gst_rtsp_message_init_response (ctx->response, code,
      gst_rtsp_status_as_text (code), ctx->request);

  return GST_RTSP_OK;
}
コード例 #5
0
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;
  }
}
コード例 #6
0
ファイル: nmp_dev_rtsp.c プロジェクト: dulton/nampu
static __inline__ void
nmp_rtsp_give_options_response(NmpMediaDevice *device, 
	NmpRtspState *state, GstRTSPStatusCode code)
{
	GstRTSPMethod options;
	gchar *str;

	if (code == GST_RTSP_STS_OK)
	{
		options = GST_RTSP_OPTIONS | GST_RTSP_TEARDOWN;
		str = gst_rtsp_options_as_text(options);
		gst_rtsp_message_init_response(state->response, GST_RTSP_STS_OK,
	 		gst_rtsp_status_as_text(GST_RTSP_STS_OK), state->request);
		gst_rtsp_message_add_header(state->response, GST_RTSP_HDR_PUBLIC, str);
		g_free(str);
		nmp_rtsp_device_send_response(device, state->response);	
	}
	else
	{
		nmp_rtsp_device_send_generic_response(device, code, state);
	}
}