Beispiel #1
0
static int rtsp_send_request( rtsp_client_t *rtsp, const char *psz_type,
                              const char *psz_what )
{
    char **ppsz_payload = rtsp->p_private->scheduled;
    char *psz_buffer;
    int i_ret;

    psz_buffer = xmalloc( strlen(psz_type) + strlen(psz_what) +
                         sizeof("RTSP/1.0") + 2 );

    sprintf( psz_buffer, "%s %s %s", psz_type, psz_what, "RTSP/1.0" );
    i_ret = rtsp_put( rtsp, psz_buffer );
    free( psz_buffer );

    if( ppsz_payload )
        while( *ppsz_payload )
        {
            rtsp_put( rtsp, *ppsz_payload );
            ppsz_payload++;
        }
    rtsp_put( rtsp, "" );
    rtsp_unschedule_all( rtsp );

    return i_ret;
}
Beispiel #2
0
static int rtsp_send_request( rtsp_client_t *rtsp, const char *psz_type,
                              const char *psz_what )
{
    char **ppsz_payload = rtsp->p_private->scheduled;
    char *psz_buffer;
    int i_ret;

    psz_buffer =(char*) malloc( strlen(psz_type) + strlen(psz_what) +
                         sizeof("RTSP/1.0") + 2 );

    sprintf( psz_buffer, "%s %s %s", psz_type, psz_what, "RTSP/1.0" );
    i_ret = rtsp_put( rtsp, psz_buffer );
    free( psz_buffer );
		

    if( ppsz_payload ){		
        PRINTF("rtsp_send_request:pp sz_payload = %s\n",*ppsz_payload);
        while( *ppsz_payload )
        {
            rtsp_put( rtsp, *ppsz_payload );
            ppsz_payload++;
        }
    }
        
        
 	if(rtsp->p_private->user_agent != NULL && strlen(rtsp->p_private->user_agent) != 0)
		rtsp_put(rtsp,rtsp->p_private->user_agent);
			
			       
    rtsp_put( rtsp, "" );
    rtsp_unschedule_all( rtsp );
	PRINTF("rtsp_send_request:rtsp_send_request END\n");
    return i_ret;
}
Beispiel #3
0
static void rtsp_close( rtsp_client_t *rtsp )
{
    if( rtsp->p_private->server_state )
    {
		if(rtsp->p_private->s != 0){
	    	closesocket( rtsp->p_private->s);
			rtsp->p_private->s=0;
		}
        /* TODO: send a TEAROFF */
//	 rtsp->pf_disconnect( rtsp->p_userdata );
    }
		if(rtsp->p_private != NULL)
		{
		if( rtsp->p_private->path  != NULL)
   	 		free( rtsp->p_private->path );
   	 	if( rtsp->p_private->host  != NULL)	
    		free( rtsp->p_private->host );
    	if( rtsp->p_private->mrl  != NULL)
    		free( rtsp->p_private->mrl );
    	if( rtsp->p_private->session  != NULL)
    		free( rtsp->p_private->session );
    	if( rtsp->p_private->user_agent  != NULL)
   	 		free( rtsp->p_private->user_agent );
   	 	if( rtsp->p_private->server  != NULL)
    		free( rtsp->p_private->server );
    }
    rtsp_free_answers( rtsp );
    rtsp_unschedule_all( rtsp );
    free( rtsp->p_private );
}
Beispiel #4
0
static int rtsp_send_request( rtsp_client_t *rtsp, const char *psz_type,
                              const char *psz_what )
{
    char **ppsz_payload;
    char *psz_buffer;
    int i_ret, i;

    if (rtsp->p_private == NULL)
      return -1;

    ppsz_payload = rtsp->p_private->scheduled;

    psz_buffer = xmalloc( strlen(psz_type) + strlen(psz_what) +
                         sizeof("RTSP/1.0") + 2 );

    sprintf( psz_buffer, "%s %s %s", psz_type, psz_what, "RTSP/1.0" );
    i_ret = rtsp_put( rtsp, psz_buffer );
    free( psz_buffer );

    for (i = 0; i < MAX_FIELDS; ++i) {
      if (!ppsz_payload[i])
        break;

      rtsp_put (rtsp, ppsz_payload[i]);
    }

    rtsp_put( rtsp, "" );
    rtsp_unschedule_all( rtsp );

    return i_ret;
}
Beispiel #5
0
void rtsp_close(rtsp_t *s) {

  if (s->server_state) close(s->s); /* TODO: send a TEAROFF */
  if (s->path) free(s->path);
  if (s->host) free(s->host);
  if (s->mrl) free(s->mrl);
  if (s->session) free(s->session);
  if (s->user_agent) free(s->user_agent);
  free(s->auth);
  rtsp_free_answers(s);
  rtsp_unschedule_all(s);
  free(s);
}
Beispiel #6
0
void rtsp_close( rtsp_client_t *rtsp )
{
    if( rtsp->p_private->server_state )
    {
        /* TODO: send a TEAROFF */
        rtsp->pf_disconnect( rtsp->p_userdata );
    }

    free( rtsp->p_private->path );
    free( rtsp->p_private->host );
    free( rtsp->p_private->mrl );
    free( rtsp->p_private->session );
    free( rtsp->p_private->user_agent );
    free( rtsp->p_private->server );
    rtsp_free_answers( rtsp );
    rtsp_unschedule_all( rtsp );
    free( rtsp->p_private );
}
Beispiel #7
0
static void rtsp_send_request(rtsp_t *s, const char *type, const char *what) {

  char **payload=s->scheduled;
  char *buf;

  buf = _x_asprintf("%s %s %s",type, what, rtsp_protocol_version);
  rtsp_put(s,buf);

  if (s->auth) {
    rtsp_put(s, s->auth);
  }

  if (payload)
    while (*payload) {
      rtsp_put(s,*payload);
      payload++;
    }
  rtsp_put(s,"");
  rtsp_unschedule_all(s);
}